Message Boards Message Boards

1 Reply
1 Total Likes
View groups...
Share this post:

How can I list all the 'countries 4000 km far from current location'?

Posted 10 years ago

How can I list all the 'countries 4000 km far from current location'?

I asked the question on matematica.stackexchange but they redirected me here.

POSTED BY: Orban Botond

Depending on how precise you want it: do you really want to check the border, or just the capital city of that country?

In case of the latter, you could find the capital city and the coordinates with CountryData and CityData, and compare that to your position with GeoDistance.

If you want to check if any piece of the country falls within this 4000 kilogram, the code will be much more involved, but I guess it will be along a route like:

Using CountryData get the border of a country, and check for each point of this polygon if this is within 4000 kilometer. Do this for every country. Note that this will not be fast; GeoDistance is not very fast I think.

In case you have access to RaspBerry Pi running Mathematica 10 you can visually see those countries:

GeoGraphics[GeoCircle[FindGeoLocation[], Quantity[4000, "km"]]]

enter image description here

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract