Skip to content

Precision loss when applying geof:longitude or geof:latitude #2165

@hannahbast

Description

@hannahbast

The following query on the OSM data https://qlever.cs.uni-freiburg.de/osm-planet/xCerw9

SELECT ?osm_id ?geometry ?lng ?lat WHERE {
  osmrel:62768 ogc:sfContains ?osm_id .
  ?osm_id rdf:type osm:node .
  ?osm_id geo:hasGeometry/geo:asWKT ?geometry .
  BIND (geof:longitude(?geometry) AS ?lng) .
  BIND (geof:latitude(?geometry) AS ?lat) .
}
LIMIT 3

returns the following result:

| ?osm_id | ?geometry | ?lng | ?lat |
| osmnode:10003156787 | POINT(7.854637 48.017093) | 7.85464 | 48.0171 |
| osmnode:10004601576 | POINT(7.830281 48.002005) | 7.83028 | 48.002 |
| osmnode:10005201820 | POINT(7.821752 48.003969) | 7.82175 | 48.004 |

@ullingerc Do you understand where the precision loss comes from? In my understanding the POINT(... ...) is already rounded due to QLever's limited precision for points. But why is that rounded result rounded again when applying geof:longitude or geof:latitude?

PS: It seems that the precision of all our doubles is only four digits after the dot https://qlever.cs.uni-freiburg.de/wikidata/6n45iu

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions