Hi,
I follow the MapsuiteExplorerForDesktop sample and it works very well.
Now I want to add a background map using worldmapkit. The base map is added, but the order is not correct(I added a shapefile of Texas State).
Besides, I am not sure whether basemap and my shapefile could match very well. The code is as follows:
private void MainForm_Load(object sender, EventArgs e)
{
filesWithoutIndex = new Collection<string>();
addedFiles = new Collection<string>();
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.CurrentExtent = new RectangleShape(-90, 45, 90, -45);
winformsMap1.MouseMove += new MouseEventHandler(winformsMap1_MouseMove);
winformsMap1.MapClick += new EventHandler<MapClickWinformsMapEventArgs>(winformsMap1_MapClick);
this.themeView.ThemeViewDragDrop += new EventHandler<DragDropItemEventArgs>(themeView_ThemeViewDragDrop);
this.themeView.VScrollVisible += new EventHandler<EventArgs>(themeView_VScrollVisible);
RegHotkey();
SetupContextMenu();
winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.White);
SetScaleLineAdornment();
winformsMap1.Overlays.Add(new LayerOverlay());
WorldMapKitWmsDesktopOverlay worldMapKitsOverlay = new WorldMapKitWmsDesktopOverlay();///////////////// I add the code
winformsMap1.Overlays.Add(worldMapKitsOverlay); ///////////////////// I add the code
//Sets the ZoomLevelSnapping to none to allow having the map at the exact scale desired.
winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.None;
//Does not allow zooming in at a scale larger than 1:1000
winformsMap1.MinimumScale = 1000;
winformsMap1.Refresh();
}
Order of shapefiles
Hi Junxuan,
The earlier added one will be in the bottom.
So you should want add them like this:
winformsMap1.Overlays.Add(worldMapKitsOverlay);
winformsMap1.Overlays.Add(new LayerOverlay());
If your map cannot match base map, please make sure the projection of your data first.
Regards,
Don
Hi,
Thanks for your reply.
The order of the maps are correct now. But we found that the operation speed of the code is very slow. If we zoom in/out the whole map, we need to wait for a long time. Besides, there are some white grids in the background.
Junxuan,
Would you please provide us a concrete sample or the whole codes here? Could you comment some codes out to narrow down the issue? I am suspecting some suspicious codes like MouseMove etc…
Thanks,
Troy