Skip to content
Make with

Coming from Google Maps

Moving from Google Maps Platform to MapLibre means separating the map renderer from your tile, search, and routing providers. Here is what changes in code, what options exist for each Google Maps service, how features compare, and the terms to know.

Web: what changes in your code

From the Google Maps JavaScript API to MapLibre GL JS 6, the version this site runs. The biggest mental shifts are [lng, lat] array order and splitting GeoJSON data from style layers.

  1. 01Loading and initializing a map

    Google Maps loads from Google's servers with an API key via importLibrary, while MapLibre GL JS v6 is an ES module package with no API key of its own. With a bundler, call setWorkerUrl once before the first map, import maplibre-gl.css, and point style at a tile provider or your own host.

    Google Maps JS API

    const { Map } = await google.maps.importLibrary('maps');
    
    const map = new Map(document.getElementById('map'), {
      center: { lat: 48.8566, lng: 2.3522 },
      zoom: 12,
      mapId: 'YOUR_MAP_ID'
    });

    MapLibre GL JS

    import { Map, setWorkerUrl } from 'maplibre-gl';
    import 'maplibre-gl/dist/maplibre-gl.css';
    import workerUrl from 'maplibre-gl/dist/maplibre-gl-worker.mjs?worker&url';
    
    setWorkerUrl(workerUrl);
    
    const map = new Map({
      container: 'map',
      style: 'https://tiles.openfreemap.org/styles/liberty',
      center: [2.3522, 48.8566],
      zoom: 12
    });
  2. 02Coordinate order: { lat, lng } vs [lng, lat]

    Google Maps puts latitude before longitude in LatLng and { lat, lng } literals. MapLibre GL JS arrays use [lng, lat] to match GeoJSON, so swapping them places points in the wrong hemisphere; passing { lng, lat } objects avoids ordering mistakes during a migration.

    Google Maps JS API

    // Google Maps puts latitude first
    const paris = { lat: 48.8566, lng: 2.3522 };
    // or: new google.maps.LatLng(48.8566, 2.3522)
    
    map.setCenter(paris);

    MapLibre GL JS

    // MapLibre arrays follow GeoJSON order: [longitude, latitude]
    const paris = [2.3522, 48.8566];
    // Object form also works: { lng: 2.3522, lat: 48.8566 }
    
    map.setCenter(paris);
  3. 03Markers

    Google deprecated google.maps.Marker in February 2024 (v3.56) in favor of AdvancedMarkerElement, which requires a mapId. MapLibre's Marker needs no map ID and accepts a custom DOM element via new Marker({ element }). For hundreds or thousands of points, use a GeoJSON source with a symbol or circle layer so the GPU renders them.

    Google Maps JS API

    const { AdvancedMarkerElement } = await google.maps.importLibrary('marker');
    
    const marker = new AdvancedMarkerElement({
      map,
      position: { lat: 48.8566, lng: 2.3522 },
      title: 'Paris'
    });

    MapLibre GL JS

    import { Marker } from 'maplibre-gl';
    
    const marker = new Marker()
      .setLngLat([2.3522, 48.8566])
      .addTo(map);
  4. 04Info windows and popups

    Popup replaces InfoWindow. Attaching one with marker.setPopup(popup) wires click toggling automatically; standalone popups open anywhere with new Popup().setLngLat([lng, lat]).setText(...).addTo(map).

    Google Maps JS API

    const { InfoWindow } = await google.maps.importLibrary('maps');
    
    const infoWindow = new InfoWindow({
      content: '<h3>Paris</h3><p>Capital of France</p>'
    });
    
    marker.addListener('gmp-click', () => {
      infoWindow.open({ anchor: marker, map });
    });

    MapLibre GL JS

    import { Marker, Popup } from 'maplibre-gl';
    
    const popup = new Popup({ offset: 25 })
      .setHTML('<h3>Paris</h3><p>Capital of France</p>');
    
    new Marker()
      .setLngLat([2.3522, 48.8566])
      .setPopup(popup)
      .addTo(map);
  5. 05Loading GeoJSON

    Google Maps attaches GeoJSON directly to map.data. MapLibre separates data (addSource) from styling (addLayer) and waits for the style to load first. Multiple fill, line, and circle layers can share one source, and borders thicker than 1 px use a companion line layer.

    Google Maps JS API

    map.data.loadGeoJson('https://example.com/zones.geojson');
    
    map.data.setStyle({
      fillColor: '#2563eb',
      fillOpacity: 0.35,
      strokeColor: '#1d4ed8',
      strokeWeight: 2
    });

    MapLibre GL JS

    map.on('load', () => {
      map.addSource('zones', {
        type: 'geojson',
        data: 'https://example.com/zones.geojson'
      });
    
      map.addLayer({
        id: 'zones-fill',
        type: 'fill',
        source: 'zones',
        paint: {
          'fill-color': '#2563eb',
          'fill-opacity': 0.35,
          'fill-outline-color': '#1d4ed8'
        }
      });
    });
  6. 06Click and hover events

    Replace addListener with map.on (and map.off to detach). Passing a layer ID scopes click and hover listeners to rendered features in that layer, returning plain properties objects in e.features.

    Google Maps JS API

    map.addListener('click', (e) => {
      console.log(e.latLng.lat(), e.latLng.lng());
    });
    
    map.data.addListener('click', (e) => {
      console.log(e.feature.getProperty('name'));
    });

    MapLibre GL JS

    map.on('click', (e) => {
      console.log(e.lngLat.lat, e.lngLat.lng);
    });
    
    map.on('click', 'zones-fill', (e) => {
      console.log(e.features?.[0]?.properties.name);
    });
    
    map.on('mouseenter', 'zones-fill', () => {
      map.getCanvas().style.cursor = 'pointer';
    });
  7. 07Camera and bounds

    flyTo and easeTo animate center, zoom, pitch, and bearing in one call, while jumpTo moves immediately. fitBounds takes [[west, south], [east, north]] and an options object with padding.

    Google Maps JS API

    map.panTo({ lat: 48.8566, lng: 2.3522 });
    map.setZoom(13);
    
    const bounds = new google.maps.LatLngBounds(
      { lat: 48.815, lng: 2.224 },
      { lat: 48.902, lng: 2.469 }
    );
    map.fitBounds(bounds, 40);

    MapLibre GL JS

    map.flyTo({ center: [2.3522, 48.8566], zoom: 13 });
    
    map.fitBounds(
      [
        [2.224, 48.815],
        [2.469, 48.902]
      ],
      { padding: 40 }
    );
  8. 08Styling the map

    Google's vector map styling lives in the Google Cloud Console behind a mapId (inline styles JSON arrays apply to legacy raster maps). MapLibre loads open JSON documents following the MapLibre Style Specification that you can version in Git, edit in Maputnik, and update live with setPaintProperty.

    Google Maps JS API

    // Cloud-based Map Styling: configured in Google Cloud Console
    const map = new google.maps.Map(document.getElementById('map'), {
      center: { lat: 48.8566, lng: 2.3522 },
      zoom: 12,
      mapId: 'YOUR_MAP_ID'
    });

    MapLibre GL JS

    // Open MapLibre Style Spec JSON (URL or inline object)
    const map = new Map({
      container: 'map',
      style: 'https://tiles.openfreemap.org/styles/liberty',
      center: [2.3522, 48.8566],
      zoom: 12
    });
    
    map.on('load', () => {
      map.setPaintProperty('water', 'fill-color', '#a5d8ff');
    });
  9. 093D camera tilt and rotation

    Google Maps names camera tilt and rotation tilt and heading and enables them on vector maps configured with a mapId (or Map3DElement). MapLibre names them pitch and bearing, available on every map by default without server-side setup.

    Google Maps JS API

    // Requires a vector mapId configured for tilt and rotation
    const map = new google.maps.Map(document.getElementById('map'), {
      center: { lat: 48.8566, lng: 2.3522 },
      zoom: 16,
      tilt: 45,
      heading: 30,
      mapId: 'YOUR_VECTOR_MAP_ID'
    });

    MapLibre GL JS

    const map = new Map({
      container: 'map',
      style: 'https://tiles.openfreemap.org/styles/liberty',
      center: [2.3522, 48.8566],
      zoom: 16,
      pitch: 45,
      bearing: 30
    });

