Classic Rendering¶
The classic path is the way ThinkGeo drew maps before version 15, and it is still in every package: a MapView with Overlays, a LayerOverlay holding FeatureLayers and raster layers, and styles written in C# on each layer's ZoomLevelSet. The tiles are drawn on the CPU. This chapter says when it is the path to use, how it relates to the style document, and where the detailed guides are.
When you use it¶
- .NET Framework. The style-document renderer needs .NET 8 or later. A WPF or WinForms project on .NET Framework 4.6.2 to 4.8 installs the same
ThinkGeo.UI.WpforThinkGeo.UI.WinFormspackage, but itsMapViewhas noBasemap; it draws with overlays. - .NET MAUI before 15.1. Until ThinkGeo 15.1 the MAUI
MapViewhad noBasemap: it drew the ThinkGeo Cloud style document as CPU tiles throughThinkGeoVectorTileOverlay, and your own data through classic layers. From 15.1 it draws aGpuBasemapon iOS, Android and Windows, and the classic overlays are still available on top of it. - Image tiles drawn where the code runs.
ThinkGeo.UI.WebApirenders classic layers to image tiles on the server, and so does the BlazorLayerOverlayunder Interactive Server; in Blazor WebAssembly it draws them in the browser, with SkiaSharp's WebAssembly build. - Content made from the whole view. A graticule whose spacing and edge labels follow the viewport has no tile to belong to.
- Drawing only the classic layers do. S-52 nautical charts (
NauticalChartsFeatureLayer), raster tiles reprojected as they are read, and the keyed commercial raster providers. - Applications written for ThinkGeo 14. The classic API is unchanged in 15. Such an application runs as it is, and can move its layers into a style one at a time; see Migrating.
On .NET 8 and later, for a new map, draw with a style document instead; How the Map Is Drawn explains the model and the Styling guides fill it in. Markers, popups, drawing and editing are overlays in both paths; the Desktop Controls and Blazor guides cover them.
The two paths side by side¶
| Style document | Classic | |
|---|---|---|
| The basemap | Map.Basemap = new GpuBasemap(new MapStyle(ThinkGeoVectorStyles.Light, new ThinkGeoVectorTileSource(apiKey))) | Map.Overlays.Add(new ThinkGeoVectorTileOverlay(apiKey)) |
| Your data | A FeatureSource in a FeatureSourceVectorTileSource, drawn by the document's layers | A FeatureLayer in a LayerOverlay, drawn by the styles on its ZoomLevelSet |
| Rules | match, step, filter, case, minzoom and maxzoom | ValueStyle, ClassBreakStyle, FilterStyle, the 20 ZoomLevels |
| Labels | A symbol layer | A TextStyle |
| Changing the look | SetStyleAsync with a new document; SetLayerVisibility | Change the styles and RefreshAsync the overlay |
| Where it is drawn | GPU, as the map moves | CPU, into tiles or a single image per overlay |
| Markers, popups, drawing, editing | Overlays | Overlays |
A classic map¶
The same six lines as the style-document map, with an overlay in place of the basemap and a layer in place of the document. This runs on .NET Framework and on .NET 8.
using ThinkGeo.Core;
using ThinkGeo.UI.Wpf;
private async void Map_Loaded(object sender, RoutedEventArgs e)
{
Map.MapUnit = GeographyUnit.Meter;
Map.Overlays.Add(new ThinkGeoVectorTileOverlay(cloudApiKey)
{
TileCache = new FileRasterTileCache(cacheFolder, "basemap")
});
var parks = new ShapeFileFeatureLayer(@"Data\Parks.shp");
parks.FeatureSource.ProjectionConverter = new ProjectionConverter(2276, 3857);
parks.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromHtml("#2E4A3B")), new GeoPen(GeoColor.FromHtml("#4F7A5F"), 1));
parks.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
var overlay = new LayerOverlay();
overlay.Layers.Add("parks", parks);
Map.Overlays.Add(overlay);
Map.CenterPoint = new PointShape(-10777290, 3908740);
Map.CurrentScale = 9000;
await Map.RefreshAsync();
}
ThinkGeoVectorTileOverlay(apiKey)draws the ThinkGeo Cloud Light style as tiles;ThinkGeoVectorTileOverlay(apiKey, styleUri)takesThinkGeoVectorStyles.Darkor your own style address.ThinkGeoCloudRasterMapsOverlayis the raster basemap.- A
FeatureLayerhas 20 presetZoomLevels. A style set onZoomLevel01withApplyUntilZoomLevel = Level20applies at every zoom; see Zoom Levels. - Overlays draw in collection order, first at the bottom.
The guides in this chapter cover each piece: Area, Line, Point and Text styles, Class Break and Value styles, the In-Memory and Shapefile layers, vector tiles as classic layers and extending the SDK with layers and styles of your own.
Migrating a classic layer¶
A FeatureLayer with its ZoomLevelSet styles can be translated into style layers and added to a MapStyle, so an application written for ThinkGeo 14 moves to the style document without rewriting its styles:
var style = new MapStyle(ThinkGeoVectorStyles.Light, cloud);
var warnings = new List<string>();
foreach (var layer in classicLayers)
{
var translation = FeatureLayerTranslator.Translate(layer, Map.ZoomScales);
style.AddFeatureLayer(translation);
warnings.AddRange(translation.Warnings);
}
Map.Basemap = new GpuBasemap(style);
AreaStyle (hatches included), LineStyle, PointStyle, TextStyle, ValueStyle, ClassBreakStyle, RegexStyle and CompositeStyle translate. FilterStyle, ClusterPointStyle and a Style subclass of your own are named in Warnings and stay on a classic LayerOverlay, which can sit in Map.Overlays above the basemap. The HowDoI sample Migrate a Classic Layer draws the same five layers both ways, the two maps moving together.
Mixing the two: an overlay is always drawn above the whole basemap, labels included, as a picture laid on the ground. While the map is tilted, drawing and editing overlays stay flat and are meant for the untilted map.
Basemap overlays that are going away¶
| Obsolete | Use instead |
|---|---|
ThinkGeoCloudVectorMapsOverlay (removed in 15.4) | ThinkGeoVectorTileOverlay, which draws the newer ThinkGeo vector tiles |
GoogleMapsOverlay (removed after 15.3) | GoogleMapsStaticOverlay |
BingMapsOverlay (removed in 17.0; the Bing Maps service itself is retiring) | AzureMapsRasterOverlay |
The classic cloud raster basemap, ThinkGeoCloudRasterMapsOverlay, stays.