Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing cities on the map #87

Closed
havsar opened this issue Jul 5, 2018 · 3 comments
Closed

Showing cities on the map #87

havsar opened this issue Jul 5, 2018 · 3 comments

Comments

@havsar
Copy link

havsar commented Jul 5, 2018

My goal is to show markers for several cities on the world map.
I see on the examples that I can achieve this by setting correct marker coordinates.

But how to know the coordinates?

@zimrick
Copy link
Contributor

zimrick commented Jul 5, 2018

Hi @havsar

If you have only a few cities, you can easily get the coordinates through Google. Just type the city name and coordinates. You will however have to make sure that the coordinates are specified in +/- values rather than North/South/East/West. Here's an example:

If you want to get the coordinates for New York, Google will return something like this:

40.7128° N, 74.0060° W

In order for react-simple-maps and d3-geo to understand this, you will have to specify it like this:

[-74.0060, 40.7128]

North and East are both + values and South and West are - values. Also, note that the order in reacts-simple-maps and d3-geo is longitude, latitude. Google returns coordinates in the reverse order.

If you have a lot of cities, you can also try using something like this:
https://simplemaps.com/data/world-cities

Hope this helps.

@havsar
Copy link
Author

havsar commented Jul 5, 2018

Hi @zimrick

Thanks for the quick response, the solution you described worked for me.
At the moment I just need a few cities to start with, later on I may need to use the link you posted.

I used this tool, if someone else needs: https://www.maps.ie/coordinates.html
Just make sure to use the correct ordering (long, lat).

@iMerica
Copy link

iMerica commented Dec 16, 2018

Maybe add a "gotchas" section to the docs with this [lat, long] vs [long, lat] thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants