ThinkGeo.com    |     Documentation    |     Premium Support

SQLite support in WPF Evaluation Edition

Hi,

I am currently evaluating the MapSuite WPF edition with the World Map Kit SQLite database. I can’t seem to get the map to display. I have read through multiple posts on this site, including this one which matched my issue almost perfectly: Using of SqliteFeatureSource and WPF Map Suite 9
I am not able to access the Internet at all on the machine I am developing on, although I can transfer files to it. I am using a local copy of the WMK SQLite database.

I have copied the code that Don posted but nothing comes up besides the zoom bar and the ThinkGeo logo.
After setting some breakpoints, I can see that my code isn’t getting past the “wpfMap1.CurrentExtent = sqlLayer.GetBoundingBox();” line. Referencing the other post, I have allowed the program to run for about a half hour to leave time for the map to load. It still isn’t appearing. What should I do to get this to work?

private void Window_Loaded(object sender, RoutedEventArgs e)
        { 	
		wpfMap1.MapUnit = GeographyUnit.Meter;

        	LayerOverlay overlay = new LayerOverlay();
            	overlay.TileType = TileType.MultipleTile;

            	SqliteFeatureLayer sqlLayer = new SqliteFeatureLayer(@"Data Source=C:\\Documents\WorldMapKitData\WorldMapKit4326_20141115\WorldMapKit4326.sqlite;Version=3", "ne_ocean1m_polygon", "id", "geometry");

            	sqlLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1;
            	sqlLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.GeographicColors.Grass);
            	sqlLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            	overlay.Layers.Add(sqlLayer);
            	sqlLayer.Open();
            	wpfMap1.CurrentExtent = sqlLayer.GetBoundingBox();
            

            	sqlLayer.FeatureSource.BeginTransaction();
            	sqlLayer.FeatureSource.AddFeature(new Feature(wpfMap1.CurrentExtent.GetCenterPoint()));
            	sqlLayer.FeatureSource.CommitTransaction();
	
            	wpfMap1.Overlays.Add(overlay);
            	wpfMap1.Refresh();
	}

I appreciate any help.
Thank you.

Hi Grant,

Please change the MapUnit of wpfMap to GeographyUnit.DecimalDegree. This is the reason why there is nothing display on the map. The following is the relationship of MapUnit and the projection of the data.

projection: 4326 ----> MapUnit: DecimalDegress
projection: 3857,900913 ----> MapUnit: Meter

I checked the code and found some parts of the code don’t make sense.

  • The code “overlay.TileType = TileType.MultipleTile;” is redundant, the default value of TileType is MultipleTile.

  • The code “wpfMap1.Refresh();” at the end of the method “Window_Loaded” is redundant, the map calls the refresh method when its size changed, if we call it in the “Window_Loaded”, it means that the refresh method will execute twice(the size changed and call explicitly).

Thanks,
Peter