i have a JSON file that contains lon and lat coordinates. I want to parse this file and then create a new JSON file that contains only coordinates of a certain country.

Is it possible to do this? How to figure out what country the coordinates belong to?

有帮助吗?

解决方案

In broad strokes, it sounds like you want to do what's called reverse geocoding. This is the process of taking a known set of coordinates and getting an address from it. The address would include the country.

Depending on the size of your data set, Google offers one that might suit you. You could write a routine to iterate your data set, reverse geocode each set of coordinates, and get a structured address (including country), which you could cache for future use. With the countries, you could then filter the list down to the specific country you're looking for.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top