# Elasticsearch find latitude and longitude from city name?

**URL:** <https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644>\
**Category:** Elasticsearch\
**Created:** [June 13, 2016, 5:45pm UTC](https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644 "2016-06-13T17:45:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit2015](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@Amit2015](https://discuss.elastic.co/u/Amit2015)\
**Post date:** [June 13, 2016, 5:45pm UTC](https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644/1 "2016-06-13T17:45:46Z")

</div>

In log data I have city name but not latitude and longitude. From city name how can I get latitude and longitude value? I want to create a map from this value. Please guide...

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 13, 2016, 6:04pm UTC](https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644/2 "2016-06-13T18:04:09Z")

</div>

ES or Logstash can't do this out of the box, but it would certainly be doable to write a plugin for it. I haven't heard of anyone doing it.

---

<div class="post-metadata">

**Author:** ![Amit2015](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@Amit2015](https://discuss.elastic.co/u/Amit2015)\
**Post date:** [June 13, 2016, 6:09pm UTC](https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644/3 "2016-06-13T18:09:21Z")

</div>

Thanks for reply.

It should convert city to geo\_point:lat & log. Difficult to add manually. It would be great if it show direct location to map like IBM Cognos BI.

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [June 13, 2016, 7:16pm UTC](https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644/4 "2016-06-13T19:16:45Z")

</div>

Geo location lookup is not trivial since it involves some sort of lookup for named entities that are ambigous most of the time. Take all the cities named Paris in the world. Without context it's not easy to disambiguate this, so its application specific what to do here (Popularity? Thats what most people do, but its wrong sometimes). If you want to do this by yourself, the open data project Geonames ([http://www.geonames.org/](http://www.geonames.org/)) is a good place to start.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 13, 2016, 8:00pm UTC](https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644/5 "2016-06-13T20:00:23Z")

</div>

If the geographical entities that occur are finite and known in advance you might be able to pull off a simple lookup table driven by a translate filter.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:44pm UTC](https://discuss.elastic.co/t/elasticsearch-find-latitude-and-longitude-from-city-name/52644/6 "2017-07-05T22:44:13Z")

</div>


