Hi, I am working on a project that uses shape file based map overlay and on top of that loads a InMemoryFeatureLayers overlay. Here is a screenshot. (Image 1)
The FeatureLayer consists of a number of encs (Electrical Navigational Chart) added as markers. Here is a screenshot of this layer without the map layer (Image 2)
Now i want to replace the shape file based map with OpenStreetMap. But when i load the open street map the FeatureLayer overlay is not shown. Here is how it looks (Image 3)
Here is how i load the map layers
private void InitMapLayers()
{
// Static layers
AddBackgroundMap();
_dynamicLayer = CreateDynamicLayer();
// dynamicLayer is a InMemoryFeatureLayer with ENC markers
_dynamicOverlay.Layers.Add(_dynamicLayer);
// Default overlay (background map, countries, cities)
mapSuiteControl.Overlays.Add(SHAPE_MAP_LAYER_KEY, _staticOverlay);
// Dynamic overlay (ENC cells, etc..)
mapSuiteControl.Overlays.Add("Markers", _dynamicOverlay);
mapSuiteControl.Overlays.Add(_drawingOverlay);
//AddOSMLayer();
SetShapeLayersStyles();
}
private void AddBackgroundMap()
{
_staticOverlay = new LayerOverlay() { IsBase = true };
// Set a background brush
mapSuiteControl.BackgroundOverlay.BackgroundBrush = new GeoLinearGradientBrush(
GeoColor.FromArgb(255, 169, 196, 222), GeoColor.FromArgb(255, 73, 132, 182), GeoLinearGradientDirection.UpperRightToLowerLeft);
// Then add world layer
_baseMapLayer = new ShapeFileFeatureLayer(Constants.MapBaseShapeFile, ShapeFileReadWriteMode.ReadOnly)
{
FeatureSource = { Projection = _mapManager.Projection }
};
var pen = new GeoPen(GeoColor.StandardColors.OliveDrab);
_baseMapLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new HueFamilyAreaStyle(pen, GeoColor.SimpleColors.PaleGreen, 6);
_baseMapLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
_staticOverlay.Layers.Add(MapLayer.BackgroundMap.ToString(), _baseMapLayer);
ShapeFileFeatureLayer.BuildIndexFile(Constants.MapBaseShapeFile);
_baseMapLayer.Open();
_baseMapLayer.WrappingMode = WrappingMode.WrapDateline;
_baseMapLayer.WrappingExtent = _baseMapLayer.GetBoundingBox();
mapSuiteControl.CurrentExtent = _baseMapLayer.GetBoundingBox();
}
private void AddOSMLayer()
{
OpenStreetMapOverlay _osmOvelerlay = new OpenStreetMapOverlay() { IsBase = true};
mapSuiteControl.Overlays.Add(OPEN_STREET_LAYER_KEY, _osmOvelerlay);
mapSuiteControl.MapUnit = GeographyUnit.Meter;
}
When i run this code i get result as Image 1.
If i comment the following line i get Image 2.
mapSuiteControl.Overlays.Add(SHAPE_MAP_LAYER_KEY, _staticOverlay)
If i then uncomment the following line i get Image 3
//AddOSMLayer();
The open street map is shown but the Markers layer is not shown anymore.
What i am doing wrong here? I am a noob at ThinkGeo SDK so probably there is a silly mistake but i cant find it.