none
Get Nearby Residential Area by Latitude & Longitude RRS feed

  • Question

  • Hi All,

    I want to get nearby residential areas by current location( lat&long ). Any idea on how can I achieve that?

    Thanks,

    Attiqe


    Attiqe Ur Rehman

    Friday, December 19, 2014 1:59 PM

Answers

All replies

  • You can use the reverse geocoding service to get the city or neighborhood that the coordinate is in. This will only return one location. You won't be able to do a radial search for other areas unless you create a data set with the polygon data for all areas you want to be able to search for.

    http://rbrundritt.wordpress.com

    Tuesday, December 23, 2014 8:49 PM
  • Ricky,

    Thanks for reply, but please consider the following scenario that I have coordinates of the hospital/ school and I want nearby residential areas so I will do something like that:

    https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&result_type=neighborhood&key=KEY


    {
       "results" : [
          {
             "address_components" : [
                {
                   "long_name" : "Williamsburg",
                   "short_name" : "Williamsburg",
                   "types" : [ "neighborhood", "political" ]
                },
                {
                   "long_name" : "Brooklyn",
                   "short_name" : "Brooklyn",
                   "types" : [ "sublocality_level_1", "sublocality", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "New York",
                   "types" : [ "locality", "political" ]
                },
                {
                   "long_name" : "Kings County",
                   "short_name" : "Kings County",
                   "types" : [ "administrative_area_level_2", "political" ]
                },
                {
                   "long_name" : "New York",
                   "short_name" : "NY",
                   "types" : [ "administrative_area_level_1", "political" ]
                },
                {
                   "long_name" : "United States",
                   "short_name" : "US",
                   "types" : [ "country", "political" ]
                }
             ],
             "formatted_address" : "Williamsburg, Brooklyn, NY, USA",
             "geometry" : {
                "bounds" : {
                   "northeast" : {
                      "lat" : 40.7251773,
                      "lng" : -73.936498
                   },
                   "southwest" : {
                      "lat" : 40.6979329,
                      "lng" : -73.96984499999999
                   }
                },
                "location" : {
                   "lat" : 40.7081156,
                   "lng" : -73.9570696
                },
                "location_type" : "APPROXIMATE",
                "viewport" : {
                   "northeast" : {
                      "lat" : 40.7251773,
                      "lng" : -73.936498
                   },
                   "southwest" : {
                      "lat" : 40.6979329,
                      "lng" : -73.96984499999999
                   }
                }
             },
             "types" : [ "neighborhood", "political" ]
          }
       ],
       "status" : "OK"
    }
     

    So in that case will be "Williamsburg, Brooklyn, NY, USA" residential area?

    Thanks,


    Attiqe Ur Rehman

    Wednesday, December 24, 2014 11:34 AM
  • that's Google's reverse geocoding service which returns the data for the location you specified and not all nearby neighborhoods. This can be done using the Bing maps rest reverse geocoding service very easily.


    http://rbrundritt.wordpress.com

    Wednesday, December 24, 2014 1:35 PM
  • I did it with Bing using following:

    http://dev.virtualearth.net/REST/v1/Locations/40.714224,-73.961452?o=json&includeNeighborhood=1&key=KEY

    and in response I get following:

    {
       "authenticationResultCode":"ValidCredentials",
       "brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
       "copyright":"Copyright © 2014 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
       "resourceSets":[
          {
             "estimatedTotal":1,
             "resources":[
                {
                   "__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
                   "bbox":[
                      40.710361282429325,
                      -73.968246430974176,
                      40.718086717570678,
                      -73.954657569025812
                   ],
                   "name":"281 Bedford Ave, Brooklyn, NY 11249",
                   "point":{
                      "type":"Point",
                      "coordinates":[
                         40.714224,
                         -73.961452
                      ]
                   },
                   "address":{
                      "addressLine":"281 Bedford Ave",
                      "adminDistrict":"NY",
                      "countryRegion":"United States",
                      "formattedAddress":"281 Bedford Ave, Brooklyn, NY 11249",
                      "locality":"Brooklyn",
                      "postalCode":"11249"
                   },
                   "confidence":"Medium",
                   "entityType":"Address",
                   "geocodePoints":[
                      {
                         "type":"Point",
                         "coordinates":[
                            40.714224,
                            -73.961452
                         ],
                         "calculationMethod":"Interpolation",
                         "usageTypes":[
                            "Display",
                            "Route"
                         ]
                      }
                   ],
                   "matchCodes":[
                      "Good"
                   ]
                }
             ]
          }
       ],
       "statusCode":200,
       "statusDescription":"OK",
       "traceId":"3f8394de572240348e79e8a04d5af8a4|HK20240353|02.00.108.1000|HK2SCH010030831, HK2SCH010291121"
    }

    And this didn't have any neighbourhood values in it? Am I using correct API or not?

    Thanks,


    Attiqe Ur Rehman

    Wednesday, December 24, 2014 2:08 PM
  • In this case the issue is that neighbourhood data isn't available everywhere yet. It does look like Bing has the polygon data for this neighbourhood in the GeoData API but not it's name: https://platform.bing.com/geo/spatial/v1/public/Geodata?SpatialFilter=GetBoundary(40.714224,-73.961452,0,'Neighborhood',1,1,'en-US','US')&$format=json&key=YOUR_BING_MAPS_KEY

    http://rbrundritt.wordpress.com

    Monday, December 29, 2014 5:11 PM