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

Bing map and coordinate conversion

Topics: WinForms Controls
Feb 5, 2016 at 5:05 PM
Hi !

Did anybody had any success to overlay north american lat-long information on bing maps tiled background ?? It works very well on OSM using

Dim _ctf = New ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory()
        Dim _csSrc = ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84
        Dim _csTgt = ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator
        Return _ctf.CreateFromCoordinateSystems(_csSrc, _csTgt)
But over bing maps, the coordinates are not correctly plotted at good location. I tried EPSG3785 conversion too... and

Dim _ctf = New ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory
        Dim _cf = New ProjNet.CoordinateSystems.CoordinateSystemFactory
        Dim _csSrc = ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84

        Dim _sourceCs As IGeographicCoordinateSystem = _cf.CreateGeographicCoordinateSystem(
            "WGS 84", ProjNet.CoordinateSystems.AngularUnit.Degrees,
            New AxisInfo("north", AxisOrientationEnum.North),
            New AxisInfo("east", AxisOrientationEnum.East)

        Dim _parameters As List(Of ProjectionParameter) = New List(Of ProjectionParameter)
        _parameters.Add(New ProjectionParameter("semi_major", 6378137.0))
        _parameters.Add(New ProjectionParameter("semi_minor", 6378137.0))
        _parameters.Add(New ProjectionParameter("latitude_of_origin", 0.0))
        _parameters.Add(New ProjectionParameter("central_meridian", 0.0))
        _parameters.Add(New ProjectionParameter("scale_factor", 1.0))
        _parameters.Add(New ProjectionParameter("false_easting", 0.0))
        _parameters.Add(New ProjectionParameter("false_northing", 0.0))
        Dim _projection As IProjection = _cf.CreateProjection("Google Mercator", "mercator_1sp", _parameters)
        Dim _targetCs As IProjectedCoordinateSystem = _cf.CreateProjectedCoordinateSystem(
            "Google Mercator",
            New AxisInfo("East", AxisOrientationEnum.East),
            New AxisInfo("North", AxisOrientationEnum.North)
as well..

Any ideas ??? Thank you !!! :-)
Mar 7, 2016 at 8:40 PM
Can you, please tell me if it is a know issue ?? I'm trying to find a way to make it works without any success... Thank you :-)
Mar 9, 2016 at 1:39 PM
What are you trying to acheive?

I guess you want to show WGS84 coordinates while moving mouse around the map ¿I'm right?
The Map should give you world coordinate units with
or to plot items on certain coordinate you should use

map.WorldToImage(X, Y).

I'm working with bing maps and OSM and they give the same X, Y picture coordinates with original WGS84 coordinates (lat, lon)
Mar 9, 2016 at 2:00 PM
I'm trying to display XY data (lat-long coordinates) from my database on tiled background. Using Bing maps, my XY data are north-west offset.

This is How I instantiate OSM (wich works great):
Dim _slat As Double = 49.5
Dim _slon As Double = -67.5
Dim osmLayer As TileAsyncLayer = New SharpMap.Layers.TileAsyncLayer(New BruTile.Web.OsmTileSource(), "OSM")
Dim ct = cCoordinateSystems.TransformToWebMercator
Dim ptWebMercator = ct.MathTransform.Transform(New Double() {_slon, _slat})

frmSuivi.uxMap.Map.Center = New GeoAPI.Geometries.Coordinate(ptWebMercator(0), ptWebMercator(1))
Doing the same thing with bing display the map somewhere in Artic. My XY data will alse be displayed in artic :-O

Dim googleLayer As TileLayer = New TileAsyncLayer(New BruTile.Web.BingTileSource(BruTile.Web.BingRequest.UrlBingStaging, myKey, BruTile.Web.BingMapType.Aerial), "BTR")
Dim ct = cCoordinateSystems.TransformToWebMercatorDim ptWebMercator = ct.MathTransform.Transform(New Double() {_slon, _slat})
frmSuivi.uxMap.Map.Center = New GeoAPI.Geometries.Coordinate(ptWebMercator(0), ptWebMercator(1))

I'm certainly doing something wrong... thanks for your help :-)
Mar 9, 2016 at 3:36 PM
The WGS84 coordinate system is set up NORTH, EAST and you are providing longitude, latitude.
Have you tried with latitude, longitude?

There was an issue with BingMaps only displaying North America with SharpMap 1.0. Are you using 1.0 or 1.1?
Mar 9, 2016 at 4:01 PM
I'm using SharpMap 1.1 with BruTile 0.7.4. I tried to use 0.12 without any success. It is certainlay a coordinate transformation issue. I'll try things.. Thanks !