[gdal-dev] Bad result when writing into KML without -t_srs

Even Rouault even.rouault at mines-paris.org
Fri Jun 7 02:33:07 PDT 2013


Selon Jukka Rahkonen <jukka.rahkonen at mmmtike.fi>:

> Andre Joost <andre+joost <at> nurfuerspam.de> writes:
>
> >
> > Am 07.06.2013 01:26, schrieb Jukka Rahkonen:
> >
> > >
> > > The result is good if I add parameter -t_srs epsg:4326. However, this
> should
> > > be unnecessary with KML because it is always EPSG:4326 and also the
> driver
> > > manual page http://www.gdal.org/ogr/drv_kml.html claims the same in the
> text
> > > and in the examples.
> >
> > +1, the same should go for the GPX driver.
>
> Herman Peifer wrote but forgot to send to the list:
>
> " Jukka,
> Could you please try with -a_srs epsg:2393 instead of -s_srs epsg:2393,
> see http://trac.osgeo.org/gdal/ticket/4496"
>
> This is funny, but using -a_srs:2393 in the command really leads to correct
> result. Following command, even being all wrong with the a_srs, gives good
> KML and it also overrides the erroneous prj file.
>
> ogr2ogr -f KML -a_srs epsg:2393  test6.kml test_region.shp

This is also explainable by ogr2ogr and the KML driver works. -a_srs attaches a
SRS to the feature that is passed to the output driver (overriding the SRS of
the source feature if existing). The KML driver has a very unique behaviour in
which it takes into account the SRS of the features that are passed to it to do
reprojection to EPSG:4326 if needed. Said differently the KML driver has some
sort of -s_srs -t_srs mechanism integrated into it.

You could do weird things like:

ogr2ogr -f KML -s_srs EPSG:3857 -t_srs EPSG:32632 out.kml src_4326.shp and it
would do EPSG:3857 --> EPSG:32632 in ogr2ogr, and then EPSG:32632 --> EPSG:4326
in the KML driver ...


>
> -Jukka Rahkonen-
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list