I have been working on our 2nd demo applications. We are doing internal POC (Proof of Concepts) for GeoCoding, Vehicle Tracking and finally Routing. I am working on Vehicle Tracking now.
Going by your examples you create a “Feature” for each vehicle. In our POC this works fine. I’ve easily been able to place the vehicle, rotate the vehicle based on heading, etc.
Were we have an issue is that we want to be able to create a Feature/Marker for each truck that has both ToolTip Capability as well as Context Menu. I’ve seen that this is not easily achievable with the “Feature” but can be done with the Marker.
What are the Pros and Cons to both the “Feature” and “Marker”. Is there any downside to using a Marker for Vehicle tracking? Right now most of our Customer’s GPS units are not Realtime. They are about a 5 minute ping (just so you understand our refresh needs).
Thank you.
Feature vs Marker? Help? Recommendations?
Hi Dave,
Based on your case, using Marker would be more effective if the vehicles are not too many. Especially you want to add a tooltip and context menu, both of them are only supported with Marker, using feature is not easy to implement them. Also, you mentioned the markers will be probable refreshed every 5 minutes, and I think it would be safe to use markers.
If there are many vehicles in your case like hundreds, then using feature to instead of marker will make the performance better as the features actually are consist of with many image tiles, but each marker is a winform controls. We are using Feature in our vehicle tracking sample is because the tracking path history will be increased very quickly as the time goes on.
Please let us know if any questions.
Thanks,
Troy
So my next question (2 parts) is on using Heading to rotate a Marker. Is there any recommended approach or method to rotate a marker for our heading direction. Since the Marker is a Control, I am guessing that like any .NET control the image would have to be pre-rotated then applied to the control or the image would look cut-off due to auto-sizing of the control.
Next Part, If we decide to stay with using Features instead of Markers is there an easy way to detect when the mouse is over a feature or has clicked a feature? I saw a few older examples of the clicking but they don’t seem to work correctly.
Hi Dave,
For the marker rotation, there is not an exist method or API for marker. But I have some ideas:
- we can prepare for several direction images and then choose a direction image based on the angle for the marker.
- Rotate the marker image on the fly. The attached is a rotate help method, it may be not elegant but show how to do it.
For the second part, I think we need to use featuresource.GetFeaturesContaining to get the feature dynamically, I found we have a sample is exact the same case, but it is created in WPF. I think the codes are almost the same as Winform, would you please check it and let us know if you need a winform edition sample. Btw, which samples you were checking so we can make it works fine if not work well?
wiki.thinkgeo.com/wiki/Source_Code_WpfDesktopEditionSample_HighlightAtMouseHover_CS_120131.zip
wiki.thinkgeo.com/wiki/Map_Suite_Wpf_Desktop_Edition_Layers_%26_FeatureSources_Samples#Highlight_at_Mouse_Hover
Thanks,
Troy
001_codes.txt (1.96 KB)
Hi Dave,
For the marker rotation, there is not an exist method or API for marker. But I have some ideas:
- we can prepare for several direction images and then choose a direction image based on the angle for the marker.
- Rotate the marker image on the fly. The attached is a rotate help method, it may be not elegant but show how to do it.
For the second part, I think we need to use featuresource.GetFeaturesContaining to get the feature dynamically, I found we have a sample is exact the same case, but it is created in WPF. I think the codes are almost the same as Winform, would you please check it and let us know if you need a winform edition sample. Btw, which samples you were checking so we can make it works fine if not work well?
wiki.thinkgeo.com/wiki/Source_Code_WpfDesktopEditionSample_HighlightAtMouseHover_CS_120131.zip
wiki.thinkgeo.com/wiki/Map_Suite_Wpf_Desktop_Edition_Layers_%26_FeatureSources_Samples#Highlight_at_Mouse_Hover
Thanks,
Troy
001_codes.txt (1.96 KB)
Thank you for the help. I was able to get a MouseOver and RightClick working with Features. Once I’ve refined my code a bit I will share some of the code up in this post for others who may need to reference it.
Hi Dave,
You are welcome and thanks for your generous sharing.
Please let us know if you have any other questions.
Thanks,
Troy