Blog
All Blog Posts | Next Post | Previous PostDiscover open source maps in Delphi with Leaflet
Tuesday, August 8, 2023
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 Maps, Microsoft Bing Maps, MapBox, 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.
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
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}');
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;
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
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.
Bart Holvoet
This blog post has received 3 comments.
The link of Leaflet website seems incorrect.
It is : https://leafletjs.com/
Olivier Dehorter
Bruno Fierens
All Blog Posts | Next Post | Previous Post
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