ThinkGeo Basics: Layers and Overlays

This is the third post in our ‘ThinkGeo Basics’ series where we introduce new GIS developers to the basics of building a map. In previous posts, we have discussed Feature Sources and Styling. Today we’ll dive into Overlays and Layers and how they work together to build great looking maps!

A Simple Example

As you review our samples and documentation, you may notice a lot objects that are derived from the base Overlay and Layer classes. We’ll try to clarify how to use each in the code snippet below that builds a very simple map of point data showing world capitals:

  
// create a new layer from a shapefile.
var capitalLayer = new ShapeFileFeatureLayer(@"..\..\..\AppData\WorldCapitals.shp");
//style the new layer
capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateSimplePointStyle(PointSymbolType.Diamond, GeoColors.Red, 10);
capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

// Add the layer to an overlay, add that overlay to the map.
var customDataOverlay = new LayerOverlay();
customDataOverlay.Layers.Add(capitalLayer);
mapView.Overlays.Add(customDataOverlay);   
  

You will notice that the Layer (in this case a ShapeFileFeatureLayer) is instantiated with a reference to the data source - in this case a simple shapefile containing point data for world capitals. Next, the layer is given a visual style so the capitals will display as red diamonds.

After the layer is created and styled, a LayerOverlay is created and the capitalLayer is added to the overlay’s collection of layers, and then the overlay is added to the map.

Code like this is very common. You will typically have one layer per data source and the visual style is applied to each layer. Then the layers are combined into overlays which are then added to the map.

Below are a few bullet points to help you better understand Layers and Overlays.

Layers

  • A Layer typically represents a single source of data. Examples would be a restaurant, road or building footprint.

  • Layers are responsible for rendering specific types of geographic data on the map. For example, you can have a ShapeFileFeatureLayer to render data from a shapefile, an InMemoryFeatureLayer to render data stored in memory, or a RasterLayer to display raster images, and many more supported data formats.

  • Each layer has its own set of properties, including a data source, styles, visibility, and drawing order.

  • Styles are applied to a Layer, not an Overlay. More details on styling can be found in this post.

  • Layers can be grouped together in overlays to organize and control their display on the map.

Overlays

  • An Overlay is a container or grouping mechanism for managing multiple layers together as a single unit.

  • Every map consists of one or more Overlays.

  • Overlays are used to organize and control the rendering order and visibility of multiple layers on the map. You can think of an overlay as a stack of layers that are rendered in a specific order.

  • Overlays provide a way to manage the arrangement of layers on the map and control which layers are displayed together.

  • Overlays are added to the map in the desired rendering order. When you add overlays to the map, they are drawn in the order they appear in the overlays collection.

  • Tile Caching is done at the overlay level.

  • Performance - if some layers update frequently, then you may want to group them together in a single overlay.

Extensibility

If you need a layer that is unique to your data, you can check out our Extensibility Guide. This guide dives deeper into the specifics of extending ThinkGeo layers to suit your specific needs. We also have an example of Extending Layers in our ‘HowDoI’ samples here - just look for the ‘Extending Layers’ sample under the Extensibility section.

The Extending Layers example demonstrates how to create a custom layer that draws radiuses at different distances from a center point.

Get Started Now

Good luck on your journey into GIS. The first step is to sign up for a free evaluation and start building today!

If you have any questions or specific needs, we encourage you to contact sales@thinkgeo.com and we will do our best to help you figure out how ThinkGeo fits into your organization.

Previous
Previous

Pinch Zoom Rotation on the Mobile UI

Next
Next

Leaflet vs. OpenLayers - Round 2