User Tools

Site Tools


map_suite_wpf_desktop_edition_faq_vehicle_tracking

Map Suite Wpf Desktop Edition FAQ Vehicle Tracking

How do I show a bread crumb trail behind a moving vehicle?

This question has a corresponding sample application(s) associated with it.

Sample: Bread Crumb Trail

An early project of the Code Community, “Vehicle Direction”, showed how to rotate the icon of a moving vehicle based on the direction. In today’s project, we are going one step further and we are showing how to display dynamically a bread crumb trail as a trailing tail behind the moving vehicle. For this purpose, we are creating a new LineShape with the latest points at every new position.

How do I center and rotate my map based on a moving vehicle?

This question has a corresponding sample application(s) associated with it.

Sample:Centering On Moving Vehicle

A commonly requested feature when tracking a vehicle for GPS application is to have the map centered on a vehicle as it moves. Implementing this is fairly easy with Map suite using the CenterAt API. In this project, you will see this feature in action with a vehicle represented by a vehicle icon being always the center of the extent of the map. You can also take advantage of this project to learn some other techniques related to GPS such as reading GPS data from a text file and applying a rotation angle to show the direction.

Sample:Centering and Rotating

In the project “Centering On Moving Vehicle”, we learned how to have the map always centered on a moving vehicle. In this project, we go one step further and show how to have the map also rotating according to the direction of the moving vehicle. In this project, you will also see how to use the CompassAdornmentLayer that always indicates the north as the map rotates.

Sample:Centering Map with Tolerance

In the previous project, we showed how to center the map on a moving vehicle. While this is great, it has the disadvantage of having to refresh the map each time the vehicle changes position. In this project, we respond to this inconvenience by using a set tolerance used for determining if the map needs to be refreshed or not. If the vehicle moves within a rectangle of a certain size located in the center of the current extent of the map, the map will not refresh and only the moving vehicle will. If it moves outside the tolerance area, the entire map will be refreshed and the tolerance recalculated.

Sample:Centering And Rotating WPF

This project is the Wpf version of the services edition sample “Centering and Rotating On Moving Feature”, where we learn how to have the map always centered and rotated based on the location and direction of a moving vehicle. This issues addresses some issues you have to be aware of regarding both ShapeFileFeatureLayer and InMemoryFeatureLayer when applying rotation to the map.

How can I display a chemical plume for spatial analysis?

Sample:Chemical Plume

In this project, we show how simple it is to display and do spatial analysis with chemical plumes. The US department of transportation sets standards for protection and isolation zones according to the type of chemical involved. You can find all that publicly available information at http://www.phmsa.dot.gov/
With Map Suite, you can easily build those zones, display them and do spatial analysis.
You will notice an interesting feature of this project is that it combines WorldMapKit wms for street map background display and the actual vector street data for analysis.
For this project, you will need the very latest evaluation or full edition of MapSuiteCore.dll and WorldMapKit Wms.dll for displaying the background street map.

How can we update a moving vehicle when its position has changed?

This question has a corresponding sample application(s) associated with it.

Sample:Detect GPS

Upon request of our users, today we publish a project that is the Desktop version of “Detect GPS” for Web. Notice how we use ValueStyle and change the column value of the feature based on the Spatial Query feature at each new position. We chose this structure so that you can have more flexibility for adding more than one moving vehicle features to the InMemoryFeatureLayer. For that, you can pretty much keep the same code and just add an outer loop for looping thru all the moving features.

How do I snap a GPS coordinate to the closest street?

This question has a corresponding sample application(s) associated with it.

Sample:Snap GPS to Street

In this sample we are going to handle the common case of snapping a point to a set of features in a layer. The common case for this is snapping real-time GPS points to road layers. GPS has an error factor and it's nice to display vehicles on a map snapped to the roads they are on. It can also be used for a number of other different cases as well, such as finding not just the road position but the road name. You may display or store the road name for the trip in your database. In the sample we have set up a road layer; when you click on the map it will find the closest road segment within a tolerance and snap the point to that road. You can click repeatedly around a road and simulate GPS points coming in. Inside of the sample, we have encapsulated the functionality into a method that can easily support multiple layers, varying tolerances, and different data units.

How do you filter a radar image?

This question has a corresponding sample application(s) associated with it.

Sample:Filter Radar Image

NOAA (National Oceanic and Atmospheric Administration) makes available for the public Radar images http://radar.weather.gov/ridge/Conus/RadarImg/ Those images show the precipitation activities based on the whole range of dBz scale. (see http://en.wikipedia.org/wiki/DBZ_%28meteorology%29) You might want to keep only dBz scales superior to 20 which correspond to actual rain. You might also want to add some transparency to better show the layers below the radar image. This project shows how to filter the image for that purpose. You will see how to create a new filtered image better fit to be displayed on the map. You will find particularly interesting the power of using directly the GDI+ API which is very handy with dealing with a Map Suite GDIPlusRasterLayer.

How do I rotate an icon based on a column value?

This question has a corresponding sample application(s) associated with it.

Sample:Rotate Icon

In the “How Do I” windows apps, there is sample “Efficiently Move A Plane Image” that shows a plane moving across the map from west to east along the Great Circle path. A flaw in this sample is that the plane is always shown flying in one direction regardless of the curve of the path. In today’s project, we learn to correct that by setting an angle to the image. The key function is GetAngleFromTwoVertices. You can take this function is apply it to your vehicle tracking needs. It can be used to display any moving vehicle with the orientation according to the heading direction.

Sample:Rotated Image Style

This project shows how to use an icon to rotate it according to the direction of some GPS readings. An InMemoryFeatureLayer is used with various Features representing vehicles. For representing the symbol a Custom Style is created inheriting from Style. Notice that the Custom Style overrides the methods DrawCore and GetColumnNamesCore. You will also see how to update the X and Y value of the PointShape making up each feature. This project is based on the Servicess edition, I recommend also to look at the project Vehicle Direction which is a Desktop App. The difference is in the use of the Layers and the drawing techniques to update the position and symbol of the features.

Sample:Vehicle Direction

This project is similar to RotatedImageStyle project, but shows in more detail how to use RotatedImageStyle with the Desktop edition. You will see the technique on how to use the Desktop specific OverLays collection to update each Layer. This project forms a good foundation for displaying moving vehicles on a Desktop application.

How do I update the label for a moving vehicle?

This question has a corresponding sample application(s) associated with it.

Sample:Moving Vehicle with Label

As many of the Map Suite developers build applications with the common task of tracking vehicles, in today’s project we show how to update the label of a moving vehicle. The InMemoryFeatureLayer has all the tools necessary to display and label dynamically with editing a moving feature. In today’s project we show in a label the changing Longitude and Latitude each time the vehicle position is updated.

map_suite_wpf_desktop_edition_faq_vehicle_tracking.txt · Last modified: 2015/09/17 01:03 by admin