Google Maps Library is an open source (MPL-2.0 license) cross-platform Delphi/Lazarus wrapper for the Google Maps JavaScript API.
The current codebase includes:
- a working Google backend (
TGMMap) forVCL,FMX, andLCL - a provider-neutral core (
uMapLib.Core.*) - provider-separated source layout (
Common/Vcl/Fmx/Lclsplit intoGMandOSM) - design-time packages and demos
- an
OSMLibpilot backend (MapLibre + OSM) with working map/events and first marker slice
GMLib was developed and tested on Delphi 11, 12 and 13, and Lazarus 4.6.
GMLib demos have been tested in Windows 10 and Windows 11.
For more information about CEF4Delphi see their repo.
Google Maps imposes several requirements for normal map usage:
- You need an
API Keyto show a map without a watermark. - You need a
Map IDfor several components, such asAdvancedMarkerElement. - The Google bootstrap now exposes an
ApiChannelproperty so the component can load the JavaScript API through an explicit channel (Weekly,Quarterly,Beta,Alpha) instead of relying on the default loader policy.
For more information and to create your API Key and Map ID, visit the Google Cloud Console.
You can put these credentials directly into the component or into environment variables called GOOGLE_MAPS_API_KEY and GOOGLE_MAPS_MAP_ID respectively.
This is a Google Maps platform restriction, not a GMLib one.
OSMLib does not require a Google-style API key to show a map.
Its current runtime is based on MapLibre GL JS and an OSM-compatible style /
tiles setup. Depending on the provider you choose, you may still need:
- a valid
Style URL - a valid vector tile template in
RemoteTileTemplate - a provider API key if that provider requires one
For offline or hybrid runtime validation, the current codebase can now resolve the base runtime assets from embedded resources when the explicit properties are left blank:
maplibre-gl.cssmaplibre-gl.jsresources/js/osm/offline/style.template.json
These are runtime/provider requirements of the current OSMLib implementation,
not a Google-style platform restriction.
Bootstrap HTML/JS assets for both GMLib and OSMLib are expected to be
consumed from embedded resources extracted by the runtime. The
MAP_BOOTSTRAP_FROM_FILES switch in gmlib.inc is a development-only
override and should stay disabled for normal packaging, especially on
Android/iOS.
The following Google Maps API classes are currently implemented:
- google.maps.Map and associated classes to display a map.
- Basic layers grouped under
TGMMap.Layers- google.maps.TrafficLayer
- google.maps.TransitLayer
- google.maps.BicyclingLayer
- google.maps.KmlLayer (
deprecatedby Google onApril 30, 2026; kept in GMLib as compatibility surface)
- google.maps.marker.AdvancedMarkerElement and associated classes to display a marker.
- google.maps.InfoWindow and associated classes to display an info window.
- google.maps.Polyline and associated classes to display a polyline.
- google.maps.Polygon and associated classes to display a polygon.
- google.maps.Rectangle and associated classes to display a rectangle.
- google.maps.Circle and associated classes to display a circle.
- google.maps.GroundOverlay and associated classes to display a GroundOverlay.
- google.maps.Geocoder and associated classes to convert an address to a
LatLngand vice versa. - google.maps.ElevationService and associated classes for requesting elevation data.
- google.maps.routes.Route and associated classes for route requests.
Google marker policy in this repo is intentionally explicit:
GMLibkeepsAdvancedMarkerElementas the marker surface for Google Maps.google.maps.Markeris not the target path for new work or regressions.
Google routes policy in this repo is also explicit:
GMLibuses the moderngoogle.maps.routes.Routelibrary.- legacy
DirectionsServiceshould not be reintroduced as the primary route API.
The following OSM / MapLibre runtime surface is currently implemented:
- MapLibre GL JS
Mapand associated map lifecycle/bootstrap flow inVCL,FMX, andLCL. - Overlay slice:
OSM runtime policy in this repo is intentionally explicit:
- the validated
MapLibre GL JSbaseline is currentlyv5.6.2 GetDocumentationUrlstill points to the live MapLibre docs, so those pages should be treated as the upstream reference, not as a version-pinned contract for the exact vendored runtimeOSMLibis not just a thin alias for upstreamMapLibre: part of the public surface is nativeMapLibre, and part is project-owned contract layered on top of it
MapLibCoreis already extracted and used by runtime packages.GMLib(Google provider) is functional and organized under provider folders.OSMLib(pilot provider) currently includes:- map activation/bootstrap + map event flow in
VCL,FMX, andLCL - style switching + fit bounds + center/zoom/bearing/pitch sync
- map restrictions/options:
min/max zoommin/max pitchmax boundsrenderWorldCopies
- marker collection with per-item events (
OnClick,OnDblClick,OnMouseEnter,OnMouseLeave,OnMouseDown,OnMouseUp,OnDragStart,OnDrag,OnDragEnd) - marker kinds
Standard,Pin, andDotwith per-kind options classes - these marker families are
OSMLibcontract, not nativeMapLibre Pinvisual selectors now exposed as enums instead of free stringsPin.ShapeVariantis now treated as a closed visual contract:Default/Classic: rounded pin with tailPill: capsule body with tailTag: asymmetric tag-like body with tailBubble: rounded bubble without tail
AnchorX/Yare treated as fine visual offsets, not as a primary anchor API- legacy
PopupTextremains only as compatibility surface; active popup work should go throughTOSMMap.Popups - advanced shadow surface is treated as
Pin/Dot-specific;Standardkeeps only a lightweight compatibility toggle - interaction toggles (
DragPan,DragRotate,DoubleClickZoom,ScrollZoom,Keyboard,TouchZoomRotate,TouchPitch,CooperativeGestures) cooperativegesturepreventedrouted to Delphi/Lazarus- validated
VCLMegaDemo OSM marker/offline flow - design-time marker persistence restored after typed wrapper refactor
- click-to-add marker flow stabilized after creation/update notification fixes
- MegaDemo OSM marker editors now accept local or invariant decimal input for doubles
- first dedicated OSM
Popupslice added in core and JS runtime - popup presets and the anchor-loss close rule are
OSMLibcontract layered on top of nativeMapLibre Popup - validated OSM
Popupslice with:- free-position popup
- marker-anchored popup
OnOpen/OnCloseCloseOnMoveContentType(HTML/ plain text)- typed visual presets
- closed anchor-loss rule (popup closes if the anchor marker disappears)
- VCL MegaDemo includes an OSM
Popupstab with CRUD/testing UI - FMX MegaDemo includes an OSM
Popupstab with the same popup CRUD/testing surface - marker click in
VCL MegaDemoopens an anchored popup showing the current marker coordinates - marker click in
FMX MegaDemoalso opens an anchored popup showing the current marker coordinates and refreshes it afterdragend - popup creation lifecycle was hardened with the same batching approach used
for markers to avoid premature bridge sync during
Add Popup - the popup slice should now be treated as functionally closed at the current OSM validation level
- marker core/runtime surface is currently ahead of MegaDemo UI coverage; part of the newly added marker options still needs to be exposed in the demo
- current offline/hybrid runtime surface:
MapModeOfflinePolicyOfflineStoragePathRemoteTileTemplateStyleTemplateFileNameGlyphsRootPathMapLibreCssUrlMapLibreJsUrl
- native offline pieces already implemented in shared code:
OfflineRegionManager- embedded localhost runtime server
StyleProviderTileResolverVectorRuntimeSqliteTileStore
- embedded localhost serving and SQLite tile-cache persistence are now
aligned across
VCL,FMX, andLCL/FPC LCL/FPCWindows now also validates the activeOnline / Hybrid / OfflineOSM runtime path against the same embedded localhost + SQLite cache modelGMLibRuntime.Lclcompile path is back in sync with the current shared runtime layer
- map activation/bootstrap + map event flow in
- The current vector runtime expects a direct XYZ template in
RemoteTileTemplate. OpenFreeMapworks for runtime validation with:https://tiles.openfreemap.org/planet/latest/{z}/{x}/{y}.pbfMapTilerhas also been validated with:https://api.maptiler.com/tiles/v3/{z}/{x}/{y}.pbf?key=YOUR_API_KEY- Not every vector tileset is suitable as a full basemap. Example: thematic
sources such as
landformmay legitimately return sparse or empty tiles for many coordinates.
- VCL includes broad feature demos and the full-library
MegaDemo. - FMX includes runtime demos for the implemented Google slices, and the OSM
MegaDemois available as the active OSM validation surface too. demos/Fmx/OSMMobileMinimalnow acts as the minimal online validation demo forOSMLibonFMXmobile (Android/iOS), using the embedded bootstrap asset pipeline.demos/Fmx/OSMMobileMinimalnow also exposes a first explicitOnline/Hybrid/Offlinevalidation flow for mobile, relying on embedded MapLibre CSS/JS and persistent offline storage instead of repo-relative paths.- for
FMX Android, the embedded localhost runtime also requiresandroid:usesCleartextTraffic="true"in the app manifest so the WebView can consumehttp://127.0.0.1:...tile/style requests. - for FireDAC SQLite cache on
Android/iOS, the current runtime path should use static SQLite linkage (FireDAC.Phys.SQLiteWrapper.Stat/EngineLinkage=Static) instead of depending on a dynamiclibsqlite.soload. - mobile/offline storage paths should be composed with native path joins
(
.../GMLib/OSM), not by passingGMLib\OSMas a single literal segment. - current mobile glyph policy is intentionally pragmatic:
Offlineis treated as an emergency/fallback modeNoto Sans Regularis kept as the only embedded local glyph corpus for now- extra families/weights are deferred unless a concrete need appears
- OSM visual validation is currently centered on
demos/Vcl/MegaDemoanddemos/Fmx/MegaDemo, which are the reference baselines for online/offline/hybrid behavior and for the current camera/interaction surface. - LCL also exposes the OSM offline/hybrid surface, including the embedded localhost runtime path and SQLite tile-cache persistence in the shared layer.
demos/Lcl/MegaDemois now back as a valid WindowsLCL/FPCvalidation surface forOSMLib Online / Hybrid / Offline.
In Delphi:
- Open
GMLibGroup. - Compile
MapLibCore,GMLibRuntime,GMLibRuntime.VclandGMLibRuntime.FMX. - Compile and install design packages:
MapLibDesign.VclMapLibDesign.Fmx
- Put the corresponding path for each platform in the library path:
...\lib\$(ProductVersion)\$(Platform)\Delphi - Put the corresponding source paths in the library path.
In Lazarus:
- Use the package files under
dpk/as the canonical ones:dpk/GMLibRuntime.Lcl.lpkdpk/MapLibDesign.Lcl.lpk
- Compile/install in this order:
- Open and compile
GMLibRuntime.Lcl.lpk - Open and install
MapLibDesign.Lcl.lpk
- Open and compile
- If Lazarus generates
.lpkfiles undersrc/, treat them as local/temporary artifacts (do not version them). - If package links get out of sync, ensure Lazarus points to
dpk/*.lpk(notsrc/**copies).
- Architecture:
docs/ARCHITECTURE.md - CEF integration:
docs/CEF.md - Roadmap:
docs/ROADMAP.md - Multi-provider plan:
docs/MULTI_PROVIDER_PLAN.md - Shared core start:
docs/MAPLIB_CORE_START.md