Hello,
I use an InMemoryMarkerOverlay to display a lot of markers over a GoogleOverlay.
In order to group the markers if the user zooms out, I use the ClusterMarkerStyle.
// Context menu for markers
ContextMenu markerMenu = new ContextMenu();
ContextMenuItem markerItem = new ContextMenuItem("Display information of marker");
markerMenu.MenuItems.Add(markerItem);
// Context menu for clusters
ContextMenu clusterMenu= new ContextMenu();
ContextMenuItem clusterItem = new ContextMenuItem("Display information of cluster");
clusterMenu.MenuItems.Add(clusterItem);
// Cluster marker style
ClusterMarkerStyle clusterMarkerStyle = new ClusterMarkerStyle(20, 1024, 768);
clusterMarkerStyle.MarkerStyle = new PointMarkerStyle(new WebImage("Images/cluster.png")) { ContextMenu = clusterMenu };
// Marker overlay
InMemoryMarkerOverlay markers = new InMemoryMarkerOverlay("markers");
markers.ZoomLevelSet.ZoomLevel01.CustomMarkerStyle = clusterMarkerStyle;
markers.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage = new WebImage("Images/marker.png", 16, 16);
markers.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.ContextMenu = markerMenu;
markers.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
If several markers are clustered, I will get the cluster.png image.
If a markere is not clustered, I will get the cluster.png image too.
How can I use another image for the marker if the marker is not clustered?
Do I have to specify the widht and height for the ClusterMarkerStyle (1024x768) or can I use a dynamic width an height (100%)?
I also use different context menus for clusters and markers but I always get the cluster menu.
Any ideas?
Regards,
Marcus
Image of markers which are not clustered
No idea?
Marcus,
You only have one Style applied to your Markers, the ClusterMarkerStyle. You need to setup a basic style for your layer that serves as your non-clustered style and then setup a seperate Layer that has the ClusterMarkerStyle applied. Take a look at the ClusterPointStyle sample in the wiki that demonstrates this: wiki.thinkgeo.com/wiki/Map_S...PointStyle
Hello Ryan,
I'm testing your components to figure out wheter they have the funktionality which we need for our software.
Display places
Currently I use a static data source which contains geographic coordinates.
For each data record I want to display a marker on a map such as Google Maps.
Each data record contains a value which specifies which icon will be used for the marker.
More information of a marker should be displayed in a popup.
Context menu
Each marker should have a context menu with several functions.
These functions should have access to the marker the context menu was invoked.
See gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/12/aft/10282/afv/topic/Default.aspx
Grouping of markers
We want to display a lot of markers. Therefore overlapping markers should be combined into one.
Additionaly we want to be able to access the information which marker is a clustered marker and the number of markers whitin this clustered marker.
The clustered marker should have a different context menu than a normal marker.
It would be great if you could give me a brief overview if your components can control these functions.
Regards,
Marcus
Any ideas wheter your components support these functions?
Hi Marcus,
Here are my suggestion for you:
Display places
You can use InMemoryFeatureLayer to store the point shapes, and each point is a Feature which has ColumnValues, such as "DisplayInfo", and you can set ValueStyle according to the values of "DisplayInfo", for more information you can look at our HowDoI sample "Styles"--> "DrawFeaturesBasedOnValues"
Context menu
You can hook-up event MapClick on Map, and if current mouse position is on any point feature, you can show content menu.
Grouping of markers
You can use our ClusterMarkerStyle, for how to use it, you can look at gis.thinkgeo.com/Support/Dis...fault.aspx
Let me know if you have more questions.
Thanks,
James
Hi James,
thank you for your response.
Display places
I have values between 1 and 100 and I would like to compare these values with operators such as > or <. Is this feasible?
Context menu
Currently I use an InMemoryMarkerOverlay which I can directly assign a context menu. I've already solved this problem as described here:
gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/12/aft/10282/afv/topic/Default.aspx
Grouping of markers
This thread shows how to use the ClusterMarkerStyle with InMemoryMarkerOverlay or FeatureSourceMarkerOverlay. How to use it with InMemoryFeatureLayer as you has suggested in Display places?
If I use the ClusterMarkerStyle, I don't know how I can distinguish among a marker and a cluster.
I want to use three features within one Map.
- Display markers with an icons depending on a value (compare with operators such as >)
- Grouping markers and differentiate between markers and clusters to display the corresponding context menu and the amount of clustered markers
It would be great if you could show me an example that combines these three functions in one map.
Regards,
Marcus
Marcus,
Display places
You can use ClassBreakStyle, the API is similar with ValueStyle and can support your requirement, you also can find the sample code in our HowDoI sample.
Context menu
Great
Grouping of markers
ClusterMarkerStyle is working for Marker, however you can implement you own ClusterPointStyle according to the code attached.
InMemoryFeatureLayer and InMemoryMarkerOverlay has similar API, I think you can only use any one object to use three features in one map.
Thanks,
James
001_ClusterMarkerStyle.zip (880 Bytes)
Hello James,
Grouping of markers
ClusterMarkerStyle is working for Marker, however you can implement you own ClusterPointStyle according to the code attached.
Where is the logic which is responsible for the clustering of markers?
If I use your attached code sample the markers won't be clustered.
How can I distinguish between markers and clusters within a style?
Thanks,
Marcus
Marcus,
If ClusterMarkerStyle doesn’t work for you, I think the only is that you create many layers or overlays, and each of them set different style, add markers which you want to group into one layer or overlay, the result will look like you group the markers.
Thanks,
James
Marcus,
If ClusterMarkerStyle doesn’t work for you, I think the only is that you create many layers or overlays, and each of them set different style, add markers which you want to group into one layer or overlay, the result will look like you group the markers.
Thanks,
James