[gdal-dev] C#: How to generate pbf file from bytes array for Vector Tiles Service

rmaddu rajeshreddy82 at gmail.com
Tue May 26 05:45:28 PDT 2020


Hi,

Below is the C# code snippet. How to generate pbf file from bytes data? Is
this the correct way or any other way to return to client?

string filePath = string.Format(@"/vsimem/mvt-{0}/{1}/{2}/{3}.pbf",
uniqueUUID, 18, 66027, 96262);
var bufPtr = Gdal.VSIFOpenL(filePath, "rb");
     
      if (bufPtr != null)
      {
        Gdal.VSIFSeekL(bufPtr, 0, 2); // seek to end
        var contentSize = Gdal.VSIFTellL(bufPtr);        
        Gdal.VSIFSeekL(bufPtr, 0, 0); // seek to beginning 
        Gdal.VSIFCloseL(bufPtr);
       
        byte[] data = new byte[contentSize];
        Marshal.Copy(bufPtr, data, 0, contentSize);
       
        Gdal.Unlink(vsibuf);

Regards,
Rajesh



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list