Reverse Geocoding Without Web Access

后端 未结 6 1792
南方客
南方客 2020-12-04 18:19

I am working on an application where one of the requirements is that I be able to perform realtime reverse geocoding operations based on GPS data. In particular, I must be

相关标签:
6条回答
  • 2020-12-04 18:57

    You can get data for the entire united states from open street map You could then extract the data you need such as city or state locations into what ever format works best for your application. Note although data quality is good it isn't guaranteed to be completely accurate so if you need complete accuracy you may have to look somewhere else.

    0 讨论(0)
  • 2020-12-04 18:57

    I have a database with all of this data and some access tools. I made mine from the census tiger data. I imagine it'd basically be an export of my database to sqlite and a bit of code translation.

    0 讨论(0)
  • 2020-12-04 19:01

    I suggest using a variant of your first idea: Use a spatial index. A spatial index is a data structure built from rectangles, mapping lat/long to the payload. In this case you will probably map rectangles to state-province pairs. An R-tree may be a good option. Here's an R-tree python package. You could detect roaming by comparing the results of consecutive searches.

    0 讨论(0)
  • 2020-12-04 19:01

    I would stay away from implementing your own solution from scratch. This is a pretty big undertaking and there are already tools out there to do this. If you're looking for an open source approach (read: free), take a look at this blog post: Using PostGIS to Reverse Geocode.

    0 讨论(0)
  • 2020-12-04 19:12

    I created an offline reverse geocoding module for countries: https://bitbucket.org/richardpenman/reverse_geocode

    >>> import reverse_geocode 
    >>> coordinates = (-37.81, 144.96), (31.76, 35.21)
    >>> reverse_geocode.search(coordinates)
    [{'city': 'Melbourne', 'code': 'AU', 'country': 'Australia'},
     {'city': 'Jerusalem', 'code': 'IL', 'country': 'Israel'}]
    

    I will see if I can add data for states.

    0 讨论(0)
  • 2020-12-04 19:21

    If you can get hold of state boundaries as polygons (for example, via OpenStreetMap), determining the current state is just a point-in-polygon test.

    If you need address data, an offline solution would be to use Microsoft Mappoint.

    0 讨论(0)
提交回复
热议问题