http://franz.com/ns/allegrograph/3.0/geospatial/fn/haversineKilometers
X <http://franz.com/ns/allegrograph/3.0/geospatial/fn/haversineKilometers>
( p1 p2 )
Returns the distance between the two points in kilometers, according to the Haversine formula.
For example:
prefix geofn: <http://franz.com/ns/allegrograph/3.0/geospatial/fn/>
select ?distance {
bind(geofn:toPointLonLat(<http://ex#bar>, 56.0, 42.0) as ?p1 )
bind(geofn:toPointLonLat(<http://ex#bar>, 57.0, 42.5) as ?p2 )
bind(geofn:haversineKilometers(?p1, ?p2) as ?distance)
}
p1 and p2 must both be bound to geospatial UPIs.
Notes
The following namespace abbreviations are used:
- fti - <http://franz.com/ns/allegrograph/2.2/textindex/>
- geo - <http://franz.com/ns/allegrograph/3.0/geospatial/>
- geofn - <http://franz.com/ns/allegrograph/3.0/geospatial/fn/>
- nd - <http://franz.com/ns/allegrograph/5.0/geo/nd#>
- ndfn - <http://franz.com/ns/allegrograph/5.0/geo/nd/fn#>
- sna - <http://franz.com/ns/allegrograph/4.11/sna/>
The SPARQL magic properties reference has additional information on using AllegroGraph magic properties and functions.