Hi,
I am trying to use the Stardog GeoSpatial nearby feature. My use case is that I have to retrieve latitude and longitude for a number of different locations and should pass them as parameters to the nearby function to find nearby places, such in the following query:
PREFIX : http://api.stardog.com/
PREFIX owl: http://www.w3.org/2002/07/owl#
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX stardog: tag:stardog:api:
PREFIX xsd: http://www.w3.org/2001/XMLSchema#
prefix wgs84_pos: http://www.w3.org/2003/01/geo/wgs84_pos#
prefix geo: http://www.opengis.net/ont/geosparql#
prefix geof: http://www.opengis.net/def/function/geosparql/
prefix unit: http://qudt.org/vocab/unit#select * {
GRAPH
<graph1>
{
?place a :Place;
wgs84_pos:lat ?lat;
wgs84_pos:long ?long.
?s
geof:nearby (?lat ?long 22 unit:Kilometer);
wgs84_pos:lat ?pp_lat;
wgs84_pos:long ?pp_long.
}
}
After running the above query, I am getting the error:
Caused by: java.lang.IllegalStateException: Latitude must be a double value between -90 & 90
I also tried the following ways, including binding latitude and longitude directly, e.g.
BIND(xsd:float("50.173588") AS ?lat).
BIND(xsd:float("12.12583") AS ?long).
:
PREFIX : http://api.stardog.com/
PREFIX owl: http://www.w3.org/2002/07/owl#
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX stardog: tag:stardog:api:
PREFIX xsd: http://www.w3.org/2001/XMLSchema#
prefix wgs84_pos: http://www.w3.org/2003/01/geo/wgs84_pos#
prefix geo: http://www.opengis.net/ont/geosparql#
prefix geof: http://www.opengis.net/def/function/geosparql/
prefix unit: http://qudt.org/vocab/unit#select * {
GRAPH
<graph1>
{
?place a :Place;
wgs84_pos:lat ?lat;
wgs84_pos:long ?long.
BIND(strdt(concat('Point(', STR(?long), ' ', STR(?lat), ')' ), geo:wktLiteral) as ?location)
?s
geof:nearby (?location 22 unit:Kilometer);
wgs84_pos:lat ?poi_lat;
wgs84_pos:long ?poi_long.
}
}
The above query does not return any result.
The queries that are returning results, but are only for a particular point, i.e. latitude and longitude, respectively, are:
PREFIX : http://api.stardog.com/
PREFIX owl: http://www.w3.org/2002/07/owl#
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX stardog: tag:stardog:api:
PREFIX xsd: http://www.w3.org/2001/XMLSchema#
prefix wgs84_pos: http://www.w3.org/2003/01/geo/wgs84_pos#
prefix geo: http://www.opengis.net/ont/geosparql#
prefix geof: http://www.opengis.net/def/function/geosparql/
prefix unit: http://qudt.org/vocab/unit#select * {
GRAPH
<graph1>
{
?s
geof:nearby ("Point(12.12583 50.173588 )"^^geo:wktLiteral 22 unit:Kilometer);
wgs84_pos:lat ?poi_lat;
wgs84_pos:long ?poi_long.
}
}
and (note the switching between longitude and latitude):
PREFIX : http://api.stardog.com/
PREFIX owl: http://www.w3.org/2002/07/owl#
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX rdfs: http://www.w3.org/2000/01/rdf-schema#
PREFIX stardog: tag:stardog:api:
PREFIX xsd: http://www.w3.org/2001/XMLSchema#
prefix wgs84_pos: http://www.w3.org/2003/01/geo/wgs84_pos#
prefix geo: http://www.opengis.net/ont/geosparql#
prefix geof: http://www.opengis.net/def/function/geosparql/
prefix unit: http://qudt.org/vocab/unit#select * {
GRAPH
<graph1>
{
?s
geof:nearby (50.173588 12.12583 22 unit:Kilometer);
wgs84_pos:lat ?poi_lat;
wgs84_pos:long ?poi_long.
}
}
I imagine, I am doing something wrong.
Best,