# Cannot get geof:distance calculated

**URL:** <https://community.stardog.com/t/cannot-get-geof-distance-calculated/1576>\
**Category:** Support\
**Created:** [April 5, 2019, 4:09pm UTC](https://community.stardog.com/t/cannot-get-geof-distance-calculated/1576 "2019-04-05T16:09:10Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![dlbis](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/dlbis/32/721_2.png) [@dlbis](https://community.stardog.com/u/dlbis)\
**Post date:** [April 10, 2019, 12:40pm UTC](https://community.stardog.com/t/cannot-get-geof-distance-calculated/1576/15 "2019-04-10T12:40:55Z")

</div>

**I have solved my problem** but it was hard to do. In fact, I was using an INSERT syntax that does not seem to work for geospatial even if it is working for the standard query. I cannot explain why but if someone can explain, I would appreciate.

**The triples produced with both insert statements are exactly the same.** I am sure that the two inserts are not exactly doing the same thing however. Internally, there must be a diiference but what exactly? I have included that comparison at the end of this text.

**(1) How I have first inserted my geospatial triples** (this is for Geometry but I was doing lat and long the same way). With those triples I was **not able to calculate the distance.**

with \<[http://cdpq.com/rcagraph\_geo\_c2&gt](http://cdpq.com/rcagraph_geo_c2&gt);  
insert  
{?s ?p ?o}  
using \<[http://cdpq.com/rcagraph&gt](http://cdpq.com/rcagraph&gt);  
where {  
values(?city) {("Montreal")}  
values(?p) {(rdf:type)}  
values(?o) {(geo:Geometry)}  
?prop onto:Property-cityName ?city .  
?prop onto:Property-id ?id .  
bind(iri(concat("[http://www.cdpq.com/PropertyGeom/](http://www.cdpq.com/PropertyGeom/)", str(?id))) as ?s)

}

**(2) How I have finally inserted my geospatial triples** and **got the distance calculated**.

insert { graph [http://cdpq.com/rcagraph\_geo\_c4](http://cdpq.com/rcagraph_geo_c4) { ?s ?p ?o} }  
where {  
graph [http://cdpq.com/rcagraph](http://cdpq.com/rcagraph)  
{  
values(?city) {("Montreal")}  
values(?p) {(rdf:type)}  
values(?o) {(geo:Geometry)}  
?prop onto:Property-cityName ?city .  
?prop onto:Property-id ?id .  
bind(iri(concat("[http://www.cdpq.com/PropertyGeom/](http://www.cdpq.com/PropertyGeom/)", str(?id))) as ?s)  
}  
}

**(3) The tiples comparison. For graph c2, I was not able to get the distance calculated but for c4, I can.**

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/25c191a73f38721ab4f95455542d8a15000e5361.png)

---

_[View the full topic](https://community.stardog.com/t/cannot-get-geof-distance-calculated/1576)._
