Hi ThinkGeo,
Is there limitation or known problem while GoogleOverlay/Yahoo and Bing using DecimalDegree as Map unit?
If I use the following code then Google overlay shows with minimum zoom level with no map. Se attached snapshot.
Regards,
Anil
Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
//Map1.CurrentExtent = new RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962);
//Map1.MapUnit = GeographyUnit.Meter;
Map1.MapUnit = GeographyUnit.DecimalDegree;
// Map1.RestrictedExtent = new RectangleShape(-128.0, 50.0, -70.0, 24.0); // US map
Map1.CurrentExtent = new RectangleShape(-120.0, 40.0, -65.0, 27.0);
GoogleOverlay google = new GoogleOverlay(“Google Map”);
google.GoogleMapType = GoogleMapType.Normal;
google.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings[“GoogleUri”]);
google.GoogleMapType = GoogleMapType.Normal;
GoogleOverlayWithDecimalDegree.zip (84.4 KB)
Problem with GoogleOverlay with DecimalDegree unit
Anil,
The GoogleOverlay / YahooOverlay and BingMapsOverlay are generated by their own JavaScript library and request the cached tile images from their server. The coordinate system for three of them is “Spherical Mercator”, In other words, “EPSG:900913”, which normally uses Meter. That’s why we must use Meter instead of DecimalDegree.
Thanks,
Johnny
Thanks Johnny. I found the info on Thinkgeo wiki on projecting data from DecDegree to "Spherical Mercator" and am able to get correct results on all Bing/Yahoo and Google overlays.
I am glad this is working for you. I let you know that you still can use the Longitude/Latitude values to set the extent of your Google maps or Bing Maps using projection conversion. Look at the code below:
Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));
Map1.MapUnit = GeographyUnit.Meter;
ManagedProj4Projection prj4 = new ManagedProj4Projection();
prj4.InternalProjectionParameters = ManagedProj4Projection.GetEpsgParameters(4326);
prj4.ExternalProjectionParameters = ManagedProj4Projection.GetGoogleMapParameters();
prj4.Open();
Map1.CurrentExtent = prj4.ConvertToExternalProjection(new RectangleShape(-120.0, 40.0, -65.0, 27.0));
prj4.Close();
GoogleOverlay google = new GoogleOverlay("Google Map");
google.JavaScriptLibraryUri = new Uri("maps.google.com/maps?file=api&v=2&key=ABQIAAAANid9_R2TwQDtc7fCMUChMBRLSAb7l0iDVf1ZEBZ86LxrvaLq7hSFx3FKWon8ocggVveoRd5s-xWrvQ");
google.GoogleMapType = GoogleMapType.Physical;
Map1.CustomOverlays.Add(google);