The data source is a CSV with cities in various countries in the world, each city has some numeric data associated with it. df.columns looks like:

['Continent', 'Country', 'City', 'data']

I want to make a map with all these cities, shown in the right location. I want a color bar with at least some of the cities ordered by the numeric data column. On the map, the cities should be marked with the same color as in the color bar.

Probably something like Plotly could draw the map. But:

  • how to get the geolocations of each city based on the first 3 columns?
  • how to plot dots or disks (with color attributes) in Plotly based on lat/long pairs?

The idea is similar to this, but with cities instead of countries:

enter image description here

  • $\begingroup$ Use some external API/data dump to get the latitudes and longitudes $\endgroup$ – Aditya Feb 5 at 1:59
  • $\begingroup$ @Aditya Well, yeah, that's obvious, I was hoping to get a useful example. $\endgroup$ – Florin Andrei Feb 5 at 2:26
  • $\begingroup$ To grab the data, I am not sure but I think you can use Open Street Map? Sorry me no expert in geospatial but plotting them back is not gonna be difficult I think $\endgroup$ – Aditya Feb 5 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.