Quantcast

[gdal-dev] OSM - delineation of rivers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[gdal-dev] OSM - delineation of rivers

Simon Lyngby Kokkendorff
Dear List,

  I have some issues getting river boundaries out of OSM data when using GDAL to read e.g. an OSM xml file downloaded via the overpass API. Using e.g.:

>ogr2ogr -t_srs EPSG:3857 -f SQLITE -dsco SPATIALITE=YES --config OSM_USE_CUSTOM_INDEXING NO map.sqlite map.osm

>ogrinfo --version
GDAL 2.1.0, released 2016/04/25

Specifically I have been trying with the River Thames in London. For some parts of the river it works, and I get features in the 'lines' layer with waterway='riverbank', that are closed. But for many locations I get no features (lines or multlipolygons) that can be used to bound the river - links to some images and OSM data below.

When running the ogr2ogr command, I do get an errror:

ERROR 1: Too many tags in relation 62149,

which is not unusual though..

However, the osm2pqsql tool seems to be able to handle the various cases and I do get nice polygons bounding the river.

Hope that someone can shed some can shed some light on what can be done. Is it a complex situation, that OGR currently cannot handle, or can I tune some parameters or the osmconf.ini file to be able to handle these cases? I am aware that rivers can be tagged in several different ways.



Best Regards and Happy New Year!
Simon Kokkendorff

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OSM - delineation of rivers

Even Rouault-2

On dimanche 1 janvier 2017 18:17:58 CET Simon Lyngby Kokkendorff wrote:

> Dear List,

>

> I have some issues getting river boundaries out of OSM data when using

> GDAL to read e.g. an OSM xml file downloaded via the overpass API. Using

>

> e.g.:

> >ogr2ogr -t_srs EPSG:3857 -f SQLITE -dsco SPATIALITE=YES --config

>

> OSM_USE_CUSTOM_INDEXING NO map.sqlite map.osm

>

> >ogrinfo --version

>

> GDAL 2.1.0, released 2016/04/25

>

> Specifically I have been trying with the River Thames in London. For some

> parts of the river it works, and I get features in the 'lines' layer with

> waterway='riverbank', that are closed. But for many locations I get no

> features (lines or multlipolygons) that can be used to bound the river -

> links to some images and OSM data below.

>

> When running the ogr2ogr command, I do get an errror:

>

> ERROR 1: Too many tags in relation 62149,

>

> which is not unusual though..

 

I've just fixed in trunk this error, but this is not directly related to the issue you have.

 

I presume osm2pgsql is more tolerant when parsing relations where some members are missing. Currently the OGR OSM driver gives up building a multipolygon as soon as a member is missing. This is my hypothesis for the missing geometries (that should be confirmed by identifying the OSM id of the objects imported by osm2pgsql and missing in OGR OSM output)

 

This is for example the case for <relation id="28934"> "River Thames".

 

No solution except improving OGROSMDataSource::BuildMultiPolygon() in ogr/ogrsf_frmts/osm ;-) or extracting a larger extent around the area of interest so that relations aren't truncated.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OSM - delineation of rivers

Simon Lyngby Kokkendorff
Thanks Even,

 I'll try to see if I can fix the issue for that particular location by including a larger area. Was just puzzled because things were working fine at other locations along the river, and for some other rivers, even with a smaller area. But perhaps that's due to river polygons being smaller. 
Also I was cheating a bit with osm2pgsql which was run on a much larger area - since I thought the problem wasn't due to the area being too small. But makes completely sense of course, that this could be the issue - somehow assumed that the overpass API would return all "relevant" features intersecting the bounding box.

Will test a bit more 😄

Cheers,
Simon

Den 01/01/2017 7.41 PM skrev "Even Rouault" <[hidden email]>:

On dimanche 1 janvier 2017 18:17:58 CET Simon Lyngby Kokkendorff wrote:

> Dear List,

>

> I have some issues getting river boundaries out of OSM data when using

> GDAL to read e.g. an OSM xml file downloaded via the overpass API. Using

>

> e.g.:

> >ogr2ogr -t_srs EPSG:3857 -f SQLITE -dsco SPATIALITE=YES --config

>

> OSM_USE_CUSTOM_INDEXING NO map.sqlite map.osm

>

> >ogrinfo --version

>

> GDAL 2.1.0, released 2016/04/25

>

> Specifically I have been trying with the River Thames in London. For some

> parts of the river it works, and I get features in the 'lines' layer with

> waterway='riverbank', that are closed. But for many locations I get no

> features (lines or multlipolygons) that can be used to bound the river -

> links to some images and OSM data below.

>

> When running the ogr2ogr command, I do get an errror:

>

> ERROR 1: Too many tags in relation 62149,

>

> which is not unusual though..

 

I've just fixed in trunk this error, but this is not directly related to the issue you have.

 

