[Qgis-user] ogr2ogr - how to use -s_srs, -t_srs and -a_srs
Erik Josefsson
erik.hjalmar.josefsson at gmail.com
Sun Aug 6 03:41:15 PDT 2017
On 06/08/17 11:07, Erik Josefsson wrote:
> I'm still puzzled how I can tell ogr2ogr to convert the coordinates
> themselves along with the conversion of the CRS (e.g. from EPSG:3008 to
> EPSG:3006).
As far as I can tell, I can do this manually by opening a shapefile in
QGIS, right-click on it in the 'Layers Panel' and then 'Save as..' with
a CRS of my choice.
Below is the output of ogrinfo on the same shape file (with EPSG:3008)
saved as EPSG:4326 and EPSG:3021.
Both CRS and coordinate values are transformed.
How can I automate this procedure? Do I need another tool than org2org?
Best regards.
//Erik
$ ogrinfo -ro -where 'OBJECTID=49426' EPSG-4326.shp EPSG-4326
Layer name: EPSG-4326
Metadata:
DBF_DATE_LAST_UPDATE=2017-08-06
Geometry: Polygon
Feature Count: 1
Extent: (8.859434, 55.378666) - (9.111502, 55.513778)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_84",6378137,298.257223563]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]]
OBJECTID: Integer (9.0)
Z: Real (19.11)
Shape_Leng: Real (19.11)
Shape_Area: Real (19.11)
OGRFeature(EPSG-4326):49425
OBJECTID (Integer) = 49426
Z (Real) = -9999.00000000000
Shape_Leng (Real) = 32.97354794050
Shape_Area (Real) = 66.76357026070
POLYGON ((8.88319200568137 55.4620835914118,8.88314316961931
55.4620209192755,8.883041432223 55.4620465429612,8.88304105670949
55.4620472768744,8.88308858848231 55.4621093875035,8.88308815492843
55.462109495417,8.88309945070374 55.4621235826654,8.88320302259786
55.4620977294928,8.88319200568137 55.4620835914118))
$ ogrinfo -ro -where 'OBJECTID=49426' EPSG-3021.shp EPSG-3021
Layer name: EPSG-3021
Metadata:
DBF_DATE_LAST_UPDATE=2017-08-06
Geometry: Polygon
Feature Count: 1
Extent: (1060479.601130, 6160240.975371) - (1076902.137361, 6174997.367106)
Layer SRS WKT:
PROJCS["RT90_2_5_gon_V",
GEOGCS["GCS_RT90",
DATUM["Rikets_koordinatsystem_1990",
SPHEROID["Bessel_1841",6377397.155,299.1528128]],
PRIMEM["Greenwich",0],
UNIT["Degree",0.017453292519943295]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",15.80827777777778],
PARAMETER["scale_factor",1],
PARAMETER["false_easting",1500000],
PARAMETER["false_northing",0],
UNIT["Meter",1]]
OBJECTID: Integer (9.0)
Z: Real (19.11)
Shape_Leng: Real (19.11)
Shape_Area: Real (19.11)
OGRFeature(EPSG-3021):49425
OBJECTID (Integer) = 49426
Z (Real) = -9999.00000000000
Shape_Leng (Real) = 32.97354794050
Shape_Area (Real) = 66.76357026070
POLYGON ((1062512.81975137 6169859.08391644,1062509.04258109
6169852.43297944,1062502.90848284 6169855.92025343,1062502.89294275
6169856.00411689,1062506.58159636 6169862.60092988,1062506.55544172
6169862.61564856,1062507.4245609 6169864.10861451,1062513.67183986
6169860.58428774,1062512.81975137 6169859.08391644))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 533 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170806/d045713f/attachment.sig>
More information about the Qgis-user
mailing list