My markers show up over top of my labels and I need to reverse it. I’ve tried changing the z-order of the markers (thinkgeo.com/forums/MapSuite/tabid/143/aft/10873/Default.aspx), but that didn’t do any good.
The marker overlay is added before the label overlay, though the marker overlay is added to Map.Overlays and the label overlay is added to Map.InteractiveOverlays. Any input would be welcome.
Labels appear behind markers
Hi Clay,
I think if you want to put the label overlay above the marker overlay, the marker will be overlapped by label, in this case, the marker can’t be clicked.
If you don’t want to operate the marker, you can use “InMemoryFeatureLayer” instead of “MarkerOverlay” as following statements:
InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
Dictionary<string, string> dictionary = new Dictionary<string,string>();
dictionary.Add("text", "100");
layer.InternalFeatures.Add(new Feature(new PointShape(72, 10), dictionary));
GeoImage image = new GeoImage(@"C:\Thinkgeo\MapSuite3.0\Development\WpfDesktopEdition\HowDoISamples\CSharp Samples\Resources\AQUA.png");
layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(image);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay overlay = new LayerOverlay();
overlay.Layers.Add(layer);
Thanks,
Casper
That’s the point though. I want the label overlay to overlap the marker, making the marker unable to be clicked. In our case, the labels are more important than the marker.
Hi Clay,
I think you can use “InMemoryFeatureLayer” instead of “MarkerOverlay” as following statements:
InMemoryFeatureLayer layer = new InMemoryFeatureLayer();
Dictionary<string, string> dictionary = new Dictionary<string,string>();
dictionary.Add("text", "100");
layer.InternalFeatures.Add(new Feature(new PointShape(72, 10), dictionary));
GeoImage image = new GeoImage(@"C:\Thinkgeo\MapSuite3.0\Development\WpfDesktopEdition\HowDoISamples\CSharp Samples\Resources\AQUA.png");
layer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = new PointStyle(image);
layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay overlay = new LayerOverlay();
overlay.Layers.Add(layer);
Thanks,
Casper
The problem with this approach is that it requires me to load all the images I’m using up front. I sometimes don’t know what the image will be until I’m ready to use it, which is why I’m using the marker overlay. Therefore, this won’t really work as a workaround.
If there isn’t a way to do it, then I need to put in a request for an enhancement. I’d like to be able to control which layer is on top.
Hi Clay,
Thanks for your further information, but I don’t think it’s
a good way to go that putting the marker overlay beneath label overlay, as they
are 2 different kinds of overlays, the markers should always be at the top of
map to response the mouse-events, while label overlay is used to show the images
as the base map usually, it has image-stretch effect when zooming in/out. If we
put markers under labels, the events on markers will not be fired, possibly some
potential issues as well. An option for
this is changing the theme of map, “Wpfmap.xaml”, I can send it to you if you
still would like to go on this way.
As we know, the marker is rendered as a WPF element in Map
control, if show these features as markers, another problem is that it will slow down the map loading
performance if lots of markers are loaded.
If you don’t want the markers clickable, I guess the best solution is using the MapShapeLayer, we can
create different MapShape for different point feature with its own ICON and
Label.
Thanks,
Johnny