[Proj] Shapefile conversions

Frank Warmerdam warmerdam at pobox.com
Fri Apr 13 13:43:30 EDT 2007


Jim Mace wrote:
> Just out of curiosity, will OSR convert a shapefile from one projection or
> coordinate system to another projection or cordon system?  If not, what
> other options/tools are available for me to do this?  I am writing a Web
> application in C#, so something in .NET would be extra helpful, if not, I
> can always invoke a commandline tool; speaking of that, which one would I
> use?  I have a shapefile that is in Albers Equal Area that I need to convert
> to Mercator that I can lay on top of Virtual Earth, any ideas?

Jim,

As mentioned, you can use ogr2ogr at the commandline.

You can also implement something similar in C#.  Of key interest would be
the Transform() method on the Geometry class.  You pass in an
OSRCoordinateTransformation object and the geometry is transformed in
place.

The shapefile driver for OGR supports writing features back where they came
from so you should be able to iterate through the shapefile reading features,
doing the Transform() on their geometries, and then using SetFeature() to
write the feature and it's geometry back in the file.

All of this isn't really very PROJ.4 oriented though.  If you need followup
help the place to go would be the gdal-dev list.

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 Proj mailing list