This project has moved and is read-only. For the latest updates, please go here.

Trasform esri/qgis shape projection in sharpmap projection

Topics: General Topics, Italiano, SharpMap Project, SharpMap v0.9 / v1.x
Sep 11, 2015 at 4:14 PM
Edited Sep 11, 2015 at 4:24 PM
Hello all,

In qgis I have this string for my shapefile coordinate system:


How I can convert this string in Sharpmap projection for show correctly geometries in the map?

I use this method for show geometries in the map:

    Private Sub LayerCatastoDaDatabase()

        Dim dbSQL As Database = New Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase("my connectionstring")
        Dim CW As DbCommand = dbSQL.GetSqlStringCommand("select  * from  tb_test ")
        Dim ds As DataSet = New DataSet()
        CW.CommandTimeout = 0
        dbSQL.LoadDataSet(CW, ds, "Ric")

        Dim fdt As New SharpMap.Data.FeatureDataTable
        fdt.Columns.Add(New System.Data.DataColumn("id", System.Type.GetType("System.UInt32")))
        fdt.Columns.Add(New System.Data.DataColumn("foglio", System.Type.GetType("System.String")))
        fdt.Columns.Add(New System.Data.DataColumn("mappale", System.Type.GetType("System.String")))

        Dim fact As NetTopologySuite.Geometries.GeometryFactory = New NetTopologySuite.Geometries.GeometryFactory()
        Dim wktreader As WKTReader = New WKTReader(fact)

        For Each row As DataRow In ds.Tables(0).Rows

            Dim Poligono As NetTopologySuite.Geometries.Geometry = wktreader.Read(row("ogr_geometry").ToString())
            Dim fdr As SharpMap.Data.FeatureDataRow = fdt.NewRow
            fdr.ItemArray = New Object() {row("ogr_fid"), row("foglio"), row("mappale")}
            fdr.Geometry = Poligono
            fdr.Geometry.SRID = row("ogr_fid")

        Dim gfp As New SharpMap.Data.Providers.GeometryFeatureProvider(fdt)
        Dim LayerPoligoni = New SharpMap.Layers.VectorLayer("poligoni", gfp)

        Dim ctFact As New ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory()
        LayerPoligoni.CoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84, ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator)
        LayerPoligoni.ReverseCoordinateTransformation = ctFact.CreateFromCoordinateSystems(ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator, ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84)


    End Sub
trying the code above , I noticed that changing coordinate system like this:


save file and re-importy shape it in mssq l see correctly geometries in the map over earth background.

I show the same query in two table with different coordinate system and same shape: