ThinkGeo.com    |     Documentation    |     Premium Support

Displaying and re-projecting Bing Map Data

I am in the process of upgrading to Version 12.3 of the ThinkGeo maps (coming from 10.4)

In our application, we have a Bing Map layer as the base map, but we need to change the projection to match what we are using in the map.

We are wanting the map to interpret values as being in some reference system (as selected by the user) and treat all internal object coordinates as being in that system. For example, if we are working in Alberta, Canada and want our map to refer to UTM Zone 12, NAD 27 (EPSG 26712) I do the following:

    private void mapView_Loaded(object sender, RoutedEventArgs e)
    {
        // Set the Map Unit.
        mapView.MapUnit = GeographyUnit.Meter;

        // Show my Zone 12 area
        mapView.CurrentExtent = new RectangleShape(287000, 5645000, 299000, 5640000);
    }

The values entered refer to that Projection id.

Now, if I drop a BingMapOverlay into this map, and want it to convert the Bing Map projection to that same reference.

    private void LoadBingMapOverlay()
    {
        BingMapsOverlay bingMapOverlay = new BingMapsOverlay(_bingKey, BingMapsMapType.Aerial); ;

        // Project the Bing Map to UTM 12 Nad 27
        ProjectionConverter converter = new ProjectionConverter(Projection.GetBingMapProjString(), 26712);

        bingMapOverlay.ProjectionConverterFromServerProjection = converter;

        mapView.Overlays.Add(bingMapOverlay);
    }

However now I get a map with Image Not Available all over.

I did this in Ver 10 and it worked (Using Proj4Projection), but in ver 12 (using ProjectionConverter) it is not working.

If I drop the ProjectionConverter, and just drop the Bing Overlay, I see it fine, but the map is not displaying Alberta, it is over in Europe (no projection and that is what I would expect)

Is there a way to change the Bing Map Projection, or am I missing some fundamental process in all of this? Did something else replace Proj4Projection?

Hi Chris,

Please 1, install ThinkGeo.UnmanagedProj Nuget Package, and 2, use UnmanagedProjectionConverter in the code like following:

        wpfMap1.MapUnit = GeographyUnit.Meter;
        
        BingMapsOverlay baseOverlay = new BingMapsOverlay("key");
        ProjectionConverter converter = new UnmanagedProjectionConverter(Projection.GetBingMapProjString(), 26712);
        baseOverlay.ProjectionConverterFromServerProjection = converter;
        wpfMap1.CurrentExtent = new RectangleShape(287000, 5645000, 299000, 5640000);
        wpfMap1.Overlays.Add(baseOverlay);

It is supposed to have the exception message on the tile guiding you how to fix it but seems it doesn’t work for BingMapsOverlay. The newer version of Proj4 doesn’t belong to the “4” family anymore and that’s why we get rid of the class Proj4Projection and use ProjectionConverter instead. The Unmanaged version is directly using the native prj.dll through GDAL which supports Raster reprojection while the managed version only support vector reprojection. Sorry it’s a bit complicated and confusing.

Let us know if you still see issues.

Thanks,
Ben

Doing this test in the “How Do I” samples, the projection works as you mention. But in my main application I still get the same image not available error.

I now suspect I might have some sort of conflict with a wrapper that we built to use the Proj.4 tools for our purposes. This wrapper had all the Proj.4 unmanaged stuff, and it supported NTV_2, which we need.

Are you going to add NTV_2 support? Or is it already available?

Well, I was able to get things working as expected, thanks Ben.

But the NTV_2 question (is it supported?) still stands.

Hi Chris,

It should be already covered by the Gdal Layer but can you send over a file you are using to us(support@thinkgeo.com) so we can make sure?

Thanks,
Ben