[Gdal-dev] Export shp to kml using ogr_csharp.dll

Leonidas Liakos leonidas_liakos at yahoo.gr
Thu May 31 17:43:57 EDT 2007


Until now I manage to Open a  Datasource and Create a Datasource.
The utility ogr2ogr converts shp to kml like that example:
ogr2ogr -f KML mypoints.kml sbpoints.shp

Question:
Is there any function which i can use to do tha progrmmatically OR I 
have to iterate in all the features of the Opened Datasource(shp) to the 
new Created DataSource(kml) and write each feature in that kml file?
My code until now:

        Dim ogr As New OSGeo.OGR.Ogr
        Dim kml As OSGeo.OGR.DataSource
        Dim driver As OSGeo.OGR.Driver
        Dim shp As OSGeo.OGR.DataSource
        Dim options(0) As String

        ogr.RegisterAll()
        shp = ogr.Open("c:\Point.kml", 0) 'Open a  Datasource
        driver = ogr.GetDriverByName("KML")
        options(0) = String.Empty
        kml = driver.CreateDataSource("C:\Point.kml", options) 'Create a 
Datasource

NEXT HOW TO IMPLEMENT ogr2ogr -f KML like in example?

Thank you for you help.Leonidas



More information about the Gdal-dev mailing list