As the topic describes, I have been trying to find the distance between two points as geo:wktLiterals.
I attached the data that is being used for this example.
I based the data types and assignments based off the geospatial primer. If remove the distance function from the select statement I will get back the points as expected, and this can be viewed in the attached file. As simple as this query should be, the result I get back from the final query returns no value.
No errors show when executing the query and I have checked that the database's spacial indexing is on. I am hoping there is a detail I missed. The help is appreciated!
When I attempt to load your exported data, I do see some spatial errors in the logs:
WARN 2018-10-03 07:35:21,857 [stardog-user-29] com.complexible.stardog.spatial.io.StatementSourceGeospatialSource:parse(96): Failed to parse unknown/malformed shape Point(34.305848 -116.14475): Bad Y value -116.14475 is not in boundary Rect(minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0)
WARN 2018-10-03 07:35:21,858 [stardog-user-29] com.complexible.stardog.spatial.io.StatementSourceGeospatialSource:parse(96): Failed to parse unknown/malformed shape Point(34.306891 -116.144696): Bad Y value -116.144696 is not in boundary Rect(minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0)
It looks like you created your points in the (more sensical, IMO) Point(LAT, LONG) notation, where the spec actually calls for Point(LONG, LAT). That's issue #1.
Issue #2 is that the geof:distance function seems to need a Geometry object where it's supposed to accept WKT Literals too. If you pass ?geo1 and ?geo2 in, you will see bound results. I will investigate this behavior further...
There was no warnings in the log for studio
Here is the updated trig with the LONG LAT Points fixed. So this should remove those warnings. export.trig (1.8 KB)
I'm just poking around and noticed that if you execute geof:distance with only two arguments it throws an index out of bounds exception but should probably throw an ExpressionEvaluationException.
Just to follow up, if you were to use ?geo1 ?geo2 in your query, you will see the proper results. When the blog post says that it accepts Geometries or WKT Literals, it means that it will accept a WKT Literal constant value. It doesn't seem as if variables of the WKT Literal type are supposed to work.