# Marking population on a map without latitude and longitude coordinates?

**URL:** <https://discourse.processing.org/t/marking-population-on-a-map-without-latitude-and-longitude-coordinates/29741>\
**Category:** Processing\
**Created:** [April 30, 2021, 12:38pm UTC](https://discourse.processing.org/t/marking-population-on-a-map-without-latitude-and-longitude-coordinates/29741 "2021-04-30T12:38:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brolly301](https://avatars.discourse-cdn.com/v4/letter/b/958977/32.png) [@brolly301](https://discourse.processing.org/u/brolly301)\
**Post date:** [April 30, 2021, 12:38pm UTC](https://discourse.processing.org/t/marking-population-on-a-map-without-latitude-and-longitude-coordinates/29741/1 "2021-04-30T12:38:14Z")

</div>

Hi I have a map of the UK and I’m trying to load data onto the map but the data file hasn’t got latitude or longitude coordinates for each place to enable me to get the precise location. Is there any way to do this another way?

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [April 30, 2021, 12:54pm UTC](https://discourse.processing.org/t/marking-population-on-a-map-without-latitude-and-longitude-coordinates/29741/2 "2021-04-30T12:54:33Z")

</div>

Hi! Welcome to the forum!

I haven’t tested it but I guess you need to use some kind of API provided online. What about this one?  
[https://nominatim.org/release-docs/develop/api/Search/](https://nominatim.org/release-docs/develop/api/Search/)

also it depends on the size of the data… if it’s \< 10 cities I would manually search the coordinates, but if it’s more then I will automate lookup by a service like above.

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [April 30, 2021, 1:53pm UTC](https://discourse.processing.org/t/marking-population-on-a-map-without-latitude-and-longitude-coordinates/29741/3 "2021-04-30T13:53:15Z")

</div>

example:

```auto
void setup() {
  String[] cities = {"montreal", "toronto", "ottawa", "gatineau"};
  for(String city: cities) {
    JSONArray j = loadJSONArray("https://nominatim.openstreetmap.org/search?city=" + city + "&format=jsonv2");
    JSONObject o = j.getJSONObject(0);
    println(city, o.getFloat("lat"), o.getFloat("lon"));
  }
}

```

\*\* note that it’s not so fast to load one by one, so if you are planning to reload the program often and the city list won’t change, I recommend you to make the list of lon/lat first, append that to the data so that you don’t have to make query every time.
