2

I'm using several reverse geocoding options such as Foursquare, Google, and OpenStreetMap to retrieve place information, but the one type of place that none of these seem to be able to do is residential areas.

Simply put, I want to know if a given lat/long belongs to a residential area or property.

OpenStreetMap seems to be the closest to a solution as it marks some roads as residential, but I don't know of an OSM API that would allow me to see if, given a lat/long, the corresponding property lies on a residential road. Nominatim only gives the single closest entry.

I don't mind paying.

  • Not sure if Gisgraphy provides that, but might be worth a try: http://services.gisgraphy.com/reversegeocoding/search?lat=${lat}&lng=${lon}&format=json for a quick glance (just replace the variables accordingly, using decimal format). For free it only works in a web browser, but you can register for API access (haven't checked their pricing, though). – Izzy Oct 4 '18 at 10:14
  • Thanks @Izzy, but unfortunately not seeing any information that could lead to identifying residence or not. – Chris Watts Oct 4 '18 at 11:41
  • 1
    For OpenStreetMap, probably better to check if the location is within an area tagged as landuse=residential. Not sure if there is any API to do this. – vclaw Oct 4 '18 at 11:44
  • 1
    I think @vclaw's answer is going to be the best. I've just checked landuse=residential on OpenStreetMap and it seems to provide the perfect level of information for my needs. I just need to either find or make an API that returns this information. overpass-turbo.eu might be able to do this it seems. – Chris Watts Oct 4 '18 at 13:53
  • 1
    @Mawg Depending on how good the service is, and whether it can replace other services I use, up to $200/month – Chris Watts Oct 5 '18 at 8:29
3

It looks like Gisgraphy should fit your needs. Here's the output from an example query:

<results>
  <numFound>1</numFound>
  <QTime>519</QTime>
  <result>
    <name>Elenis Palaiologou</name>
    <distance>9.3785112</distance>
    <gid>207699655</gid>
    <openstreetmapId>202995032</openstreetmapId>
    <streetType>RESIDENTIAL</streetType>
    <oneWay>true</oneWay>
    <countryCode>CY</countryCode>
    <length>143.038762237</length>
    <lat>35.17133607836711</lat>
    <lng>33.36918811504461</lng>
    <isIn>Nicosia</isIn>
    <isInAdm>Λευκωσία - Lefkoşa</isInAdm>
    <adm1Name>Λευκωσία - Lefkoşa</adm1Name>
    <adm2Name>Λευκωσία - Lefkoşa</adm2Name>
    <fullyQualifiedName>Elenis Palaiologou, Nicosia, Λευκωσία - Lefkoşa</fullyQualifiedName>
    <lanes>2</lanes>
    <azimuthStart>63</azimuthStart>
    <azimuthEnd>31</azimuthEnd>
    <label>Elenis Palaiologou, Nicosia</label>
    <labelPostal>Elenis Palaiologou, Nicosia</labelPostal>
    <source>OSM</source>
  </result>
  <attributions>http://www.gisgraphy.com/attributions.html</attributions>
</results>

The attribute you are after is <streetType>RESIDENTIAL</streetType>.

Gisgraphy offers API access. I haven't checked their prices, but it seems they have a free and a premium service. Apart from that, you can also install the software on your own server, as it is available at Github. For details on how to use the API, please refer to their API reference. "Street type" is dealt with in chapter 7.

Oh: And as you can see by <source>OSM</source> it is using OpenStreetMap :)

| improve this answer | |
  • 1
    Yeah, this seems to work for the things I have tried so far. Of course, it will probably fail if the GPS coordinate points to a house with no nearby road, but it's a good start! – Chris Watts Oct 4 '18 at 12:49
  • 3
    All I use it for is the label, so I cannot really tell #D Should definitely fit your basic needs. And as the saying goes: if you miss something, fork and make a PR 😁‎ – Izzy Oct 4 '18 at 13:09
1

I've found that using the OpenStreetMap Overpass API gives what I need. You can write a query in Overpass Query Language or XML to search OSM for nodes, ways and relations tagged as "residential":

[out:json][timeout:25];
(
  node["landuse"="residential"](around:100,52.637580,1.297785);
  way["landuse"="residential"](around:100,52.637580,1.297785);
  relation["landuse"="residential"](around:100,52.637580,1.297785);
);
out body;
>;
out skel qt;

There's an online interpreter here: http://overpass-turbo.eu/

And an API endpoint here: https://z.overpass-api.de/api/interpreter

| improve this answer | |

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.