Mobile apps

MapLibre Native renders vector tiles on iOS (Metal) and Android (Vulkan or OpenGL ES) using the same style format as the web, without Google Play Services or a Google API key.

iOS

Replace the GoogleMaps SDK (GMSServices.provideAPIKey and GMSMapView) with the MapLibre Swift package (from github.com/maplibre/maplibre-gl-native-distribution) or CocoaPod and import MapLibre. Use MLNMapView with a styleURL (no API key is required by the SDK itself), wrapped in UIViewRepresentable for SwiftUI; MapLibre Native for iOS renders with Metal since v6.0.0.

Android

Replace com.google.android.gms:play-services-maps (SupportMapFragment, GoogleMap, and the com.google.android.geo.API_KEY manifest entry) with org.maplibre.gl:android-sdk. Call MapLibre.getInstance(context) before inflating MapView, pass a style URL via setStyle, and use Vulkan by default since v13.0.0 (OpenGL ES remains available via android-sdk-opengl). Teams using Maps Compose can also look at MapLibre Compose.

React Native

react-native-maps wraps Google Maps on Android and Apple Maps or PROVIDER_GOOGLE on iOS, requiring Google API keys and billing for Google layers. @maplibre/maplibre-react-native renders with MapLibre Native on both platforms without a Google key: replace MapView with Map (passing mapStyle) and Camera (v11 requires React Native New Architecture).

