[gdal-dev] assigning output srs for GML fails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] assigning output srs for GML fails

Martin Landa
Hi,

I was experimenting with OSM OverpassAPI and afterwards fighting with
-a_srs option of ogr2ogr utility:

Esri Shapefile works:

$ ogr2ogr -f GML jena-boundary.gml -a_srs EPSG:4326 \
/vsicurl_streaming/"http://overpass-api.de/api/interpreter?data=%28relation\
%5B%22boundary%22%3D%22administrative%22%5D%5B%22admin%5Flevel%22%3D%226%22%5D%5B%22\
name%22%3D%22Jena%22%5D%3B%29%3B%28%2E%5F%3B%3E%3B%29%3Bout%3B%0A" multipolygons

$ ogrinfo jena-boundary.shp jena-boundary -so
...
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]

while GML doesn't

$ ogr2ogr -f GML jena-boundary.gml -a_srs EPSG:4326
/vsicurl_streaming/"http://overpass-api.de/api/interpreter?data=%28relation\
%5B%22boundary%22%3D%22administrative%22%5D%5B%22admin%5Flevel%22%3D%226%22%5D%5B%22\
name%22%3D%22Jena%22%5D%3B%29%3B%28%2E%5F%3B%3E%3B%29%3Bout%3B%0A" multipolygons

$ ogrinfo jena-boundary.gml multipolygons -so
...
Layer SRS WKT:
(unknown)

Any idea what I am doing wrong? Using GDAL trunk. Thanks in advance, Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: assigning output srs for GML fails

jratike80
Martin Landa wrote
> $ ogrinfo jena-boundary.gml multipolygons -so
> ...
> Layer SRS WKT:
> (unknown)
>
> Any idea what I am doing wrong? Using GDAL trunk. Thanks in advance, Ma

Hi,

By having a look at the data there is only one multipolygon which is
correctly written in EPSG:4326

<ogr:geometryProperty><gml:MultiPolygon srsName="EPSG:4326">

Documentation http://www.gdal.org/drv_gml.html claims that
"Since OGR 1.8.0, the GML driver has coordinate system support. This is only
reported when all the geometries of a layer have a srsName attribute, whose
value is the same for all geometries."

I wonder if reporting does not happen when there is only one geometry but
your GML data are anyway correct.

-Jukka Rahkonen-



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: assigning output srs for GML fails

jratike80
Hi,

I came back to this problem. With your command ogr2ogr is also creating the
.xsd schema file and this case this part of GML driver manual page
http://www.gdal.org/drv_gml.html applies:

FORCE_SRS_DETECTION=YES/NO: (GDAL >=2.0) Force a full scan to detect the SRS
of layers. This option may be needed in the case where the .gml file is
accompanied with a .xsd. Normally in that situation, OGR would not detect
the SRS, because this requires to do a full scan of the file. Defaults to NO

Repeat your command with this open option and ogrinfo reports the SRS:

ogrinfo -so -al jena-boundary.gml -oo FORCE_SRS_DETECTION=YES

Another option is to delete the jena-boundary.xsd file which also forces
GDAL to scan the whole GML file and to detect the SRS by the same. Third
option is to disable the creation of .xsd file by adding -dsco XSISCHEMA=OFF
into your original ogr2ogr command.

-Jukka Rahkonen-




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: assigning output srs for GML fails

Martin Landa
Hi,

2018-01-26 13:03 GMT+01:00 jratike80 <[hidden email]>:

[...]

thanks for your time and explanation.

> Repeat your command with this open option and ogrinfo reports the SRS:
>
> ogrinfo -so -al jena-boundary.gml -oo FORCE_SRS_DETECTION=YES

Works, Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev