Map api review / an alternative to Google Maps

Since june last year Google Maps has changed its pricing policy. Maps are used in MailPress at three different places (may be 4 !), depending on which addons you are using. It was then important for MailPress to switch to other alternatives.
The first alternative i found was Mapbox gl js. But i wanted to integrate OpenStreetMap and found Leaflet, “an open-source JavaScript library for mobile-friendly interactive maps”. So i started to convert javascript code from google map to mapbox and leaflet (Jan & Feb 2019).
It was fast and easy. So let’s find others, just for fun … here and bing.

A map api should provide (for mailpress needs) :

  • a javascript api with
    • interactive map (ability to pan and/or zoom the map)
    • different map types (google set the basic standard with roadmap, satellite, hybrid and terrain types)
    • one or more markers (and of course draggable ones)
    • marker clustering (with thousands of markers, the map gets full of marker icons, so marker clustering provides a better readability by grouping markers in small colored circles with a number tallying them – and maybe with some zoom and … spiderfying … effects)
    • customizable controls (you know those +/- icons to zoom in or zoom out on the map)
    • geocoding (computational process of transforming a physical address description to a location [latitude/longitude])
    • reversegeocoding (exactly the opposite : process of transforming geographic coordinates [latitude/longitude] to a description of a location)
  • and a REST api with
    • static map (a static image)
    • geocoding (because sometimes you need it on batch mode)
    • reversegeocoding (batch mode)

While i was coding and making my code as similar as possible between api’s to minimize bugs and ease future maintenance, i set up some tests cases, to make sure that my js and php coding was working for each map provider with their corresponding api.
Here is the “workbench“, using the same code as in MailPress plugin (+ some external set up code). It allowed me to test the following cases :

  • some markers on the map, customized controls (change map type, center and marker info box)
  • marker clustering (zooming in/out using the mouse scroll button, clicking on markers)
  • two maps (draggable marker, geocoding and reverse geocoding)
  • one map with access to the REST api (via ajax)

If you are using that “workbench”, for the last two cases, before displaying the map, your ip adress is geolocalized. The map(s) should be centered at that location.

In alphabetical order :

Bing (2005) :

  • requires an api key
  • documentation is ok. Loading the microsoft bing js library requires a callback (first time i see that)
  • no satellite or terrain map styles
  • marker clustering works like google does (have to zoom to get markers [pushpins] info)
  • customizable controls: ok
  • geocoding and reverse geocoding: ok
  • REST api: ok

Google (2004) :

  • requires an api key
  • not accessible anymore due to the new pricing policy !
  • strange thing is that sometimes it works for one click and then you get that kind of message in the background …
    from “don’t be evil” to “greed is good” …

Here (2015) ex-Navteq (1985) :

  • requires an api key
  • documentation is good. However i detected at least one error (H.ui.base.Button is supposed to create a button html element but creates a div)
  • map styles: ok
  • marker clustering looks to me basic, not possible to access markers info
  • customizable controls: ok
  • geocoding and reverse geocoding: ok
  • REST api: ok

OpenStreetMap (OSM 2004) & Leaflet (2011) :

  • leaflet documentation and openstreetmap wiki are (very) good.
  • map styles (too much choice ?)
  • marker clustering is the best i have seen and i particularly like this “spiderfying” effect !
    Open source is the future …
  • customizable controls: ok
  • geocoding and reverse geocoding not available within leaflet libray (apparently some plugins exist, but i am using the REST api via ajax – see hereunder)
  • REST api : osm do not provide a REST api, however it is possible to use other services for static map (staticMapLite [only roadmap style/could be discontinued anytime]) and geocoding services (nominatim [maybe too verbose for me])

Mapbox (2010) :

  • requires an api key
  • documentation is good.
  • map styles: ok
  • marker clustering is too complicated to set up, i used this sample. There should be a specific libray called “supercluster” but could not find any “super something” ! Not possible to access markers info
  • customizable controls: ok (introducing EcmaScript6 class)
  • geocoding and reverse geocoding: ok [MapboxGeocoder]. Too few documentation (had to dig in the code). Requires to be set up as a map control otherwise it crashes, but there are some workarounds …
  • REST api: ok

Really surprised by the quality and services provided through OSM & Leaflet.
Mapbox is also based on Leaflet & OSM and used by Foursquare, Lonely Planet, Facebook, the Financial Times, The Weather Channel and Snapchat (source Wikipedia).
‘Here’ is part of the automotive industry now, so i believe their geocoding process is the most accurate one.
Apparently Bing is using the same algorithms, because results are very similar.
Google is the only one to provide services such as Street View.

This entry was posted in News. Bookmark the permalink.