Ticket #4496 (closed defect: invalid)

Opened 3 months ago

Last modified 3 months ago

ogr2ogr: -s_srs and -a_srs trouble

Reported by: peifer Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SRS Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

I must be completely braindead, but I can't figure out what happens below. The actual task is to convert a shapefile into KML. The shapefile has no .prj file, but I know the SRS is EPSG:2169.

Q1: Why is there no coordinate transformation in case 1). I thought -s_srs defines/overrides the source SRS

Q2: Why does it work as expected with -a_srs in case 2 ? I thought -a_srs assigns an output SRS.

Q3: Why is there no coordinate transformation in case 3), while creating a 2nd layer in the KML file, using -a_srs ?

Q4: Why does it again work as expected in case 4), but only after adding both -s_srs epsg:2169 and -t_srs epsg:4326 ? (-t_srs epsg:4326 is usually not needed with the KML driver)

$ ### 1
$
$ ogr2ogr -s_srs epsg:2169 -f kml out.kml LUDH10_290910p.shp -select SITECODE -where fid=1 -nln layer1
Shape: DBF Codepage = LDID/87 for LUDH10_290910p.shp
Shape: Treating as encoding 'ISO-8859-1'.
OGR: OGROpen(LUDH10_290910p.shp/0x1b430e0) succeeded as ESRI Shapefile.
KML: Attempt to create: out.kml
ERROR 1: Latitude 96753.945256 is invalid. Valid range is [-90,90]. This warning will not be issued any more
Warning 1: Longitude 103923.921915 has been modified to fit into range [-180,180]. This warning will not be issued any more
OGR2OGR: 1 features written in layer 'layer1'
Shape: 12 features read on layer 'LUDH10_290910p'.
GDAL: In GDALDestroy - unloading GDAL shared library.
$
$
$ ### 2
$
$ ogr2ogr -a_srs epsg:2169 -f kml out.kml LUDH10_290910p.shp -select SITECODE -where fid=1 -nln layer1
Shape: DBF Codepage = LDID/87 for LUDH10_290910p.shp
Shape: Treating as encoding 'ISO-8859-1'.
OGR: OGROpen(LUDH10_290910p.shp/0xa130e0) succeeded as ESRI Shapefile.
KML: Attempt to create: out.kml
OGRCT: Source: +proj=tmerc +lat_0=49.83333333333334 +lon_0=6.166666666666667 +k=1 +x_0=80000 +y_0=100000 +ellps=intl +towgs84=-189.681,18.3463,-42.7695,-0.33746,-3.09264,2.53861,0.4598 +units=m +no_defs
OGRCT: Target: +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs
OGR2OGR: 1 features written in layer 'layer1'
Shape: 12 features read on layer 'LUDH10_290910p'.
GDAL: In GDALDestroy - unloading GDAL shared library.
$
$
$ ### 3
$
$ ogr2ogr -a_srs epsg:2169 -f kml out.kml LUDH10_290910p.shp -select SITECODE -where fid=1 -nln layer2 -update -append
Shape: DBF Codepage = LDID/87 for LUDH10_290910p.shp
Shape: Treating as encoding 'ISO-8859-1'.
OGR: OGROpen(LUDH10_290910p.shp/0x13540e0) succeeded as ESRI Shapefile.
OGR: OGROpen(out.kml/0x1355c60) succeeded as LIBKML.
OGR2OGR: 1 features written in layer 'layer2'
Shape: 12 features read on layer 'LUDH10_290910p'.
GDAL: In GDALDestroy - unloading GDAL shared library.
$
$
$ ### 4
$
$ ogr2ogr -s_srs epsg:2169 -t_srs epsg:4326 -f kml out.kml LUDH10_290910p.shp -select SITECODE -where fid=1 -nln layer3 -update -append
Shape: DBF Codepage = LDID/87 for LUDH10_290910p.shp
Shape: Treating as encoding 'ISO-8859-1'.
OGR: OGROpen(LUDH10_290910p.shp/0x24980e0) succeeded as ESRI Shapefile.
OGR: OGROpen(out.kml/0x2499cb0) succeeded as LIBKML.
OGRCT: Source: +proj=tmerc +lat_0=49.83333333333334 +lon_0=6.166666666666667 +k=1 +x_0=80000 +y_0=100000 +ellps=intl +towgs84=-189.681,18.3463,-42.7695,-0.33746,-3.09264,2.53861,0.4598 +units=m +no_defs
OGRCT: Target: +proj=longlat +datum=WGS84 +no_defs
OGR2OGR: 1 features written in layer 'layer3'
Shape: 12 features read on layer 'LUDH10_290910p'.
GDAL: In GDALDestroy - unloading GDAL shared library.
$

Attachments

out.kml Download (1.9 KB) - added by peifer 3 months ago.

Change History

Changed 3 months ago by peifer

Changed 3 months ago by rouault

  • status changed from new to closed
  • resolution set to invalid

Questions are not appropriate for Trac tickets. The should be asked on the ML where they have more visibility and where answers can be seen by more people.

Note: See TracTickets for help on using tickets.