orbisgis / h2gis

A spatial extension of the H2 database.
http://www.h2gis.org
GNU Lesser General Public License v3.0
208 stars 63 forks source link

Add new functions to play with Overpass api #1398

Closed ebocher closed 3 weeks ago

ebocher commented 1 month ago

This PR adds new utilities functions to interact with the Overpass api.

Examples

Download osm data as csv file and import it


SELECT ST_OverpassDownloader('out: csv(\"name\")]; area[name=\"Paimpol\"];nwr(area)[railway=station];out;', '/tmp/placenames.csv', true):

SELECT name FROM CSVREAD('/tmp/placenames.csv', null, 'fieldSeparator=\t')

Counting the number of building

select ST_OverpassDownloader(CONCAT('[bbox:', ST_AsOverpassBbox(st_Expand('SRID=4326;POINT(-2.781140 47.643182)'::GEOMETRY, 0.001)), ']', '[out:csv(::count, ::\"count:nodes\", ::\"count:ways\", ::\"count:relations\")][timeout:25];(nwr[building=yes];); out count;'), '/tmp/count_building', true )

ST_AsOverpassBbox function is used to generate the bbox signature.

Plus fix all javadoc