[gdal-dev] Re: Calling OGR.SpatialReference.ImportFromWKT from vb.NET

Tamas Szekeres szekerest at gmail.com
Tue Jul 8 05:19:55 EDT 2008


Hi,

You cannot use ImportFromWkt at the moment due to a missing typemap in
the C# bindings. You might want to submit a ticket
http://trac.osgeo.org/gdal/newticket and I'll take care of
implementing it.

For an equivalent solution, you could also use the SpatialReference
constuctor that accepts the wkt as the constructor in the signature
below:

public SpatialReference(string wkt)

Best regards,

Tamas



2008/7/8 Ackerman, Cameron T HEC <Cameron.Ackerman at usace.army.mil>:
>
> Tamas:
>
> I received a bounce back from the list, stating  I am unable to post to the
> mailing list.  I was unable to identify the need to create an account or sign
> up in order to post.  Please see below...
>
> cam
>
> -----Original Message-----
> From: Ackerman, Cameron T HEC
> Sent: Monday, July 07, 2008 4:43 PM
> To: gdal-dev at lists.osgeo.org
> Cc: Smith, Michael ERDC-CRREL-NH
> Subject: Calling OGR.SpatialReference.ImportFromWKT from vb.NET
>
> Hi Dev Team:
>
> I'm struggling with the usage of the OGR.SpatialReference.ImportFromWKT
> method.  I would like to generate a Spatial Reference from a file or string.
>
> The ImportFromWkt method uses a SWIGTYPE_p_p_char type, which I cannot figure
> out how to generate.
>
> Sample code looks something like this:
>    Dim fn As String = dataPath & "\" & "epsg_3785.wkt"
>    Dim r As New System.IO.StreamReader(fn)
>    Dim wkt As String = r.ReadToEnd()
>    Dim sr As New OSGeo.OGR.SpatialReference("")
>
>    Dim argh As New OSGeo.OGR.SWIGTYPE_p_p_char
>    argh = CChar(sr)
>
>    sr.ImportFromWkt(argh)
>
> Thanks for any insight.
> As you can see from the above, I'm trying to create a spatial reference
> for EPSG code 3785 (which isn't supported currently when trying the
> ImportFromEPSG).
>
> Thanks,
> cam
>
>
> Cameron T. Ackerman, P.E., D.WRE
> Hydraulic Engineer
> US Army Corps of Engineers, Institute for Water Resources
> Hydrologic Engineering Center, CEIWR-HEC
> 609 Second St., Davis CA 95616
> 530.756.1104
>
> cameron.t.ackerman at usace.army.mil
> www.hec.usace.army.mil
>
>


More information about the gdal-dev mailing list