Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7871589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:57:08+00:00 2026-06-03T01:57:08+00:00

Given: A city A geopoint Question: determine whether the given geopoint belongs to the

  • 0

Given:

  • A city
  • A geopoint

Question: determine whether the given geopoint belongs to the city.

My current solution is trivial:

  1. Do reverse geocoding (I am using the python googlemaps package). This yields the results dictionary.
  2. Examine results[‘Placemark’][0][‘AddressDetails’] looking for the LocalityName keyword.
  3. The given geopoint is deemed inside the city, if the found LocalityName equals the name of the city.

So far so good. Even if it is not the best of algorithms, it is surely the simplest. However, there are problems. Take for instance:

  • Aberdeen, UK.
  • lat = 57.14369, lng = -2.22314

The GoogleMaps.reverse_geocode(57.14369, -2.22314) yields the following result:

{ u'Placemark': [ { u'AddressDetails': { u'Accuracy': 6,
                                         u'Country': { u'CountryName': u'UK',
                                                       u'CountryNameCode': u'GB',
                                                       u'Thoroughfare': { u'ThoroughfareName': u'A944'}}},
                    u'ExtendedData': { u'LatLonBox': { u'east': -2.2200414,
                                                       u'north': 57.1480762,
                                                       u'south': 57.1453783,
                                                       u'west': -2.2239393}},
                    u'Point': { u'coordinates': [-2.221984, 57.1467683, 0]},
                    u'address': u'A944, Aberdeen, Aberdeen City AB15, UK',
                    u'id': u'p1'}],
  u'_id': 7635459717214061L,
  u'loc': [-2.2231, 57.1437]}

The problem is that the formatted address (A944, Aberdeen, Aberdeen City AB15, UK) is not broken into details – the returned AddressDetails is essentially useless.

So, it looks like one has to parse the returned address manually, which seems to be a real PITA in a general case.

I would like to know how other folks solve this problem. Using the google maps web services API is not a requirement.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:57:10+00:00Added an answer on June 3, 2026 at 1:57 am

    The reverse geocoding web service for
    http://maps.googleapis.com/maps/api/geocode/json?latlng=57.14369,-2.22314&sensor=false

    yields far more data than you have posted from the Python package, including

    {
       "results" : [
          {
             "address_components" : [
                {
                   "long_name" : "A944",
                   "short_name" : "A944",
                   "types" : [ "route" ]
                },
                {
                   "long_name" : "Aberdeen City",
                   "short_name" : "Aberdeen City",
                   "types" : [ "administrative_area_level_2", "political" ]
                },
    ...
    

    which seems to fit the bill. You get “Aberdeen City”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a url to get the Longitudes and Latitudes for a given city.
I need a free(open-source) solution that given the lat/lng can return the closet city/state
Given a big city (square is about 800 km^2 ) with some layer over
Given the following two defined routes: routes.MapRoute(name: CityCategoryPage, url: {city}-{state}/{categoryName}/__c/, defaults: new { controller
given a Python class hierarchy, say class Base: def method1 def method2 def method3
Given a table like ID | Name | City 1 | X | Y
Given table USER (name, city, age), what's the best way to get the user
I need to figure out whether not a given location is considered urban or
A given location (city), can have a name and also other aliases by which
Given the following structure: City Area User Every Area has 1 and only 1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.