How can I achieve Geocoding with the JavaScript OpenLayers API, in the same fashion as the Google Maps API?

closed as too broad by PolyGeo Jul 19 '16 at 4:27

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    What do you want to geocode? In what language? Do you have an example what you want to achieve....? Did you take a look at: dev.openlayers.org/releases/OpenLayers-2.10/doc/apidocs/files/… – stUrb May 7 '12 at 20:25
  • i need to get latitude, longitude from the given address, like google geocode... – Ramesh Kotha May 7 '12 at 20:37
  • 1
    You can still use the Google Geocoding API - if you stay under 2500 reqs per day, it's free to use. You'd have to tie it in with your web application somehow. Is your question really how to do that? If so, we need more context. What do you want to achieve? What do you already have? – mvexel May 9 '12 at 19:01
  • 2
    Also, there's alternatives that may be just as well suited to your needs: the MapQuest Open geocoder based on OpenStreetMap data, for example. developer.mapquest.com/web/products/open/nominatim – mvexel May 9 '12 at 19:02
  • Thanks @mvexel, i need to get latitude, longitude from given address for any country, i have done this with google maps api, but i need any free geocoding api, thats why i turned to OpenLayers, but geocoding is not possible with OpenLayers.. – Ramesh Kotha May 9 '12 at 19:16

Openlayers does not feature a Geocoding API. There are several questions here related to geocoding. Some of them specifically mention openlayers and geocoding (many do so with Google).

  • is there any alternative is there? i am using openlayers, so what would be the best possible way? – Ramesh Kotha May 8 '12 at 17:58

You can use Google Geocoder with OpenLayers, for an example see this post:

How to use Google Maps V3 Geocode with Openlayers

Disclaimer: as someone pointed out you might be in violation of their usage terms, but I'll leave that for you lawyer to figure out.


Possible way, Try to find any other free/commercial geocoder. Once you geocode the address, still you can you use your openlayer to overlay the lat.longs on the map tiles.

  • can u suggest any free geocoder. – Ramesh Kotha May 9 '12 at 14:43


"geocoder.us find the latitude & longitude of any US address - for free"

hope you are trying for US addresses...

  • thanks for your answer, but i am trying for whole world, is there any thing? – Ramesh Kotha May 9 '12 at 15:03

Using openlayers 3, you will have the opportunity to use a series of servers. OSM or photon as usual is of preference (I will personally go for this especially with a limited budget), though using the Mapquest or Google geocoder you will need a key. I will refer you to: https://github.com/jonataswalker/ol3-geocoder. It will be very helpful!

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Not the answer you're looking for? Browse other questions tagged or ask your own question.