GeoSPARQL 是否提供计算两个线串之间距离的功能?(编辑:我正在使用带有 GeoSPARQL 扩展的 Jena Fuseki。)
结果没有按预期工作。
线串查询,假设所有几何图形也是线串:
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
prefix ogis: <http://www.opengis.net/def/uom/OGC/1.0/>
select * where {
?s geo:hasGeometry ?f .
?f geo:asWKT ?wkt.
BIND(geof:distance(?wkt,
"<http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.8 -87.6,41.8 -87.5)"^^geo:wktLiteral,
ogis:kilometre) as ?distance)
}
ORDER BY asc(abs(?distance))
相反,如果我计算点之间的距离,那么这将按预期工作。
点,假设所有的几何图形也是点:
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix geof: <http://www.opengis.net/def/function/geosparql/>
prefix ogis: <http://www.opengis.net/def/uom/OGC/1.0/>
select * where {
?s geo:hasGeometry ?f .
?f geo:asWKT ?wkt .
BIND(geof:distance(?wkt,
"<http://www.opengis.net/def/crs/EPSG/0/27700> POINT(41.8 -87.6)"^^geo:wktLiteral,
ogis:kilometre) as ?distance)
}
ORDER BY asc(abs(?distance))
那么点到线的距离呢,反之亦然?
编辑:这是给定我的数据集的线对线搜索的结果。距离显然是错误的。这些线通常不超过几公里,但所有这些结果都显示为小于 1 公里。例如,最后一个结果显示为 0.35KM,但它在路易斯安那州,而原始点在伊利诺伊州。
同样,这些结果来自带有 GeoSPARQL 扩展的 Jena Fuseki。
select ?wkt ?distance where {
?s a sosa:featureOfInterest .
?s geo:hasGeometry ?f .
?f geo:asWKT ?wkt.
BIND(geof:distance(?wkt,
"<http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.85003 -87.65005,41.85 -87.65)"^^geo:wktLiteral,
ogis:kilometre) as ?distance) .
}
ORDER BY asc(abs(?distance))
limit 10
指数 | wkt.value | 距离值 |
---|---|---|
0 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(46.7082 -89.9785,46.7 -89.9892) | 0.168957e0 |
1 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(46.699902 -89.989067,46.669998 -90.046654) | -0.186799e0 |
2 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.84 -87.607,41.839 -87.605) | 0.205283e0 |
3 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.865 -87.607,41.863 -87.607) | 0.208798e0 |
4 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(46.708 -89.978,46.7096 -89.9749) | 0.246481e0 |
5 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.894 -87.614,41.894 -87.612) | 0.26358e0 |
6 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.904 -87.624,41.902 -87.622) | 0.272661e0 |
7 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.8234 -87.5966,41.8215 -87.595) | 0.278589e0 |
8 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(41.924 -87.63,41.914 -87.62) | 0.326035e0 |
9 | <http://www.opengis.net/def/crs/EPSG/0/27700> LINESTRING(29.226625 -90.001852,29.211947 -90.026484) | -0.353463e0 |