[gdal-dev] .NET and OGR writing to stream

Tamas Szekeres szekerest at gmail.com
Tue May 29 01:41:18 PDT 2012


VSIF* functions are not properly mapped to the C# bindings, VSIFReadL
has python specific implementation only, as far as I see.
I'm not sure whether this API should officially be published or not,
since I don't remember about an RFC or a ticket about the expected
requirements and type mapping suggestions (README.typemaps) or
examples.

Best regards,

Tamas



2012/5/29 Geoff Burns <geoffrey.peter.burns at gmail.com>:
> Just reading through this thread about GDAL, C# and memory streams as
> I have a similar problem.
>
> The thread seemed to end on a positive note with Maksim Sestic and
> Even Rouault seeming to reach a conclusion.
>
> However when I started using the API's Maksim & Even where discussing
> I found that Gdal.VSIFWriteL took a string instead of byte[] and
> Gdal.VSIFReadL did not seem to exist.
>
> Tamas's suggestion of reading data into a byte array will not work for
> me as I would have to write the GeoTiff data to disk in reorder to
> read it into the byte array in order to manipulate it in memory which
> seems wasteful.
>
> I reached an impasse.
>
> Surely other people in the .NET world want use GDAL without hitting
> the disk whenever they want to generate or transform data.
>
> Does anyone have any experience in getting the csharp GDAL API's to
> talk to memory instead of disk?
>
> Regards,
> Geoff
>
> -----Original Message-----
>> 2011/8/03 Maksim Sestic
>>
> Hi Even,
>
> That's exactly what I was looking for. Yes, Gdal.VSIF* managed bindings are
> there. Alas, I've been looking for them under Ogr methods :-)
>
> Regards,
> Maksim Sestic
>
>
> -----Original Message-----
> From: Even Rouault
> Subject: RE: [gdal-dev] .NET and OGR writing to stream
>
>
>> Hi Tamas,
>>
>>
>>
>> I don't know how to apply the same principle onto OGR drivers (not GDAL).
>> I'm trying to create GML structure in memory using OGR driver, then handle
>> resulting XML string further. Don't want to write dataset to a file, then
>> read the file back to a string.
>
> With the OGR GML driver, you can write to /vsimem/some.gml for example. And
> then
> you should be able to read that in-memory file with gdal.VSIFOpenL() and
> read
> its content with gdal.VSIFReadL(). However I'm not sure that the C# bindings
> have been updated to support those VSIF*L functions.
>
> There are examples of you to use those API in Python there :
> http://trac.osgeo.org/gdal/browser/trunk/autotest/gcore/rfc30.py .
>
> The C# version should be close (provided that the bindings exist for it of
> course)
>
>>
>>
>>
>> Regards,
>>
>> Maksim Sestic
>>
>>
>>
>>   _____
>>
>> From: Tamas Szekeres
>> Sent: Monday, August 01, 2011 13:05
>> To: Maksim Sestic
>> Subject: Re: [gdal-dev] .NET and OGR writing to stream
>>
>>
>>
>> Maksim,
>>
>> You can refer to the example
>> http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/GDALRead.cs
>> to see how to read data into a byte array and then you can write this
> array
>
>> directly to the memory stream.
>>
>> Best regards,
>>
>> Tamas
>>
>>
>>
>>
>> 2011/7/31 Maksim Sestic
>>
>> Hi all,
>>
>>
>>
>> Is there any example of OGR driver writing to memory stream (instead of
> file
>
>> stream), in .NET?
>>
>>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list