Blog

All Blog Posts  |  Next Post  |  Previous Post

Discover open source maps in Delphi with Leaflet

Tuesday, August 8, 2023

TMS Software Delphi  Components

Start using the Leaflet open source mapping library in no time straight from the Delphi tool palette! 

Next to existing support for Google Maps, Here Maps, Apple MapKit, Microsoft Azure MapsMicrosoft Bing MapsMapBox, Openlayers and TomTom a new mapping service was added to TMS FNC Maps for Delphi. Leaflet is a widely used JavaScript library for interactive maps and certainly deserves to be included in our mapping solution! Using Leaflet is free, just drop the associated TMS FNC Maps component on the form. The map is immediately visible and ready to use. There is no API key required.

Integration

Leaflet is fully integrated in TMS FNC Maps and offers the same base functionality available for all other mapping services like displaying markers & polylines, interactive maps, event handling and much more.

TMS Software Delphi  Components


Unique Features

Tileservers

One of the unique features available for Leaflet is the ability to use custom tileservers. The default tileserver is OpenStreetMap but this can easily be changed to a different tileserver with a single line of code.

For example, just assign a different URL to switch from OpenStreetMap tiles to OpenTopoMap tiles (a topographic variant of OpenStreetmap).

TMSFNCLeaflet1.Options.TileServer := 'https://a.tile.opentopomap.org/{z}/{x}/{y}.png


TMS Software Delphi  Components TMS Software Delphi  Components


TileLayers

By adding one or more tilelayers it is possible to display additional data on top of the map.
In the example below a satellite view tileserver is displayed. By adding a tilelayer we can display both geographic labels and country boundaries as well.

TMSFNCLeaflet1.Options.TileServer := 'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}';
TMSFNCLeaflet1.AddTileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_And_Places/MapServer/tile/{z}/{y}/{x}');


TMS Software Delphi  Components TMS Software Delphi  Components


Offline Use

The Leaflet JavaScript library is portable and there is built-in functionality available to automatically generate the library locally just by changing a property value.

TMSFNCLeaflet1.LibraryLocation := llOffline;
For full offline use a local tileserver is required as well. The full explanation is available in this previous blog post: Offline maps in TMS FNC Maps for Delphi.


Available Now

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


Getting started with TMS FNC Maps?

You're not on your own. Other than our online documentation and numerous samples, there is also a book dedicated to TMS FNC Maps for you written by our colleague Dr. Holger Flick

TMS Software Delphi  Components


Ready?

For a limited time, we're offering an exclusive 20% discount on TMS FNC Component Studio with the action code SUMMER23. Don't miss this opportunity to streamline your application development and enhance your user interfaces with our versatile components. But hurry, this offer is only valid until August 15, 2023!

Already a licensed user of a separate FNC product? We've got you covered too! Existing users looking to upgrade to the full TMS FNC Component Studio bundle can reach out to sales@tmssoftware.com to request a personalized best upgrade offer.

TMS Software Delphi  Components



Bart Holvoet




This blog post has received 3 comments.


1. Thursday, August 10, 2023 at 10:18:09 PM

Greetings,
Thank you for the interesting article and description of the open source mapping leaflet.
I believe that the URI-URI inserted in the text "leaflet is a widely used..." contains a link to .com domain for sale and not to the javascript library located at: https://leafletjs.com/

Please confirm is this is the case or not.
Thanks and keep writing this very helpful articles.

Kind regards,
Jaime



Jaime


2. Friday, August 18, 2023 at 7:35:01 AM

Hi
The link of Leaflet website seems incorrect.
It is : https://leafletjs.com/

Olivier Dehorter


3. Friday, August 18, 2023 at 8:27:08 AM

Thanks, link is fixed.

Bruno Fierens




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