Hello,
I have tryed some examples about how to use googlemap and I'm having some troubles, I can see the map and I can load a bitmap and a label representing a vehicle over the google map, the problem that I have is that sometimes when I'm zooming in/out, or when I'm moving around the map, it gives me error "403", and another times show error "500" . Do you have any idea about what I'm doing wrong? I can't figure out how can I catch these exeption when it occurs. Here is an example of the code that I'm using:
double Longitude = -58.33806539154050;double Latitude = -34.65402830688480;
double xG = 6378137.0 * Math.PI / 180 * Longitude;
double yG = 6378137.0 * Math.Log(Math.Tan(Math.PI / 180 * (45 + Latitude / 2.0)));
winformsMap1.BackgroundOverlay.BackgroundBrush =
new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
winformsMap1.CurrentExtent =
winformsMap1.MapUnit =
new RectangleShape(( xG - 2300), (yG + 1200), (xG + 2300), (yG - 1200));GeographyUnit.Meter;//Adds the Google Map as an overlay
GoogleMapsOverlay google = new GoogleMapsOverlay("Google Map");
google.MapType =
google.CacheDirectory =
winformsMap1.Overlays.Add(
GoogleMapsMapType.RoadMap;@"C:\GoogleCache";"GoogleOverlay", google);//// This sets the zoom levels to map to Googles. We next make sure we snap to the zoomlevels
winformsMap1.ZoomLevelSet =
winformsMap1.ZoomToScale(winformsMap1.ZoomLevelSet.ZoomLevel15.Scale);
new GoogleMapZoomLevelSet();
LayerOverlay layerOverlay = new LayerOverlay();
pointLayer.Open();
pointLayer.Columns.Add(
pointLayer.Close();
InMemoryFeatureLayer pointLayer = new InMemoryFeatureLayer();new FeatureSourceColumn("Text"));//Sets the projection parameters to go from Geodetic (EPSG 4326) or decimal degrees to Google Map projection (Spherical Mercator).
proj4.InternalProjectionParametersString =
proj4.ExternalProjectionParametersString =
Proj4Projection proj4 = new Proj4Projection();Proj4Projection.GetEpsgParametersString(4326);Proj4Projection.GetGoogleMapParametersString();//Applies the projection to the InMemoryFeatureLayer so that the point in decimal degrees (Longitude/Latitude) can be
//match the projection of Google Map.
pointLayer.FeatureSource.Projection = proj4;
//Creates the feature made of a PointShape with the Longitude and Latitude values.
Feature GPSFeature = new Feature(new PointShape(Longitude,Latitude));//Format the Longitude and Latitude into a nice string as Degrees Minutes and Seconds
string LongLat = DecimalDegreesHelper.GetDegreesMinutesSecondsStringFromDecimalDegreePoint(GPSFeature);
//Sets the InMemoryFeatureLayer to have it displayed with Square symbol and with text.
GPSFeature.ColumnValues.Add(
pointLayer.InternalFeatures.Add(
"Text", LongLat);"GPS",GPSFeature);
pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle =
pointLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle =
pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel =
PointStyles.CreateSimplePointStyle(PointSymbolType.Square,GeoColor.StandardColors.Red, GeoColor.StandardColors.Black, 2, 12);TextStyles.CreateSimpleTextStyle("Text", "Arial", 12, DrawingFontStyles.Bold,GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3, -10, 10);ApplyUntilZoomLevel.Level20;
Overlay.Layers.Add(pointLayer);
winformsMap1.Overlays.Add(layerOverlay);
winformsMap1.Refresh();
Best Reagrds,