[FWTools] DD to UTM conversion in c#

Tamas Szekeres szekerest at gmail.com
Thu Dec 3 15:56:49 EST 2009


Hi,

Did you inspect your application with FileMon as it has been suggested in
the thread you mentioned? You may find some other dll-s that couldn't be
loaded at run time in the FileMon file access log.

Best regards,

Tamas



2009/12/3 sebastien DECORME <sebastien.decorme at survey-copter.com>

>  HI
>
> I want to make Degre to UTM conversion with the OSR/GDAL library (anything
> else I’ve no choice)
>
> I’m looking on the web for 3 days to find a way to make this.
>
>
>
> I’ve downloaded  the FWtools 2.4.6
>
> I’ve add to my project all the dll in the directory
>
> C:\Program Files\FWTools2.4.6\csharp
>
>
>
> I add in the path
>
> C:\Program Files\FWTools2.4.6\bin
>
>
>
> And my very simple test program look like this
>
>
>
> using System;
>
> using System.Collections.Generic;
>
> using System.ComponentModel;
>
> using System.Data;
>
> using System.Drawing;
>
> using System.Text;
>
> using System.Windows.Forms;
>
> using OSGeo.OSR;
>
>
>
> namespace UTM_GEO
>
> {
>
>     public partial class Form1 : Form
>
>     {
>
>
>
>         SpatialReference oUTM = new SpatialReference("");
>
>         SpatialReference oWGS = new SpatialReference("");
>
>
>
>         public Form1()
>
>         {
>
>             InitializeComponent();
>
>         }
>
>         private int FindUtmZone(double Longitude)
>
>         {
>
>             int retour = -1;
>
>             retour = Convert.ToInt16 ((Longitude - (-180)) / 6 + 1);
>
>             return retour;
>
>         }
>
>         private void BtnToUTM_Click(object sender, EventArgs e)
>
>         {
>
>             double Longitude = Convert.ToDouble(TxtGeoLon.Text);
>
>             int ZoneUTMCourante = FindUtmZone(Longitude);
>
>
>
>             string NomProj = "UTM " + ZoneUTMCourante.ToString() + " /
> WGS84";
>
>
>
>             oUTM.SetProjCS(NomProj);
>
>             oUTM.SetWellKnownGeogCS( "WGS84" );
>
>         }
>
>     }
>
> }
>
>
>
> I’ve an error at this line
>
> SpatialReference oUTM = new SpatialReference("");
>
>
>
> The type initializer for 'OSGeo.OSR.OsrPINVOKE' threw an exception.".
>
> The innermost exception is what you'd expect - "System.*
> DllNotFoundException*: Unable *to* *load* *DLL*
> '*osr_wrap*': The operating system *cannot* run."
>
>
>
> I’ve tested this link
>
>
> http://n2.nabble.com/using-OGR-OSR-from-C-where-to-put-the-dependent-DLLs-td2032457.html
>
>
>
> but it doesn’t work at all.
>
>
>
>
>
> Please I need help
>
>
>
> Thanks
>
>
>
> Sébastien DECORME
>
>
>
>
>
> _______________________________________________
> FWTools mailing list
> FWTools at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/fwtools
> http://fwtools.maptools.org/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20091203/09804641/attachment.htm 


More information about the FWTools mailing list