Hi,
I’m testing the use of GoogleMapsOverlay and OpenStreetMapOverlay in a WPF test project, and I’m having some issues when translating the WinForms samples in the evaluation download to WPF. The issue is that when using the MultipleTiles TileType, the tiles are not stiched together as expected. The screenshot in the attachments shows this I hope. Is this a matter of projection? I did not check that the sample runs fine in the WinForms setup, as I did not download the evaluation version for WinForms.
Just to make sure that the configuration is clear, this is the code behind of the XAML view:
01.privatevoidWpfMap1_OnLoaded(objectsender, RoutedEventArgs e)02.{03.WpfMap1.MapUnit = GeographyUnit.Meter;04.WpfMap1.BackgroundOverlay.BackgroundBrush =newGeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255));05.06.var googleOverlay =newGoogleMapsOverlay07.{08.MapType = GoogleMapsMapType.Terrain,09.TileType = TileType.MultipleTile10.};11.12.WpfMap1.Overlays.Add(googleOverlay);13.14.// This sets the zoom levels to map to Googles. We next make sure we snap to the zoomlevels15.WpfMap1.ZoomLevelSet =newGoogleMapsZoomLevelSet();16.17.var pointLayer =newInMemoryFeatureLayer();18.pointLayer.Open();19.pointLayer.Columns.Add(newFeatureSourceColumn(“Text”));20.pointLayer.Close();21.22.//Sets the projection parameters to go from Geodetic (EPSG 4326) or decimal degrees to Google Map projection (Spherical Mercator).23.var proj4 =newProj4Projection24.{25.InternalProjectionParametersString =26.Proj4Projection.GetEpsgParametersString(4326),27.ExternalProjectionParametersString =28.Proj4Projection.GetGoogleMapParametersString()29.};30.31.//Applies the projection to the InMemoryFeatureLayer so that the point in decimal degrees (Longitude/Latitude) can be32.//match the projection of Google Map.33.pointLayer.FeatureSource.Projection = proj4;34.35.//Values in Longitude and Latitude.36.constdoubleLongitude = -95.2809;37.constdoubleLatitude = 38.9543;38.39.//Creates the feature made of a PointShape with the Longitude and Latitude values.40.var gpsFeature =newFeature(newPointShape(Longitude, Latitude));41.42.//Format the Longitude and Latitude into a nice string as Degrees Minutes and Seconds43.var longLat = DecimalDegreesHelper.GetDegreesMinutesSecondsStringFromDecimalDegreePoint(gpsFeature);44.45.//Sets the InMemoryFeatureLayer to have it displayed with Square symbol and with text.46.gpsFeature.ColumnValues.Add(“Text”, longLat);47.pointLayer.InternalFeatures.Add(gpsFeature);48.49.pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle =50.PointStyles.CreateSimplePointStyle(51.PointSymbolType.Square, GeoColor.StandardColors.Red, GeoColor.StandardColors.Black, 2, 12);52.pointLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle(53.“Text”,54.“Arial”,55.12,56.DrawingFontStyles.Bold,57.GeoColor.StandardColors.Black,58.GeoColor.StandardColors.White,59.3,60.-10,61.10);62.pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;63.64.var pointOverlay =newLayerOverlay();65.pointOverlay.Layers.Add(“PointLayer”, pointLayer);66.WpfMap1.Overlays.Add(“PointOverlay”, pointOverlay);67.68.//Sets the extend of the map based on the GPS point.69.proj4.Open();70.var projVertex = proj4.ConvertToExternalProjection(Longitude, Latitude);71.proj4.Close();72.73.constdoubleExtendWidth = 2300;74.constdoubleExtendHeight = 1200;75.76.WpfMap1.CurrentExtent =newRectangleShape(77.(projVertex.X - ExtendWidth),78.(projVertex.Y + ExtendHeight),79.(projVertex.X + ExtendWidth),80.(projVertex.Y - ExtendHeight));81.82.WpfMap1.Refresh();83.}
And this is the XAML:
<Windowxmlns="<a href=“schemas.microsoft.com/winfx/2006/xaml/presentation">schemas.microsoft.com/winfx/...esentation</a>"xmlns:x=”<a href="schemas.microsoft.com/winfx/2006/xaml">schemas.microsoft.com/winfx/2006/xaml</a>"xmlns:WpfDesktopEdition=“clr-namespace:ThinkGeo.MapSuite.WpfDesktopEdition;assembly=WpfDesktopEdition”x:Class=“ThinkGeo.Client.GpsToGoogleMap”Title=“OpenStreetMapBasic”><WpfDesktopEdition:WpfMapGrid.Row=“0”x:Name=“WpfMap1”Loaded=“WpfMap1_OnLoaded”><!–</code–>WpfDesktopEdition:WpfMap><!–</code–>Window>
This is of course an issue that is blocking for any further evaluation, which is unfortunate as the feature set looks promising, and I’m guessing that this will be a matter of some setting I’m not aware of.
Help would be appreciated.GpsToGoogleMapDesktop.PNG (59.9 KB)
