2010-03-27

six million problem...

repetition est mater studiorum.

In Latvia we have historical problems with coordinate systems. Some times we need to work in one of them, some times in other.

This ir how to set coordinate systems from one to another

I have shp file in LKS coordinates. I need to make false north 60000000.

1)Let`s set the coordinate system in file we`re working to.

ogr2ogr -a_srs EPSG:3059 /media/kratuve/gis_latvija/ARC_hydro/auce/lauks_LKS.shp /media/kratuve/gis_latvija/ARC_hydro/auce/lauks.shp


2)Let`s transfer coordinate system to WGS CoordSys.

ogr2ogr -t_srs EPSG:2100 /media/kratuve/gis_latvija/ARC_hydro/auce/lauks_WGS.shp /media/kratuve/gis_latvija/ARC_hydro/auce/lauks_LKS.shp



For raster data we can use gdalwarp instead of ogr2ogr

Interesting artefacts about ogr2ogr and gdalwarp.
Using previous example with vector data (ogr2ogr), the data transformed correctly. But when I used the same parameters in gdalwarp, the data were transformed to the north, but they were incorrectly transformed. I tried hardcoded transformation.

1)First by setting known coordinate system for file
gdalwarp -s_srs "+proj=tmerc +lat_0=0 +lon_0=24 +k=0.99960
0 +x_0=500000 +y_0=-6000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" /media/kratuve/gis_latvija/ARC_hydro/auce/"$inputFileName".tif /media/kratuve/gis_latvija/ARC_hydro/auce/"$outputFileName"_CH.tif

2)Second transform the coordinate system by adding (or in this case subtracting, because in previous step false northing [y0] is -6M) 60000000
gdalwarp -t_srs "+proj=tmerc +lat_0=0 +lon_0=24 +k=0.99960
0 +x_0=500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" /media/kratuve/gis_latvija/ARC_hydro/auce/"$outputFileName"_CH.tif /media/kratuve/gis_latvija/ARC_hydro/auce/"$outputFileName"_TR.tif


and it worked fine for me.



References:
http://www.gisnet.lv/gisnet/2007/03/datu-parprojicesana-ar-gdalogr/
http://www.gisnet.lv/gisnet/2007/04/sesu-miljonu-opera/

Additional info - bash script sample
http://paste.php.lv/eddccdff78d0d0f0a565561ce83bc6fb?lang=bash

Nav komentāru:

Ierakstīt komentāru