Blog

All Blog Posts  |  Next Post  |  Previous Post

Using tileserver services in TMS FNC Maps for Delphi

Bookmarks: 

Thursday, October 12, 2023

Tileservers can be used to display custom maps that are tailored to your specific needs. Different geographical map representations are possible. Some of the most common types of maps include street maps, topographic maps, and satellite imagery.
Switching maps in TMS FNC Maps for Delphi is easy. Enter the URL of your preferred tileserver provider and the map changes instantly. In this blog post you'll find out how using tileservers works and a quick overview of available tileservers.


Availability

TMS Software Delphi  Components TMS Software Delphi  Components




Please note that using custom tileservers is
 only supported in TTMSFNCLeaflet and TTMSFNCOpenLayers. Both XYZ and WMS type tileservers are supported.

A detailed mapping services comparison is available in this blog post: Comparing mapping services in TMS FNC Maps for Delphi


Code Samples

The XYZ type tileservers only require setting an URL. However, the WMS type tileservers also require setting the Layers parameter. WMS tileservers can include multiple layers. With the Layers parameter the desired layer to display can be selected.

Some tileservers provide transparent layers while other layers cover the map completely. The visibility of the default base layer can be controlled with the ShowBaseLayer property. Multiple layers can be combined as well. A code example is available in this blog post: Discover open source maps in Delphi with Leaflet

Usually it is required to attribute the service used. The attribution text is specified in the details for each service. When using TTMSFNCLeaflet, this text can be added on the map by using the AttributionText property.


XYZ

var
  ll: TTMSFNCLeafletTileLayer;
begin
  TMSFNCLeaflet1.BeginUpdate;  
  TMSFNCLeaflet1.Options.ShowBaseLayer := False;
  TMSFNCLeaflet1.Options.AttributionText := 'Kartendaten: © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: © <a href="http://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)';
  TMSFNCLeaflet1.ClearTileLayers;
  ll := TMSFNCLeaflet1.AddTileLayer('https://a.tile.opentopomap.org/{z}/{x}/{y}.png');
  ll.Source := lsXYZ;
  TMSFNCLeaflet1.EndUpdate;
end;

WMS

var
  l: TTMSFNCLeafletTileLayer;
begin
  TMSFNCLeaflet1.BeginUpdate;
  TMSFNCLeaflet1.Options.ShowBaseLayer := False;
  TMSFNCLeaflet1.Options.AttributionText := 'Maps © <a href="https://www.terrestris.de/">Terrestris</a>, Data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>';
  TMSFNCLeaflet1.ClearTileLayers;
  l := TMSFNCLeaflet1.AddTileLayer('https://ows.terrestris.de/osm/service?');
  l.Params.Layers := 'OSM-WMS';
  l.Source := lsWMS;  
  TMSFNCLeaflet1.EndUpdate;
end;


Note: These code samples are based on TTMSFNCLeaflet. The same code can be used for TTMSFNCOpenLayers.


Overview

There are so many tileserver services out there, it would be impossible to list them all here. Below is a small overview of some of the available tileserver services. Follow the links to the services for detailed information. *

Some services provide worldwide maps in multiple styles and optional extra layers. Some services only provide tiles and/or layers for a specific geographic location. Some services are free to use, others offer a paid subscription. Some services require an API key. Some services provide map tiles with labels in English, others provide labels in the regional language of the geographic location on the map. 


OpenStreetMap

The default tileserver for both Leaflet and OpenLayers. This map is visible automatically, no code changes are necessary.

https://www.openstreetmap.org/

TMS Software Delphi  Components

Type:
XYZ

Authentication:
N/A

Attribution:
 © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>

URL example:
https://a.tile.opentopomap.org/{z}/{x}/{y}.png

Locale:
Regional

Pricing:
Free


Stadia Maps

Different map types & layers available.

https://stadiamaps.com/

TMS Software Delphi  Components

Type:
XYZ

Authentication:
API key

Attribution:
© <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a> © <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> © <a href="https://www.openstreetmap.org/about" target="_blank">OpenStreetMap</a> contributors

URL example:
https://tiles.stadiamaps.com/tiles/outdoors/{z}/{x}/{y}.png?api_key=(apikey)

(replace "(apikey)" with your own API key)

Locale:

Regional + English

Pricing: 

  • Free for non-commercial use. Limited # of requests
  • Different price tiers for commercial use


OpenTopoMap

OpenTopoMap is a free topographic map generated from OpenStreetMap and SRTM elevation data.

https://www.opentopomap.org

TMS Software Delphi  Components

Type:
XYZ

Authentication:
N/A

Attribution:
Kartendaten: © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: © <a href="http://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)

URL example:
https://a.tile.opentopomap.org/{z}/{x}/{y}.png

Locale:
Regional

Pricing:
Free


ThunderForest

Different map types available.

https://www.thunderforest.com/

TMS Software Delphi  Components

Type:
XYZ

Authentication:
API key

Attribution:
Maps © <a href="https://www.thunderforest.com">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>

URL example:
https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=(apikey)

(replace "(apikey)" with your own API key)

Locale:
Regional + English

Pricing:
Different price tiers, including a free tier. Limited # of requests.


ArcGis Online

Different map types & layers available.

https://www.arcgis.com/

TMS Software Delphi  Components

Type:
XYZ

Authentication:
N/A

Attribution:
© ArcGIS

URL example:
http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}

Locale:
English

Pricing:
Contact ArcGis Online


Terrestris

Open source. Different map types & layers available.

https://www.terrestris.de/en/

TMS Software Delphi  Components

Type:
WMS

Authentication:
N/A

Attribution:
Maps © <a href="https://www.terrestris.de/">Terrestris</a>, Data © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>

URL example:
https://ows.terrestris.de/osm/service?

Layer name example:
OSM-WMS

Locale:
Regional (+ country names in English)

Pricing:
Free


* Prices, features and service availability are subject to change


Available Now

The TMS FNC Maps is available now for Delphi & Visual Studio Code (with TMS WEB Core). You can download the latest version and start using all these features right away!



Bart Holvoet


Bookmarks: 

Related blog posts



This blog post has not received any comments yet.



Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post