[Proj] cs2cs and Visual Basic .NET
Jim Mace
jmace at benchmarkrs.com
Sat May 12 14:32:32 EDT 2007
I am doing something somewhat similar using ogr2ogr to convert shapedfiles
from one projection to another from the command line. I am using C#, but
you should be able to easily convert this to VB.net without much trouble.
Among other things the GeoSpatial class contains the proj strings that I use
to convert points from one projection, spatial reference to the other. They
are represented by the enumerators EPGS.Albers and EPGS.Mercator. There's
also another one that I use, EPGS.WGS84. This is verifiable code, so the
conversions work correctly. I am using SharpMap to display the shapefile on
top of Virtual Earth, and everything lines up correctly.
String oldFilePath = @"C:\farsite4\examples\ashley\Output\ash1_perim2.shp";
String newFilePath =
@"C:\Inetpub\Websites\firesite_us\App_Data\VEMercatorPerimeter.shp";
GeoSpatial spatial = new GeoSpatial();
ProcessStartInfo psi = new ProcessStartInfo(@"C:\Program
Files\FWTools1.2.2\bin\ogr2ogr.exe",
" -s_srs \"" +spatial.GetEPGS(GeoSpatial.EPGS.Albers)+ "\" -t_srs
\"" + spatial.GetEPGS(GeoSpatial.EPGS.Mercator)+ "\" "+ newFilePath + "
" + oldFilePath);
Process.Start(psi);
I hope this helps...
Jim
-----Original Message-----
From: proj-bounces at lists.maptools.org
[mailto:proj-bounces at lists.maptools.org] On Behalf Of Tamas Szekeres
Sent: Saturday, May 12, 2007 11:17 AM
To: PROJ.4 and general Projections Discussions
Subject: Re: [Proj] cs2cs and Visual Basic .NET
If you want to use cs2cs exterally, you might use the
System.Diagnostics.Process to spawn cs2cs in your application.
If you want to implement similar functionality internally you might
use the SpatialReference and GeoTransformation classes from the
GDAL/OGR .NET API. You might add a reference to ogr_csharp.dll or
osr_csharp.dll in your application.
The FWTools package contains the binaries for using this functionality.
http://test.gdal.org/fwtools/FWTools130.exe
Best regards,
Tamas Szekeres
2007/5/12, Leonidas <leonidas_liakos at yahoo.gr>:
> How can I use cs2cs in my Visual Basic .NET?
>
> _______________________________________________
> Proj mailing list
> Proj at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/proj
>
_______________________________________________
Proj mailing list
Proj at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/proj
--
I am using the free version of SPAMfighter for private users.
It has removed 14339 spam emails to date.
Paying users do not have this message in their emails.
Get the free SPAMfighter here: http://www.spamfighter.com/len
More information about the Proj
mailing list