I presume osm2pgsql is more tolerant when parsing relations where some members are missing. Currently the OGR OSM driver gives up building a multipolygon as soon as a member is missing. This is my hypothesis for the missing geometries (that should be confirmed by identifying the OSM id of the objects imported by osm2pgsql and missing in OGR OSM output)

 

This is for example the case for <relation id="28934"> "River Thames".

 

No solution except improving OGROSMDataSource::BuildMultiPolygon() in ogr/ogrsf_frmts/osm ;-) or extracting a larger extent around the area of interest so that relations aren't truncated.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OSM - delineation of rivers

Simon Lyngby Kokkendorff
And indeed - worked like a charm when I ran ogr2ogr on a pbf file containing the whole of England. The River Thames is represented nicely, as was the case with osm2pgsql. Was surprisingly fast also compared to osm2pgsql!

So definitely a "too small area" issue!

Thanks again, and sorry for the noise!
Simon
 

On Sun, Jan 1, 2017 at 9:15 PM, Simon Lyngby Kokkendorff <[hidden email]> wrote:
Thanks Even,

 I'll try to see if I can fix the issue for that particular location by including a larger area. Was just puzzled because things were working fine at other locations along the river, and for some other rivers, even with a smaller area. But perhaps that's due to river polygons being smaller. 
Also I was cheating a bit with osm2pgsql which was run on a much larger area - since I thought the problem wasn't due to the area being too small. But makes completely sense of course, that this could be the issue - somehow assumed that the overpass API would return all "relevant" features intersecting the bounding box.

Will test a bit more 😄

Cheers,
Simon

Den 01/01/2017 7.41 PM skrev "Even Rouault" <[hidden email]>:

On dimanche 1 janvier 2017 18:17:58 CET Simon Lyngby Kokkendorff wrote:

> Dear List,

>

> I have some issues getting river boundaries out of OSM data when using

> GDAL to read e.g. an OSM xml file downloaded via the overpass API. Using

>

> e.g.:

> >ogr2ogr -t_srs EPSG:3857 -f SQLITE -dsco SPATIALITE=YES --config

>

> OSM_USE_CUSTOM_INDEXING NO map.sqlite map.osm

>

> >ogrinfo --version

>

> GDAL 2.1.0, released 2016/04/25

>

> Specifically I have been trying with the River Thames in London. For some

> parts of the river it works, and I get features in the 'lines' layer with

> waterway='riverbank', that are closed. But for many locations I get no

> features (lines or multlipolygons) that can be used to bound the river -

> links to some images and OSM data below.

>

> When running the ogr2ogr command, I do get an errror:

>

> ERROR 1: Too many tags in relation 62149,

>

> which is not unusual though..

 

I've just fixed in trunk this error, but this is not directly related to the issue you have.

 

I presume osm2pgsql is more tolerant when parsing relations where some members are missing. Currently the OGR OSM driver gives up building a multipolygon as soon as a member is missing. This is my hypothesis for the missing geometries (that should be confirmed by identifying the OSM id of the objects imported by osm2pgsql and missing in OGR OSM output)

 

This is for example the case for <relation id="28934"> "River Thames".

 

No solution except improving OGROSMDataSource::BuildMultiPolygon() in ogr/ogrsf_frmts/osm ;-) or extracting a larger extent around the area of interest so that relations aren't truncated.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com



_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OSM - delineation of rivers

Andre Joost
Am 01.01.2017 um 22:52 schrieb Simon Lyngby Kokkendorff:
> And indeed - worked like a charm when I ran ogr2ogr on a pbf file
> containing the whole of England. The River Thames is represented nicely, as
> was the case with osm2pgsql. Was surprisingly fast also compared to
> osm2pgsql!
>
> So definitely a "too small area" issue!
>

Alternatively, you can look up the river relation at
http://wiki.openstreetmap.org/wiki/UK_Waterway_Relations and Query only
for that, but complete:

relation(2263653);>>;
out;

HTH,
André Joost


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OSM - delineation of rivers

Simon Lyngby Kokkendorff
Hi Andre,

  Thanks for the tip - I guess there's a lot more that can be done with the overpass API than I'm using right now!
In my case I need to process a lot of square regions (with random center coords). Will try to see if the "river problem" can be fixed by fetching a larger region than needed, or perhaps doing a more advanced query than the simple bounding box one, I'm doing now. Should really look a bit more into the API!

Cheers,
Simon
 


On Mon, Jan 2, 2017 at 7:12 PM, Andre Joost <[hidden email]> wrote:
Am 01.01.2017 um 22:52 schrieb Simon Lyngby Kokkendorff:
And indeed - worked like a charm when I ran ogr2ogr on a pbf file
containing the whole of England. The River Thames is represented nicely, as
was the case with osm2pgsql. Was surprisingly fast also compared to
osm2pgsql!

So definitely a "too small area" issue!


Alternatively, you can look up the river relation at http://wiki.openstreetmap.org/wiki/UK_Waterway_Relations and Query only for that, but complete:

relation(2263653);>>;
out;

HTH,
André Joost


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev


_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Loading...