[Gdal-dev] Measured Values for Shapefile read & write

Frank Warmerdam warmerdam at pobox.com
Thu Jul 26 10:29:31 EDT 2007


Nelson, Dean wrote:
> Frank, et al,
> 
> I agree - its not a datum issue here.
> 
> I have tried the solution suggested by Frank with no change in the
> results. However, in delving deeper into the data for this particular
> project, it appears that all of this data is off about 10 min in Lat. I
> can't explain it - so I'll ask the source: USGS - which may prove to be
> a daunting task for a whimp like me.
> 
> In the mean time I would like to know a few techniques to get me through
> the day:
> 
> 1. If I have a shape file that is 10 min off in lat, how can I shift it
> to the right spot with the GDAL/OGR tools? Or do I need to write a
> little code?

Dean,

The vec_tr.py script can be used to to shift or scale vectors.

   http://trac.osgeo.org/gdal/browser/trunk/gdal/pymod/samples/vec_tr.py

You will need to edit the TransformPoint() function in the python script
to modify the point(s) as you wish:

def TransformPoint( xyz ):

     x = xyz[0]
     y = xyz[1]
     z = xyz[2]

     x = x + 1000

     return (x,y,z)

Just replace the x = x + 1000 line with whatever you want.

> Since I am dealing with 1km resolution hydrology basins, accuracy is not
> a huge concern.
> 
> 2. When I reproject with ogr2ogr, the data come out 0-360 longitude. How
> can I make it +-180?

Gee, you are raising hard issues.  Try setting the CENTER_LONG configuration
variable before the reprojection.  This is supposed to trigger "rewrapping"
of longitudes around an alternate center.

eg.

ogr2ogr -t_srs WGS84 --config CENTER_LONG 0 out.shp in.shp

But I'm surprised you are getting 0-360 output from ogr2ogr reprojection.
It normally defaults to -180 to 180.  I wonder if something odd is going
on.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list