UPDATE: <blush> There's a good chance this may be as simple as me flipping latitude and longitude around in my wktLiteral representation of a POINT. I've worked for so many years with lat/lon being the order... realized today that WGS84 flips them around.
You may want to update JENA-649 to be OBE because of operator error ... -heidi -----Original Message----- From: Andy Seaborne [mailto:[email protected]] Sent: Tuesday, March 04, 2014 4:37 AM To: [email protected] Subject: Re: Spatial withinCircle distances Hi there, Thank you for the complete example. I've created JENA-649 to record this (so it does not get lost in email). Andy https://issues.apache.org/jira/browse/JENA-649 On 03/03/14 22:27, Heidi McClure wrote: > No, I don't think it's taking 700 and treating as km. When I use 1126 mi > (yes, I tested with mi in this experiment because km gave me no results) > where 1126 km is approximately 700 mi it gives me a few points but not all > that I expect. > > Here is some data and queries that should work but don't along with some bad > queries that do work using very large radii. > > Using http://www.freemaptools.com/measure-distance.htm > Distance between Assault and Knife is approx. 93 mi. > Distance between Assault and Robbery is approx. 250 mi. > Point used for within query is the point of the Assault. > > data: > > <http://example.com/event#event_3> <http://example.com/event#type> > "Knife"^^<http://www.w3.org/2001/XMLSchema#string> . > <http://example.com/event#event_3> > <http://www.opengis.net/ont/geosparql#asWKT> "POINT(35.46883 > -104.39098)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> . > <http://example.com/event#event_3> > <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > <http://example.com/event#event_4> <http://example.com/event#type> > "Assault"^^<http://www.w3.org/2001/XMLSchema#string> . > <http://example.com/event#event_4> > <http://www.opengis.net/ont/geosparql#asWKT> "POINT(36.34 > -103.13)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> . > <http://example.com/event#event_4> > <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > <http://example.com/event#event_6> <http://example.com/event#type> > "Robbery"^^<http://www.w3.org/2001/XMLSchema#string> . > <http://example.com/event#event_6> > <http://www.opengis.net/ont/geosparql#asWKT> "POINT(32.8657 > -104.21235)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> . > <http://example.com/event#event_6> > <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > > > simplistic test - returns all 3 records > > SELECT DISTINCT ?Event ?Location WHERE { > ?Event <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > ?Event <http://www.opengis.net/ont/geosparql#asWKT> ?Location } > > > FAILS: withinCircle of 100 mi radius - returns no records - should > return 2 > > SELECT DISTINCT ?Event ?Location WHERE { > ?Event <http://jena.apache.org/spatial#withinCircle> (36.34 -103.13 100 'mi') > . > ?Event <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > ?Event <http://www.opengis.net/ont/geosparql#asWKT> ?Location } > > FAILS: withinCircle of 275 mi radius - returns no records - should > return 3 records > > SELECT DISTINCT ?Event ?Location WHERE { > ?Event <http://jena.apache.org/spatial#withinCircle> (36.34 -103.13 275 'mi') > . > ?Event <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > ?Event <http://www.opengis.net/ont/geosparql#asWKT> ?Location } > > > BAD: withinCircle of 9400 mi radius - returns 2 records > > SELECT DISTINCT ?Event ?Location WHERE { > ?Event <http://jena.apache.org/spatial#withinCircle> (36.34 -103.13 9400 > 'mi') . > ?Event <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > ?Event <http://www.opengis.net/ont/geosparql#asWKT> ?Location } > > > BAD: withinCircle of 9450 mi radius - returns all 3 records > > SELECT DISTINCT ?Event ?Location WHERE { > ?Event <http://jena.apache.org/spatial#withinCircle> (36.34 -103.13 9450 > 'mi') . > ?Event <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> > <http://example.com/event#type> . > ?Event <http://www.opengis.net/ont/geosparql#asWKT> ?Location } > > > thanks, > -heidi > > > -----Original Message----- > From: Andy Seaborne [mailto:[email protected]] > Sent: Monday, March 03, 2014 2:25 PM > To: [email protected] > Subject: Re: Spatial withinCircle distances > > On 03/03/14 20:17, Heidi McClure wrote: >> Hello, >> >> >> I'm using Jena version 2.11.1. When I use withinCircle, I don't see >> results that I would expect - I am able to plot a set of points in a >> geospatial application and measure the distance from point 1 to the >> other points - they are all within 700 miles of point 1. When I do a >> similar query using the withinCircle API in spatial Jena, I don't get >> any points! When I double 700 mi to 1400 miles I get the results I >> expected with 700 miles. >> >> >> >> Am I using the API incorrectly? Does the withinCircle use the number >> I pass in as a diameter of a circle centered at the POINT and not a >> radius from the POINT? >> > > Heidi, > > I'm not sure but I'm afraid you may have tripped over another, fixed bug. > Would if the engine was treating 700 as kilometres explain what you are > seeing? > > This was fixed after the 2.11.1 version - it is available in development > builds. > > https://repository.apache.org/content/repositories/snapshots/org/apach > e/jena/ > > The bug was in the query processing - the data is OK. > > If you try this, could let the list know whether it works; otherwise could > you provide a complete, minimal example that can be debugged? > > https://issues.apache.org/jira/browse/JENA-623 > > Andy >