Flutter

Replace google_maps_flutter (GoogleMap and GoogleMapController, which require enabling Maps SDK for Android, iOS, and Web with API keys) with the official maplibre_gl package (MapLibreMap and MapLibreMapController), passing a styleString URL and CameraPosition. On the web, maplibre_gl 0.27+ loads MapLibre GL JS v6 automatically.

All MapLibre SDKs, with install snippets, are on SDKs.

Google Maps Platform services, and options with MapLibre

Google bundles tiles, search, routing, and street imagery under one billing account. With MapLibre, you pick open-source or hosted options for each piece separately.

Dynamic Maps (Maps JavaScript API and Mobile SDKs)

Load vector basemaps from free keyless providers such as OpenFreeMap or VersaTiles, commercial MapLibre-compatible tile hosts listed on Basemaps, or self-hosted PMTiles archives on static cloud storage.

BasemapsLiberty (OpenFreeMap)Colorful (VersaTiles)PMTiles

Satellite and aerial imagery

Commercial providers on Basemaps offer satellite and hybrid styles, and EOxCloudless serves open cloud-free Sentinel-2 imagery as raster tiles. High-resolution sub-meter aerial imagery requires a commercial provider or national open-data layers (see Open data).

BasemapsEOxCloudless 2025 (EOX)Open data

Elevation API and 3D terrain

Mapterhorn and AWS Terrain Tiles serve open Terrarium-encoded elevation tiles that MapLibre reads directly as a raster-dem source for 3D terrain and hillshading, and maplibre-contour draws vector contour lines from the same tiles.

Mapterhorn Terrain (Mapterhorn)Terrarium Elevation (AWS Open Data)maplibre-contour

Places API and Geocoding API

The Geocoding page compares hosted geocoding APIs and self-hostable engines (Nominatim, Photon, Pelias), and MapLibre GL Geocoder puts a search box on the map for any of them. OpenStreetMap and Overture Maps Places provide open POI data without consumer business reviews.

Google's terms forbid showing Geocoding API or Places API results on a non-Google map, except through Places UI Kit (Service Specific Terms section 16.1).

Geocodingmaplibre-gl-geocoderNominatimPhotonPeliasOpen data

Routes API (Directions and Route Matrix)

