opengeospatial / ogc-geosparql

Public Repository for the OGC GeoSPARQL Standards Working Group
78 stars 20 forks source link

New function suggestion: lineMerge #402

Open SimonBin opened 1 year ago

SimonBin commented 1 year ago

As per https://github.com/opengeospatial/ogc-geosparql/issues/257#issuecomment-1428705510

We would like to suggest to have a geof:lineMerge function in the standard, ( that could be used together with the collect function suggested by us in #400 ) .

Here is a sample query where we would like to use it, to assemble river line pieces from Openstreetmap into a single-(multi-)line river geometry:

SELECT (geof:lineMerge(geof:collect(?way_geom)) as ?elbe_geom) WHERE {
 ?s a osm:relation .
 ?s osmkey:name:de "Elbe" .
 ?s osmrel:member/osm:id ?m .
 ?m geo:hasGeometry/geo:asWKT ?way_geom
}

Our implementation can be found here: https://github.com/Scaseco/jenax/blob/jena-4.8.0/jenax-arq-parent/jenax-arq-plugins-parent/jenax-arq-plugins-bundle/src/main/java/org/aksw/jena_sparql_api/sparql/ext/geosparql/GeoSparqlExFunctions.java#L94

VladimirAlexiev commented 11 months ago

@SimonBin Can you specify more precisely input/output conditions? My guesses:

SimonBin commented 10 months ago

hi @VladimirAlexiev and thank you for your interest, similar to what you guessed, this is what we implemented:

as you can see, our implementation is just a wrapper to JTS LineMerger + OverlayNGRobust.union