Problems with st_distance

79 views
Skip to first unread message

Frederik Janssen

unread,
Feb 25, 2015, 4:09:55 AM2/25/15
to linked-...@googlegroups.com
We have a query that certainly has worked some time ago but now does not work any more:

Prefix geo: <http://geovocab.org/geometry#>
Prefix lgdo: <http://linkedgeodata.org/ontology/>
Prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
Prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix ogc: <http://www.opengis.net/ont/geosparql#>

Select ?node ?label ?type ?location  (<bif:st_distance> (?location,
<bif:st_point> (8.00863593515,49.9771504215)) as ?distance) FROM
<http://linkedgeodata.org>  {
     ?node rdfs:label ?label .
     ?node rdf:type ?type .
     ?node geo:geometry [ogc:asWKT ?location] .
     Filter(<bif:st_intersects> (?location, <bif:st_point>
(8.00863593515,49.9771504215), 2.0)) .
FILTER (contains(str(?type),"linkedgeodata.org/onto"))} ORDER BY DESC(?node)

The purpose is to yield all locations inside a radius of 2km around the given point.

The error is:
Virtuoso 22023 Error GEO..: Function st_distance() expects a geometry of  type 1 as argument 0, not geometry of type 2

Any ideas?

Thanks
Frederik

Irene Celino

unread,
Feb 25, 2015, 4:16:34 AM2/25/15
to linked-...@googlegroups.com
Curious, I encountered the same issue yesterday :-)

If I got it correctly, the problem is that st_distance works only with points and in your query you are not checking that ?node is a lgdm:Node and not a lgdm:Way.
Try adding the following filter:
FILTER NOT EXISTS { ?node a lgdm:Way. }

I'd be happy if some Virtuoso expert could confirm/refute or give a better explanation.
HTH,
Irene


--
You received this message because you are subscribed to the Google Groups "Linked Geo Data" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linked-geo-da...@googlegroups.com.
To post to this group, send email to linked-...@googlegroups.com.
Visit this group at http://groups.google.com/group/linked-geo-data.
For more options, visit https://groups.google.com/d/optout.



--

http://about.me/iricelino/

    " If you understand what you're doing,
           you're not learning anything. "

Hugh Williams

unread,
Mar 1, 2015, 9:48:12 AM3/1/15
to linked-...@googlegroups.com
Hi Fredrick,

The query contain "<bif:st_distance>" with no params being passed to the st_distance() function which needs in put params hence the error, see documentation at:


Best Regards
Hugh Williams
Professional Services
OpenLink Software, Inc.      //              http://www.openlinksw.com/
Universal Data Access, Integration, and Management Technology Providers

Reply all
Reply to author
Forward
0 new messages