I have a raster layer that I store in the map's Overlay's collection. I also have an InMemoryFeatureLayer that I store in the map's overlays collection. I populate the InMemoryFeatureLayer first and the raster layer second. Also, I update both layers at different times (for example, if the user switches themes I re-fetch the raster layer to show a different theme). Also, the InMemoryFeatureLayer is updated based on changing POIs.
However, the InMemoryFeatureLayer disappears behind the raster layer. How can I arrange this so the raster layer stays on the bottom and the InMemoryFeatureLayer stays on top?
I think you probably make a mistake by setting the sequence of the overlays; we should add the base overlay first and then on top of it add the inmemory overlay.
Try following code: winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.CurrentExtent = new RectangleShape(0, 100, 100, 0); winformsMap1.BackgroundOverlay.BackgroundBrush =new GeoSolidBrush(GeoColor.StandardColors.White);
InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer(); inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))"))); inMemoryLayer.InternalFeatures.Add("Multipoint", new Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(10 20, 30 20,40 20, 10 30, 30 30, 40 30)"))); inMemoryLayer.InternalFeatures.Add("Line", new Feature(BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)"))); inMemoryLayer.InternalFeatures.Add("Rectangle", new Feature(new RectangleShape(65, 30, 95, 15)));