Open-source engines (OSRM, Valhalla, GraphHopper, openrouteservice) and hosted routing APIs are compared on Routing. MapLibre GL Directions draws routes on web maps, and Ferrostar provides turn-by-turn navigation on mobile and web.

Google's Service Specific Terms (section 20.2) prohibit using Routes API content in conjunction with a non-Google map.

RoutingMapLibre GL DirectionsOSRMValhallaGraphHopperopenrouteserviceFerrostar

Maps Static API

TileServer GL and chiitiler render static PNG or WebP map images server-side from any MapLibre style, and the MapLibre Native Node.js bindings render static images directly in Node code.

TileServer GLchiitilerMapLibre GL Native Node.js

Street View (Dynamic and Static)

MapLibre has no built-in street-level imagery. Open alternatives include Panoramax (integrated via maplibre-gl-panoramax) and Mapillary, though coverage is crowdsourced and narrower than Google Street View in many regions.

Google's Terms (section 3.2.3(e)) prohibit displaying Street View imagery and a non-Google map on the same screen.

maplibre-gl-panoramax

Cloud-based Map Styling

Maputnik is MapLibre's free, open-source visual style editor for MapLibre Style Spec JSON files, and hosted style editors from tile providers are listed on Styling.

Styling toolsMaputnik

How the features compare

Neither is a drop-in superset of the other: Google Maps bundles Street View and global business reviews, while MapLibre gives you open-source rendering, full style control, blend modes, and self-hosted or offline tiles.

Features of Google Maps Platform and MapLibre GL JS v6 compared
FeatureWhereDetails
Globe viewIn both, differentlyMapLibre GL JS (since v5.0.0) renders any vector or raster style as a 3D globe via setProjection({ type: 'globe' }), blending into Mercator between zoom 10 and 12. Google Maps JS API renders a photorealistic 3D globe through its separate maps3d library (Map3DElement), while standard 2D google.maps.Map uses Web Mercator.
Custom projectionsIn both, differentlyGoogle Maps JS API supports custom planar projections through its Projection interface on custom map types. MapLibre GL JS (since v6.15, experimental) draws any planar coordinate system registered with addProjection (such as proj4 definitions) from tiles made in that CRS and client-side GeoJSON reprojection.
3D terrainIn both, differentlyMapLibre GL JS (since v2.2.0) drapes any style over a raster-dem elevation source (such as Mapterhorn or AWS Terrarium) with setTerrain. Google Maps offers shaded 2D terrain map types on standard maps and photorealistic 3D terrain and city meshes in maps3d (Map3DElement), backed by Google's own elevation and aerial data.
Vector map stylingIn both, differentlyGoogle Maps styles vector maps through Cloud-based Map Styling in the Google Cloud Console (linked via mapId), adjusting visibility and colors across Google's built-in feature hierarchy. MapLibre uses the open JSON MapLibre Style Specification with arbitrary vector sources, data-driven expressions, custom fonts and sprites, and editing in Maputnik.
Layer blend modesMapLibre onlyMapLibre GL JS 6.18.0 and 6.20.0 provide declarative fill-layer-blend, line-layer-blend, and raster-layer-blend properties across all 16 CSS mix-blend-mode formulas plus plus-lighter. Google Maps JS API has no declarative layer blend mode properties (custom GPU blending requires writing a WebGLOverlayView).
Street ViewGoogle Maps onlyGoogle Maps Platform includes global Street View panoramas directly inside the Maps JavaScript API and mobile SDKs. MapLibre has no built-in street-level imagery; open options such as Panoramax (via maplibre-gl-panoramax) or Mapillary can be added separately, with narrower geographic coverage.
POI and business reviewsGoogle Maps onlyGoogle Maps Platform provides Google's global Places database, including opening hours, user photos, ratings, and reviews (and allows embedding Places UI Kit alongside non-Google maps). MapLibre is a renderer only; open datasets such as OpenStreetMap and Overture Maps Places provide POI locations and categories without consumer reviews.
Offline and self-hosted tilesMapLibre onlyMapLibre loads tiles from any tile server (such as Martin) or directly from a self-hosted PMTiles archive on static storage, and MapLibre Native supports downloading offline map packs in mobile apps. Google serves tiles exclusively from Google's servers, and its Terms prohibit storing, rehosting, or caching tiles outside the Services.
Open source and licenseIn both, differentlyMapLibre GL JS (BSD-3-Clause) and MapLibre Native (BSD-2-Clause) are open source, governed by the MapLibre Organization, and need no account or API key. Google Maps Platform SDKs are proprietary and licensed under the Google Maps Platform Terms of Service.

