#3941 closed defect (invalid)
GeoJSON to GPX fails on mixed features
Reported by: | vibrog | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | 1.8.0 |
Severity: | normal | Keywords: | gpx, geojson, ogr2ogr |
Cc: |
Description
I'm using ogr2ogr to convert GeoJSON created by OpenLayers 2.10, and it fails when the GeoJSON contains a mix of Points and LineStrings. But GeoJSON with only one feature type at a time works fine. Is this an expected behaviour?
Change History (3)
comment:1 by , 12 years ago
Milestone: | 1.8.1 |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:2 by , 12 years ago
should i expect this to work, e.g. throw away Points if any?
ogr2ogr -f GPX stdout your.geojson \ -sql "select * from OGRGeoJSON where OGR_GEOMETRY = 'LINESTRING'"
Note:
See TracTickets
for help on using tickets.
Yes this is expected behaviour and not much can be done to improve that. This is mainly due to the structure of GPX files where points must be written before lines to validate the XML schema, so if they appear in random order in the GeoJSON, this is bound to fail.
More details in the "Creation issues" section of http://gdal.org/ogr/drv_gpx.html
You could workaround this by doing something like :