Google Maps Platform drop-in replacement

The Geocoding, Places Autocomplete, Time Zone and Elevation web services all answer at the same paths on gapi.mygeocode.com, with the same JSON shape Google returns. Change the host, put your My Geocode key in the key parameter, and the rest of your code stays as it is.

Change one hostname

Original host
  • maps.googleapis.com
Use insteadgapi.mygeocode.com
Key parameterkey (optional: any address gets 2,500 requests a day with no key; put your My Geocode key here for credit, packages and a usage history)
Before
curl "https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_GOOGLE_KEY"
After
curl "https://gapi.mygeocode.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=YOUR_MYGEOCODE_KEY"

Why people move

Google requires a billing account and a key on every call, and bills per request across each SKU. Here a free key covers the first 2,500 calls a day, and the price after that is €0.0001 per request or a flat €50 a month.

Same free allowance, key or not. Requests to gapi.mygeocode.com count toward the same 2,500 free requests a day your address, or your key, gets on our own endpoints. Above that, prepaid credit at €0.0001 per request, or €50 a month for an Unlimited key. Signing up takes a name and an email address, and no card.

See pricing Get a free key

Endpoints

Path on gapi.mygeocode.comWhat it doesBacked by
/maps/api/geocode/json?address=...Forward geocodingForward geocoding
/maps/api/geocode/json?latlng=lat,lngReverse geocodingReverse geocoding
/maps/api/place/autocomplete/json?input=...Places AutocompleteAddress autocomplete
/maps/api/timezone/json?location=lat,lng&timestamp=...Time Zone APITimezone lookup
/maps/api/elevation/json?locations=lat,lng|lat,lngElevation APIElevation lookup

Example response

This is what the request above returns. Field names, nesting and types follow Google Maps. Only the data behind them is ours.

Response from gapi.mygeocode.com
{
  "results": [
    {
      "address_components": [
        {
          "long_name": "1600",
          "short_name": "1600",
          "types": ["street_number"]
        },
        {
          "long_name": "Amphitheatre Pkwy",
          "short_name": "Amphitheatre Pkwy",
          "types": ["route"]
        },
        {
          "long_name": "Mountain View",
          "short_name": "Mountain View",
          "types": ["locality", "political"]
        },
        {
          "long_name": "California",
          "short_name": "CA",
          "types": ["administrative_area_level_1", "political"]
        },
        {
          "long_name": "United States",
          "short_name": "US",
          "types": ["country", "political"]
        },
        {
          "long_name": "94043",
          "short_name": "94043",
          "types": ["postal_code"]
        }
      ],
      "formatted_address": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, United States",
      "geometry": {
        "location": {
          "lat": 37.4230649,
          "lng": -122.0835246
        },
        "location_type": "RANGE_INTERPOLATED",
        "viewport": {
          "northeast": {
            "lat": 37.4235677250937,
            "lng": -122.0830221992237
          },
          "southwest": {
            "lat": 37.4225690616641,
            "lng": -122.0840243607796
          }
        }
      },
      "place_id": "07arLXhL2m9G8QYbXmbCjQ2wz_s4cuLF1s3-o0s",
      "plus_code": {
        "compound_code": "CWF8+6H Mountain View, CA, United States",
        "global_code": "849VCWF8+6H"
      },
      "types": ["street_address"]
    }
  ],
  "status": "OK"
}

Details and differences

No key is needed for the first 2,500 requests a day. To use a My Geocode key, put it where your Google key went: the key query parameter, or the X-Goog-Api-Key header. The X-API-Key header, Authorization: Bearer and HTTP Basic authentication (the key as the user name) work on every host too, so client libraries that authenticate their own way keep working unchanged.

  • Error bodies match the API you called: the Time Zone API answers errorMessage with status, the others error_message, the empty result list, then status.
  • Time zone answers use ZERO_RESULTS over open water, as Google does, and honour language.
  • Elevation accepts locations, an enc: encoded polyline, and path with samples, up to 512 points as Google allows; each point counts as one request here.
  • Every endpoint also answers in XML: put xml where the path says json (/maps/api/geocode/xml, /maps/api/place/autocomplete/xml, /maps/api/timezone/xml, /maps/api/elevation/xml).
  • Geocoding results carry plus_code (global_code and compound_code), as Google’s do.

If your client depends on a field or behaviour that is not listed here, tell us. Compatibility gaps get fixed quickly because they are usually small.

Other drop-in hosts

How the drop-ins work, the overview, and the JavaScript library drop-ins.