Web Maps Quick Start¶
This guide puts a map in a web page and then draws your own data on it, in one of two ways. Pick the tab that matches your project; every tab on the page follows your choice.
- WebAPI: an ASP.NET Core service serves your data as vector tiles, and MapLibre GL JS draws them in the browser over the ThinkGeo basemap. Any web page or framework can use the service.
- Blazor: a
MapViewcomponent on a Blazor page, written in C#.
Both read the data on the server with a FeatureSource, cut it into vector tiles with a FeatureSourceVectorTileSource, and draw the tiles in the browser from a style document. The projects target .NET 10.
With an AI coding assistant¶
If you write code with Claude Code, Cursor, GitHub Copilot or Codex, let the assistant do the steps below. Two things make that reliable: the ThinkGeo Agent Skills, which teach it the setup order, the projections and the pitfalls, and the ThinkGeo MCP Server, which answers its API questions from this documentation.
-
Install the skills. The installer needs Node.js and asks which assistants to install for:
npx skills add ThinkGeo/thinkgeo-agent-skills -
Connect the MCP server,
https://ai.thinkgeo.com/mcp. In Claude Code:claude mcp add --transport http --scope user thinkgeo-docs https://ai.thinkgeo.com/mcpIn Codex:
codex mcp add thinkgeo-docs --url https://ai.thinkgeo.com/mcpThe MCP Server page has the steps for Cursor, Copilot, Visual Studio and Rider, and the Agent Skills page has one-step plugins for Claude Code and Codex.
-
Describe what you want, for example:
Create a Blazor Web App on .NET 10 with ThinkGeo.UI.Blazor 15 that shows the ThinkGeo Cloud Light vector basemap and draws Data/WorldCapitals.shp on it as white circles with a black outline, cut into vector tiles with a VectorTileOverlay and styled with style.json. For the basemap, put ThinkGeo's public testing-only Cloud key from the Web Maps Quick Start in the code, SGjwpxF60knqZi3R0A9RRE3GqiuRA1LsnxHMot7rJ58~, so the app runs without any setup.Name the key in the prompt: without it, some assistants leave the key out, or refuse to put one in the code, and the basemap stays blank.
Without the skills and the server, start the prompt with Read https://docs.thinkgeo.com/llms.txt first. The assistant builds the same project the steps below describe, and the License note at the end applies to its build too.
Create the project¶
In Visual Studio create an ASP.NET Core Web API project (C#, .NET 10) and add the ThinkGeo.UI.WebApi NuGet package. From a terminal, the same is:
dotnet new webapi -n WebApiSample
cd WebApiSample
dotnet add package ThinkGeo.UI.WebApi
In Visual Studio create a Blazor Web App (C#, .NET 10) with Server as the interactive render mode, and add the ThinkGeo.UI.Blazor NuGet package. The map also runs on WebAssembly; Blazor WebAssembly at the end of this page says what changes. From a terminal, the same is:
dotnet new blazor -n BlazorSample
cd BlazorSample
dotnet add package ThinkGeo.UI.Blazor
Then add the two namespaces to Components/_Imports.razor:
@using ThinkGeo.Core
@using ThinkGeo.UI.Blazor
The package brings ThinkGeo.Core with it.
Show the basemap¶
The key below is a ThinkGeo Cloud key for the basemap, for testing only; it is not your ThinkGeo license key. You can get your own at cloud.thinkgeo.com.
The browser draws the map. Create a folder wwwroot in the project and save this page in it as index.html. The basemap is ThinkGeo's Light style, a style document that MapLibre reads from the ThinkGeo CDN; its tiles come from ThinkGeo Cloud.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ThinkGeo Web API Quick Start</title>
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5/dist/maplibre-gl.css">
<style>html, body, #map { margin: 0; height: 100%; }</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/maplibre-gl@5/dist/maplibre-gl.js"></script>
<script>
const cloudApiKey = "SGjwpxF60knqZi3R0A9RRE3GqiuRA1LsnxHMot7rJ58~";
const map = new maplibregl.Map({
container: "map",
style: "https://cdn.thinkgeo.com/worldstreets-gl-styles/latest/light.json",
center: [0, 20],
zoom: 1,
// The style asks ThinkGeo Cloud for its tiles with a {key} placeholder; fill it in.
transformRequest: url => ({ url: url.replace("{key}", cloudApiKey) })
});
</script>
</body>
</html>
Then replace the content of Program.cs so the service serves the page:
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// Serve wwwroot/index.html at the site's root.
app.UseDefaultFiles();
app.UseStaticFiles();
app.Run();
Replace the content of Components/Pages/Home.razor with a MapView that has the ThinkGeo Light basemap. The map needs an interactive render mode: without @rendermode InteractiveServer the page shows an empty map.
@page "/"
@rendermode InteractiveServer
<MapView Id="map" MapUnit="GeographyUnit.Meter" Center="@(new PointShape(0, 2000000))" Zoom="2" Width="900" Height="600">
<OverlaysSetting>
<ThinkGeoCloudVectorMapsOverlay Id="basemap" MapType="ThinkGeoCloudVectorMapsMapType.Light"
ApiKey="SGjwpxF60knqZi3R0A9RRE3GqiuRA1LsnxHMot7rJ58~" />
</OverlaysSetting>
</MapView>
Run it¶
Press F5, or run dotnet run and open the address it prints. The first build on your machine starts a free 30-day trial, so there is nothing to set up first; until a license key is in place, the Blazor map carries a Not Licensed for Runtime watermark, and so does every image WebAPI draws on the server, see License at the end.

Add your own data¶
Now put a shapefile of the world's capitals on the map, styled, and reprojected from decimal degrees to the map's Web Mercator. Download WorldCapitals.zip and unpack it into a new folder called Data in your project, with the five files directly in it: Data/WorldCapitals.shp, not Data/WorldCapitals/WorldCapitals.shp. Windows' Extract All proposes that extra WorldCapitals folder, so change the target to Data. The application reads the files from the folder it runs in, so let the build copy them there: open the project file and add this ItemGroup before </Project>.
<ItemGroup>
<None Update="Data\**" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
</ItemGroup>
On the server a ShapeFileFeatureSource reads the file and a FeatureSourceVectorTileSource cuts it into vector tiles as the browser asks for them; the tiles are named after the shapefile, WorldCapitals. In the browser one style layer draws them as white circles with a black outline. The style is the same one the Desktop Maps Quick Start uses.
Replace Program.cs again, now with the tile source and an endpoint that serves its tiles:
using ThinkGeo.Core;
using ThinkGeo.UI.WebApi;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
// Serve wwwroot/index.html at the site's root.
app.UseDefaultFiles();
app.UseStaticFiles();
// Read the shapefile and cut it into vector tiles. The file is in decimal degrees (EPSG:4326);
// vector tiles are Web Mercator (EPSG:3857), so the source reprojects as it reads.
var capitals = new FeatureSourceVectorTileSource();
capitals.FeatureSources.Add(new ShapeFileFeatureSource(Path.Combine(AppContext.BaseDirectory, "Data", "WorldCapitals.shp"))
{
ProjectionConverter = new ProjectionConverter(4326, 3857)
});
var capitalsOverlay = new VectorTileOverlay("capitals", capitals);
// One tile, gzipped, or 204 where there is nothing to draw.
app.MapGet("/tiles/capitals/{z:int}/{x:int}/{y:int}", async (int z, int x, int y, HttpResponse response, CancellationToken cancellationToken) =>
{
var tile = await capitalsOverlay.GetTileAsync(z, x, y, cancellationToken);
if (tile == null) return Results.NoContent();
response.Headers.ContentEncoding = "gzip";
return Results.Bytes(tile, "application/vnd.mapbox-vector-tile");
});
app.Run();
In index.html, add the tiles and the style layer once the basemap has loaded, after the const map = …; statement:
map.on("load", () => {
// The capitals, served by this project.
map.addSource("capitals", {
type: "vector",
tiles: [location.origin + "/tiles/capitals/{z}/{x}/{y}"]
});
// White circles with a black outline. "source-layer" is the shapefile's name.
map.addLayer({
id: "capitals",
type: "circle",
source: "capitals",
"source-layer": "WorldCapitals",
paint: {
"circle-radius": 4,
"circle-color": "#FFFFFF",
"circle-stroke-color": "#000000",
"circle-stroke-width": 2
}
});
});
Add a VectorTileOverlay after the basemap, and the code that feeds it at the end of Home.razor:
@page "/"
@rendermode InteractiveServer
<MapView Id="map" MapUnit="GeographyUnit.Meter" Center="@(new PointShape(0, 2000000))" Zoom="2" Width="900" Height="600">
<OverlaysSetting>
<ThinkGeoCloudVectorMapsOverlay Id="basemap" MapType="ThinkGeoCloudVectorMapsMapType.Light"
ApiKey="SGjwpxF60knqZi3R0A9RRE3GqiuRA1LsnxHMot7rJ58~" />
<VectorTileOverlay Id="capitals" FeatureSources="@capitals" StyleJson="@capitalsJson" />
</OverlaysSetting>
</MapView>
@code {
// Read the shapefile; the overlay cuts it into vector tiles as the browser asks for them.
// The file is in decimal degrees (EPSG:4326); the map is Web Mercator (EPSG:3857),
// so the source reprojects as it reads. The key is the tiles' "source-layer" name.
private readonly GeoCollection<FeatureSource> capitals = new GeoCollection<FeatureSource>
{
{ "WorldCapitals", new ShapeFileFeatureSource(Path.Combine(AppContext.BaseDirectory, "Data", "WorldCapitals.shp"))
{
ProjectionConverter = new ProjectionConverter(4326, 3857)
}
}
};
// A style document for the capitals: white circles with a black outline.
private const string capitalsJson = @"{
""layers"": [
{ ""type"": ""circle"",
""source-layer"": ""WorldCapitals"",
""paint"": {
""circle-radius"": 4,
""circle-color"": ""#FFFFFF"",
""circle-stroke-color"": ""#000000"",
""circle-stroke-width"": 2 } }
]
}";
}
Run it again.

Summary¶
The pieces and how they fit together:
- A
FeatureSourcereads your data on the server. Reading the format is the only line that differs between a shapefile, a database table and features built in code; Supported Data Formats lists them. - A
FeatureSourceVectorTileSourcecuts the data into vector tiles as the browser asks for them, reprojected to Web Mercator. - The browser draws the tiles from a style document: sources say where the data is, layers how it is drawn, in order. The basemap is a style document too.
- In WebAPI your own endpoint serves the tiles, so any page or framework that reads vector tiles can use them. In Blazor the
VectorTileOverlayserves them to itsMapViewfor you.
The Styling guides show what else a style document can do, the Blazor guides what else a MapView can do, and the WebAPI How Do I samples and Blazor How Do I samples cover most of what each can do. To run the service in Docker or on Linux, see the Deployment Guide.
Blazor WebAssembly¶
This guide runs Blazor on the server. The same MapView and overlays also run on Blazor WebAssembly, with the .NET code in the browser, and in the Auto render mode. One step changes: the browser cannot read files on the server, so the application downloads the data and writes it to its own in-memory file system before the ShapeFileFeatureSource opens it. These steps build the same map in a standalone Blazor WebAssembly app, from a new project:
-
In Visual Studio create a Blazor WebAssembly Standalone App (C#, .NET 10) and add the ThinkGeo.UI.Blazor NuGet package. From a terminal, the same is:
dotnet new blazorwasm -n BlazorWasmSample cd BlazorWasmSample dotnet add package ThinkGeo.UI.Blazor -
Add the two namespaces to
_Imports.razorin the project folder:@using ThinkGeo.Core @using ThinkGeo.UI.Blazor -
Unpack WorldCapitals.zip into a new folder
wwwroot/Data, with the five files directly in it. Files inwwwrootare published with the app, so the project file needs noItemGroup. -
Replace the content of
Pages/Home.razor. The page has no@rendermodeline, because every page of a WebAssembly app runs in the browser. It downloads the data when it starts, and adds theVectorTileOverlayonce the data is in:@page "/" @inject HttpClient Http <MapView Id="map" MapUnit="GeographyUnit.Meter" Center="@(new PointShape(0, 2000000))" Zoom="2" Width="900" Height="600"> <OverlaysSetting> <ThinkGeoCloudVectorMapsOverlay Id="basemap" MapType="ThinkGeoCloudVectorMapsMapType.Light" ApiKey="SGjwpxF60knqZi3R0A9RRE3GqiuRA1LsnxHMot7rJ58~" /> @if (capitals != null) { <VectorTileOverlay Id="capitals" FeatureSources="@capitals" StyleJson="@capitalsJson" /> } </OverlaysSetting> </MapView> @code { private GeoCollection<FeatureSource>? capitals; protected override async Task OnInitializedAsync() { // Download the shapefile and write it where the WebAssembly app can open it. var folder = Path.Combine(Path.GetTempPath(), "Data"); Directory.CreateDirectory(folder); foreach (var extension in new[] { "shp", "shx", "dbf", "idx", "ids" }) { var bytes = await Http.GetByteArrayAsync($"Data/WorldCapitals.{extension}"); await File.WriteAllBytesAsync(Path.Combine(folder, "WorldCapitals." + extension), bytes); } // The file is in decimal degrees (EPSG:4326); the map is Web Mercator (EPSG:3857), // so the source reprojects as it reads. The key is the tiles' "source-layer" name. capitals = new GeoCollection<FeatureSource> { { "WorldCapitals", new ShapeFileFeatureSource(Path.Combine(folder, "WorldCapitals.shp")) { ProjectionConverter = new ProjectionConverter(4326, 3857) } } }; } // A style document for the capitals: white circles with a black outline. private const string capitalsJson = @"{ ""layers"": [ { ""type"": ""circle"", ""source-layer"": ""WorldCapitals"", ""paint"": { ""circle-radius"": 4, ""circle-color"": ""#FFFFFF"", ""circle-stroke-color"": ""#000000"", ""circle-stroke-width"": 2 } } ] }"; } -
Press F5, or run
dotnet runand open the address it prints. The map is the same as on the server. The build printsWASM0001warnings about SQLite functions; they concern SQLite-based data sources and do not affect this page.
Everything the application does now happens in the visitor's browser, the Cloud key included. Classic layers, which draw on the client with SkiaSharp, need SkiaSharp's WebAssembly build as well: the Blazor WebAssembly samples show the project settings.
License¶
ThinkGeo 15 checks its license when your project builds, not when it runs, so there is nothing to register, install or activate.
- Without a license key, the first build on your machine starts a free 30-day trial. The build succeeds with warning
TG0001, which tells you how many days of the trial are left, and the Blazor map, and every image WebAPI draws on the server, shows a Not Licensed for Runtime watermark. After 30 days the build stops with errorTG0002until a key is in place. - With a license key, the watermark goes away. Sign in at helpdesk.thinkgeo.com, download your Web key (
web.thinkgeokey) and save it, with its name unchanged, in%LOCALAPPDATA%\ThinkGeo\on Windows, or in~/.thinkgeo/on macOS and Linux. Then build again. There is nothing to activate, and nothing to install on the server you deploy to.
The License Guide for ThinkGeo 15 explains how to get your key, what each TG build message means and how to build on a build server or in a container. If you used ThinkGeo 14 before: Product Center and runtime license files are no longer used, see What Changed from ThinkGeo 14.
Classic rendering and ThinkGeo 14¶
ThinkGeo 14 drew web maps as raster tiles, drawn on the server by a LayerOverlay of FeatureLayers with ZoomLevelSet styles. ThinkGeo 15 keeps that way: a WebAPI action can still return LayerOverlay.GetImageAsync as a PNG tile, and a Blazor MapView can still hold a LayerOverlay, so ThinkGeo 14 code keeps running. ThinkGeo.UI.WebApi also builds for .NET Framework 4.6.2 and later; ThinkGeo.UI.Blazor needs .NET 8 or later.
- Classic Rendering explains the classic layers and styles.
- The WebAPI How Do I samples include raster tiles drawn by classic layers.
- The Legacy tab holds the ThinkGeo 14 pages.