From Google Maps Platform and MapLibre docs, checked November 2026. Both evolve quickly, so check their docs for the latest.

Terms to know

If you migrate one piece at a time while keeping other Google Maps Platform APIs, check these rules from Google's own terms first. Terms change, so read the current documents before shipping.

  • Production use requires a billing-enabled Google Cloud project and API key (a Maps Demo Key covers prototyping without billing). Since March 1, 2025, Google replaced the flat USD $200 monthly credit with per-SKU monthly free caps: 10,000 calls for Essentials SKUs (100,000 for Map Tiles API Essentials), 5,000 for Pro, and 1,000 for Enterprise.

    To help you identify, evaluate, and test our Services, Google has replaced the USD $200 monthly recurring credit with a free monthly usage threshold for each Core Services SKU.
    Source ↗
  • Section 3.2.3(e) of the Google Maps Platform Terms of Service prohibits using Google Maps Core Services with or near a non-Google map, including showing Places content on a MapLibre map or putting Street View on the same screen.

    To avoid quality issues and/or brand confusion, Customer will not use the Google Maps Core Services with or near a non-Google Map in a Customer Application. For example, Customer will not (i) display or use Places content on a non-Google Map, (ii) display Street View imagery and non-Google Maps on the same screen, or (iii) link a Google Map to non-Google Maps Content or a non-Google Map.
    Source ↗
  • The Service Specific Terms confirm that Geocoding API (section 6.2), Places API (section 15.2), and Routes API (section 20.2) content cannot be used with a non-Google map. Places UI Kit (section 16.1) is an explicit exception that may be used alongside a non-Google map.

    Customer may use Places UI Kit in Customer Applications with or without any map, including a non-Google Map. This clause will prevail over the No Use with Non-Google Maps clause of the Agreement.
    Source ↗
  • Section 3.2.3(a) of the Terms of Service prohibits exporting, bulk downloading, storing, or rehosting Google Maps tiles, geocodes, directions, places, or elevation data outside Google's services.

    Customer will not export, extract, or otherwise scrape Google Maps Content for use outside the Services. For example, Customer will not: (i) pre-fetch, index, store, reshare, or rehost Google Maps Content outside the services; (ii) bulk download Google Maps tiles, Street View images, geocodes, directions, distance matrix results, roads information, places information, elevation values, and time zone details; (iii) copy and save business names, addresses, or user reviews; or (iv) use Google Maps Content with text-to-speech services.
    Source ↗
  • Section 3.2.3(b) bars caching except where the Service Specific Terms expressly allow it, such as caching place_id or pano_ID values (section 3) and caching lat/lng values from Geocoding, Places, or Routes for up to 30 consecutive calendar days (sections 6.3.1, 15.3, 20.3).

    Customer will not cache Google Maps Content except as expressly permitted under the Maps Service Specific Terms.
    Source ↗
  • Section 3.2.2(b) requires keeping all Google branding, logos, and copyright notices visible and unmodified whenever Google services are used.

    Customer will display all attribution that (i) Google provides through the Services (including branding, logos, and copyright and trademark notices); or (ii) is specified in the Maps Service Specific Terms. Customer will not modify, obscure, or delete such attribution.
    Source ↗

Ready to try it?

Put a MapLibre map on screen in a few lines, compare free basemaps side by side, or read Coming from Mapbox and Coming from Leaflet. Need hands-on migration help? See MapLibre consultants.

Sources (checked November 2026)