<div dir="ltr"><div dir="ltr"><div dir="ltr">I use it like this:<div><div><font face="monospace, monospace">var options = new[]</font></div><div><font face="monospace, monospace">{</font></div><div><font face="monospace, monospace">    "-f", "GeoJSON",</font></div><div><font face="monospace, monospace">    "-lco", "RFC7946=YES"</font></div><div><font face="monospace, monospace">};</font></div><div><font face="monospace, monospace">VectorTranslate(shapefileLocation, output, options);</font></div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">public void VectorTranslate(string input, string output, string[] options)</font></div><div><font face="monospace, monospace">{</font></div><div><font face="monospace, monospace">    if (!input.StartsWith("PG:") && !File.Exists(input))</font></div><div><font face="monospace, monospace">    {</font></div><div><font face="monospace, monospace">        throw new FileNotFoundException("Can't find the input file",</font></div><div><font face="monospace, monospace">            new Exception("Working with " + input));</font></div><div><font face="monospace, monospace">    }</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">    using (var ds = Gdal.OpenEx(input, 4, null, null, null))</font></div><div><font face="monospace, monospace">    {</font></div><div><font face="monospace, monospace">        if (ds == null)  throw new Exception("Can't open GDAL dataset: " + input);</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">        var gdalOptions = new GDALVectorTranslateOptions(options);</font></div><div><font face="monospace, monospace">        using (var newDs = Gdal.wrapper_GDALVectorTranslateDestName(output, ds, gdalOptions, null, null))</font></div><div><font face="monospace, monospace">        {</font></div><div><font face="monospace, monospace">            if (newDs == null)  throw new Exception("VectorTranslate failed: " + Gdal.GetLastErrorMsg());</font></div><div><font face="monospace, monospace">        }<br></font></div><div><font face="monospace, monospace">    }</font></div><div><font face="monospace, monospace">}</font></div></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br>
<br>Paul<br>
<br>
<div style="font-size:13.3px;font-family:Verdana,Arial,Helvetica,sans-serif"><div style="border:1px solid rgb(229,229,229);background-color:rgb(248,248,248);padding:0.8em 0.8em 0.3em"><div style="margin:0px 0px 8px"><p style="margin:0px"><span><b><img style="float: left; margin-left: 5px; margin-right: 5px;" src="http://www.bontepaarden.nl/bontepaarden/images/newButton.png" alt="" height="120" width="160">Paul Meems </b><br><span>Release manager, configuration manager</span><br><span>and forum moderator of MapWindow GIS.</span><br><a href="http://www.mapwindow.org/" target="_blank"><span>www.mapwindow.org</span></a><br><br><span>Owner of MapWindow.nl - Support for</span><br><span>Dutch speaking users.</span><br><a href="http://www.mapwindow.nl/" target="_blank"><span>www.mapwindow.nl</span></a><br></span></p>
<p style="margin:0px"><b><br></b></p><p style="margin:0px"><b>The MapWindow GIS project has a new <a href="https://mapwindow.discourse.group" target="_blank">forum</a>!</b></p><p style="font-size:13.3px;margin:0px"><br><a href="https://github.com/MapWindow/MapWinGIS/releases" target="_blank">Download the latest MapWinGIS mapping engine.</a><br></p><p style="font-size:13.3px;margin:0px"><span style="font-size:13.3px"><a href="https://github.com/MapWindow/MapWindow5/releases" target="_blank">Download the latest MapWindow 5 open source desktop application.</a><br><br></span></p></div></div><img src="http://p1.wisestamp.com/pixel.png?p=mozilla&v=3.9.12&t=1322134056890&u=482737fd0c4ca423" height="1" width="1"></div>
</div></div></div></div></div></div></div></div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">Op wo 9 jan. 2019 om 16:49 schreef Gigas002 <<a href="mailto:gigas002@yandex.ru">gigas002@yandex.ru</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello. Does anybody know, if there's a way to convert shapefile to geojson<br>
using c# bindings? I know about ogr2ogr.exe, but I'd still prefer bindings<br>
if it's possible.<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html" rel="noreferrer" target="_blank">http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html</a><br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div>