<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Verdana">Dear Tamas,<br>
<br>
Thank you for the response! I did as you described. Downloaded FWtools
and added a reference to ogr_csharp to my project.<br>
<br>
I then copied a small piece of code from one of the csharp samples and
translated it to VB.net<br>
<br>
In the start of my module I added the line:<br>
Imports OGR<br>
<br>
And then in my test-routine, I created the following:<br>
<br>
'/*
-------------------------------------------------------------------- */<br>
'/* Initialize
srs */<br>
'/*
-------------------------------------------------------------------- */<br>
Dim src As SpatialReference<br>
src = New SpatialReference("")<br>
src.ImportFromProj4("+proj=latlong +datum=WGS84
+no_defs")<br>
Debug.Print("SOURCE IsGeographic:" +
src.IsGeographic() + " IsProjected:" + src.IsProjected())<br>
Dim dst As SpatialReference<br>
dst = New SpatialReference("")<br>
dst.ImportFromProj4("+proj=somerc
+lat_0=47.14439372222222 +lon_0=19.04857177777778 +x_0=650000
+y_0=200000 +ellps=GRS67 +units=m +no_defs")<br>
Debug.Print("DEST IsGeographic:" +
dst.IsGeographic() + " IsProjected:" + dst.IsProjected())<br>
'/*
-------------------------------------------------------------------- */<br>
'/* making the
transform */<br>
'/*
-------------------------------------------------------------------- */<br>
Dim ct As CoordinateTransformation = New
CoordinateTransformation(src, dst)<br>
Dim p(3) As Double<br>
p(0) = 19<br>
p(1) = 47<br>
p(2) = 0<br>
ct.TransformPoint(p)<br>
Debug.Print("x:" + p(0) + " y:" + p(1) + " z:"
+ p(2))<br>
ct.TransformPoint(p, 19.2, 47.5, 0)<br>
Console.WriteLine("x:" + p(0) + " y:" + p(1) +
" z:" + p(2))<br>
<br>
At design time, VB.net has no errors or warnings, but when I run the
application in Debug mode it halts on the line stating:<br>
<br>
</font><font face="Verdana"> src = New
SpatialReference("")<br>
<br>
The message I get is:<br>
The type initializer for 'OGR.osrPINVOKE' threw
an exception.<br>
<br>
<br>
Anyone had this before? Can It be that the OGR_csharp cannot find my
proj files or something?<br>
<br>
Kind regards,<br>
<br>
Milo van der Linden</font><br>
</body>
</html>