Coordinate system error

Topics: Algorithms, Data Access, SharpMap Project, SharpMap v0.9 / v1.x, WinForms Controls
Sep 8, 2009 at 8:25 PM

He all.

i see this error : Reference required to assembly 'ProjNET, Version=1.0.2794.16965, Culture=neutral, PublicKeyToken=a1f5bdcd9c6f5740' containing the type 'SharpMap.CoordinateSystems.Transformations.ICoordinateTransformation'. Add one to your project.

but when i add to my project i see many error like this : 'ICoordinateTransformation' is ambiguous in the namespace 'SharpMap.CoordinateSystems.Transformations'.

or this one : 'CoordinateSystemFactory' is ambiguous in the namespace 'SharpMap.CoordinateSystems'.


Public Function SetPGLayer(ByVal TableName As String, ByVal GeoTableName As String, Optional ByVal MaxVisible As Integer = Nothing, Optional ByVal MinVisible As Integer = Nothing, Optional ByVal SRID As Integer = Nothing, Optional ByVal SymbolScale_Point As Single = 0.8F) As SharpMap.Layers.VectorLayer

        Dim PGLayer As SharpMap.Layers.VectorLayer = New SharpMap.Layers.VectorLayer(TableName)
        PGLayer.DataSource = New SharpMap.Data.Providers.PostGIS(ConnectionString, GeoTableName, "the_geom")
        If MaxVisible <> Nothing Then PGLayer.MaxVisible = MaxVisible
        If MinVisible <> Nothing Then PGLayer.MinVisible = MinVisible
            PGLayer.Style.SymbolScale = SymbolScale_Point
        Catch ex As Exception
        End Try
        Dim transformToGoogle As ICoordinateTransformation = wgs84toGoogle()
        PGLayer.CoordinateTransformation = transformToGoogle ''''error : 
        Return PGLayer
 End Function


Public Function wgs84toGoogle() As ICoordinateTransformation
        Dim csFac As CoordinateSystemFactory = New SharpMap.CoordinateSystems.CoordinateSystemFactory()
        Dim ctFac As New CoordinateTransformationFactory()

        Dim wgs84 As IGeographicCoordinateSystem = csFac.CreateGeographicCoordinateSystem("WGS 84", AngularUnit.Degrees, HorizontalDatum.WGS84, PrimeMeridian.Greenwich, New AxisInfo("north", AxisOrientationEnum.North), New AxisInfo("east", AxisOrientationEnum.East))

        Dim parameters As New List(Of ProjectionParameter)()
        parameters.Add(New ProjectionParameter("semi_major", 6378137.0R))
        parameters.Add(New ProjectionParameter("semi_minor", 6378137.0R))
        parameters.Add(New ProjectionParameter("latitude_of_origin", 0.0R))
        parameters.Add(New ProjectionParameter("central_meridian", 0.0R))
        parameters.Add(New ProjectionParameter("scale_factor", 1.0R))
        parameters.Add(New ProjectionParameter("false_easting", 0.0R))
        parameters.Add(New ProjectionParameter("false_northing", 0.0R))
        Dim projection As IProjection = csFac.CreateProjection("Google Mercator", "mercator_1sp", parameters)

        Dim epsg900913 As IProjectedCoordinateSystem = csFac.CreateProjectedCoordinateSystem("Google Mercator", wgs84, projection, LinearUnit.Metre, New AxisInfo("East", AxisOrientationEnum.East), New AxisInfo("North", AxisOrientationEnum.North))

        Return ctFac.CreateFromCoordinateSystems(wgs84, epsg900913)
    End Function

Please help me.....


Sep 9, 2009 at 2:51 PM

It sounds like you have references to multiple versions of Perhaps you could start by removing all references to and then re-adding ensuring that you always reference the same dll. hth jd