ThinkGeo.com    |     Documentation    |     Premium Support

Different coords in OSM Overlay than in Google and Bing overlays?

Hello,

I’m trying to show either Google/Bing/OpenStreetMap overlay. For project reasons, GeographyUnit must be in DecimalDegree, so I have to “play” with projection conversions.

My problem is that OSM overlay doesn’t use the same coordinates as Google/Bing, so when I switch overlays between these ones, the location showed is different.

For example, here is one section of Madrid’s M-30 motorway in Bing(and Google):

Coordinates: 40.63034, -3.97819

And in OSM:

Coordinates: 40.44469, -3.66067

It’s not a problem of the maps itself because if I go to the OSM web and put the Bing coordinates, the location showed it’s the same as the Bing map, so it has to be something related to the MapSuite or my code.

Here’s a portion of the code to initialize the overlays:

wpfMap.MapUnit = GeographyUnit.DecimalDegree;
//Bing
BingMapsOverlay bingOverlay = new BingMapsOverlay();
bingOverlay.ApplicationId = "...";

Proj4Projection proj4Bing = new Proj4Projection();
proj4Bing.InternalProjectionParametersString = Proj4Projection.GetBingMapParametersString();
proj4Bing.ExternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();

bingOverlay.ProjectionFromSphericalMercator = proj4Bing;
wpfMap.Overlays.Add("Bing", bing);
...

//OSM
OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay();

Proj4Projection proj4OSM = new Proj4Projection();
proj4OSM.InternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();
proj4OSM.ExternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();

openStreetMapOverlay.ProjectionFromSphericalMercator = proj4OSM;
wpfMap.Overlays.Add("OSM", openStreetMapOverlay);
...

What can be the reason of that deviation in OSM?
Thanks in advance,
Euyen

Hi Euyen,

I tested the code and it looks the result is the same, so I guess maybe that’s related with some other reason, maybe you want to build a simple sample to reproduce it.

            PointShape p = new PointShape(6011252.50283677, 4300621.37204427);

        Proj4Projection proj4Bing = new Proj4Projection();
        proj4Bing.InternalProjectionParametersString = Proj4Projection.GetBingMapParametersString();
        proj4Bing.ExternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
        proj4Bing.Open();
        
        Proj4Projection proj4OSM = new Proj4Projection();
        proj4OSM.InternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString();
        proj4OSM.ExternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
        proj4OSM.Open();

        PointShape pBing = proj4Bing.ConvertToExternalProjection(p) as PointShape;
        PointShape pOSM = proj4OSM.ConvertToExternalProjection(p) as PointShape;
        
        MessageBox.Show(pBing.Equal2D(pOSM).ToString());

The test result is true.

Regards,

Ethan

Thanks for the response.

Attached here is a sample test map done in 5 minutes with 3 buttons to change overlays between Bing/Google/OSM. Without moving the map position, the location of Bing and Google overlays is in Valencia, here in Spain, and the OSM map, using the same coordinates, is situated in the mediterranean sea.

-Note: For when you test it, the Bing ApplicationId has been censored for obvious reasons.

TestMap.zip (12.9 KB)

Hi Euyen,

Thanks for your data, it looks they match under meter, but not under decimal degree.

Because the re-projrection for them is reproject the image, so we don’t know which map have problem for now, our developer will look into it and see which one has problem.

Any update I will let you know.

Regards,

Ethan

Hi Euyen,

Our developer should fixed that, please get the package version listed when they are available:


Please let us know whether that works for you.

Regards,

Ethan

Thanks!

I’ll try it when it’s published.

Hi Euyen,

Any question please let us know.

Regards,

Ethan