How to list nearby addresses given a location?

31 views
Skip to first unread message

Friedhelm Victor

unread,
Nov 3, 2014, 5:54:25 AM11/3/14
to linked-...@googlegroups.com
Hi,

I want to discover all nearby addresses given a coordinate and a radius.
The way I have been going about this is the following - aiming at a 100m radius of location 52.512025, 13.321833, Ernst-Reuter Platz in Berlin:

Running on vsnorql:

SELECT ?b ?streetname ?housenumber
  WHERE {
    ?b a meta:Node.
    ?b <http://linkedgeodata.org/ontology/addr%3Astreet> ?streetname.
    ?b <http://linkedgeodata.org/ontology/addr%3Ahousenumber> ?housenumber.
    ?b geom:geometry [ogc:asWKT ?geo ] .
    filter(bif:st_intersects(bif:st_point(13.321833, 52.512025), ?geo, 0.1 ))
  }
LIMIT 500


Returns results that are way off. Results that are more than 2km away.

Extending the request to include postcode and city name:

SELECT ?b ?streetname ?housenumber ?postcode ?city
  WHERE {
    ?b a meta:Node.
    ?b <http://linkedgeodata.org/ontology/addr%3Astreet> ?streetname.
    ?b <http://linkedgeodata.org/ontology/addr%3Ahousenumber> ?housenumber.
    ?b <http://linkedgeodata.org/ontology/addr:postcode> ?postcode.
    ?b <http://linkedgeodata.org/ontology/addr%3Acity> ?city.
    ?b geom:geometry [ogc:asWKT ?geo ] .
    filter(bif:st_intersects(bif:st_point(13.321833, 52.512025), ?geo, 0.1 ))
  }
LIMIT 500


The endpoint only returns an error.

My hope was to get more recent data with the vsparql endpoint.
The only thing that seemed to work reliably (although currently the sparql endpoint seems to return a 502 Proxy Error), is using st_distance.
Something along the lines of this:

Prefix lgdr:<http://linkedgeodata.org/triplify/>
Prefix lgdo:<http://linkedgeodata.org/ontology/>
Prefix geom: <http://geovocab.org/geometry#>
Prefix ogc: <http://www.opengis.net/ont/geosparql#>

# Prefixes probably not needed

Select DISTINCT *
FROM <http://linkedgeodata.org/sparql>
  WHERE {
   ?node <http://linkedgeodata.org/ontology/addr%3Astreet> ?streetname .
   ?node geo:lat ?lat .
   ?node geo:long ?long
   Filter (bif:st_distance (bif:st_point(?long, ?lat), bif:st_point (13.321833, 52.512025)) < 0.1) .
  }
Limit 1000



So ultimately, my question is this:
How would I properly go about finding Addresses near a given location?
That is, within a specified radius.

Best Regards,
Friedhelm Victor
Reply all
Reply to author
Forward
0 new messages