Leaflet / OpenStreetMaps with incorrect location

Home Forums MapPress Support Leaflet / OpenStreetMaps with incorrect location

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #18300

    I am having an issue with map pins being placed incorrectly. Same town, but varying distances away from the actual location. And, ironically, if I place the exact same address into the OpenStreetMaps website, that is showing in the correct spot. So it doesn’t seem to be OpenStreetMaps, but something down the chain in Leaflet, MapPress or one of the other technologies.

    For instance:

    383 Woodbury Ave, Portsmouth, NH 03801

    My Map (dynamically generated using PHP):


    Other times the map is in the middle of the ocean. Sometimes this fixes itself on a refresh, sometimes not.



    MapPress doesn’t do any geocoding itself – it uses either Algolia Places or Google geocoders, based on which ‘engine’ you select in the settings.

    Algolia is only accurate to the street level – not to individual street numbers.  I think that’s why the marker is in the wrong place for 383 Woodbury Ave.

    For the next version of MapPress I’ll add the MapBox and OSM geocoders, which seem to be more accurate than Algolia.  I’ll also include a MapPress setting to allow you select which geocoder to use.

    If you use the contact form to email me, I’ll send you a preview version to test as soon as it’s ready – later this week.

    Until then, you could also switch to Google instead of Leaflet in the MapPress settings.  Google has the best geocoder, but it requires an API key and has usage limits.



    Thank you so much for the helpful response. The Google Maps API charges are daunting as we have a high traffic site. I didn’t know that Agolia lacked the same specificity. Do you think it would help if I pass the business name in before the street address? I’ll probably test it just to see.

    Is OSM also a free geocoder? I would love to test that. I’ll send you a message.


    It’s worth a try adding the business name.  OSM is also free (their geocoder is called ‘Nominatim’).  I think Algolia was built on an OSM data extract several years ago, maybe it hasn’t been updated?

    MapBox also worked for me when I tried the sample address.  There are other geocoders that are paid but have generous free usage limits.  I haven’t tried them myself, but here’s a couple if you want to have a look:







    I’ve just published version 2.53, which includes an option on the MapPress setting screen to select the geocoder you’d like to use.

    Algolia is built on OpenStreetMap data, but it turns out it doesn’t do street number geocoding, even if it’s available on OSM.  In other words, it will just show the middle of the nearest street, even if OSM has more specific data.  That’s why the address “383 Woodbury Ave, Portsmouth, NH 03801” works on OSM but not in Algolia.

    OSM itself seems to have spotty street-level data.  It worked for some areas I tried, but not others.  You can use the OSM geocoder called Nominatim by selecting it on the settings screen.

    I’ve also added a MapBox option.  Their geocoder seems to be more accurate.

    Be sure to read the geocoders terms of use for usage limits and other restrictions – there are links to them in the MapPress documentation.

    I tried many other geocoders, but most are based on OSM, and thus are no better than Nominatim.  There is one called geocod.io, which looks useful.  They are free and seem to be accurate, but only cover the USA.

    I didn’t implement geocod.io yet because I wasn’t sure anyone needs it.  But if you, or anyone else, would like to have geocod.io (or any other geocoder), added to MapPress, please let me know.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.