1

i am working with GPS Tracks of cars and i would like to find out whether a certain gps point (given in lat/lon) is within a city (and its boundaries/suburbs/etc.) or if it is on the "countryside". With "countryside" i mean everything that is not defined as "city". Therefore i consider towns, villages, etc. as "countryside". Basically i want to filter out city-traffic from my data.

Is there a simple way to query this via OpenStreetMaps?

I've already tried to find some tags or attributes on OSM that would indicate whether a gps point is within a city or not. The only relevant attribute i found would be in the "Enclosing Features" tag: If some point is NOT within a city (and therefore on the countryside) there always seems to be a tag called "City Boundary". This tag does not exist if the point is within a city.

Example: Some point (in Berlin) that I would classify as "City": http://www.openstreetmap.org/query?lat=52.4662&lon=13.4824

Some point (outside of Berlin) that I would classify as "Countryside": http://www.openstreetmap.org/query?lat=52.3362&lon=13.9618

  • I think you need to refine what you mean by "city", both in selection (what is a city? a settlement with a certain number of inhabitants? a continuous residential area of some minimum size?) and delimitation (do you want administrative boundaries of the city? maximum distance from built-up areas?) – Jan Šimbera Sep 9 '16 at 13:23
  • Sorry for the late response. In the end, for my purposes it was enough to simply create a list of cities (that were of interest for my project) and for each specified a bounding circle with a certain radius. If a GPS point lies within one of the specified bounding circles, i consider it as "within a city". – user2350644 Nov 16 '17 at 9:43
1

Not the perfect solution, but enough for my purposes:

  • I simply created a list of cities (that were of interest for my project)
  • for each city, I specified a "bounding circle" with a certain radius (for instance 50km)
  • If a GPS point lies within one of the specified bounding circles, i consider it as "within a city"

Another similar simple solution I figured out:

  1. Create a list of all cities, towns, villages, etc. (that are of your interest) with their ZIP-Code and its population
  2. Using all cities, villages, etc. of Austria for example, there exist some tables that have its ZIP-Code and population.
  3. In Austria a city is given when the population is > 10.000 (https://de.wikipedia.org/wiki/Liste_der_St%C3%A4dte_in_%C3%96sterreich)
  4. For all GPS locations, query OSM and receive their postal-codes
  5. Then simply check the GPS location's postal code in your list. If the population is >10.000 its "within a city".

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.