User Tools

Site Tools


map_suite_wpf_desktop_edition_vehicle_tracking_samples

Map Suite Wpf Desktop Edition Vehicle Tracking Samples

Note: The page was created before Map Suite 10. Map Suite 10.0 organized many classes into new namespaces and assemblies as well as had a few minor breaks in compatibility. The majority of previously built code should work without modification assuming the new namespaces are added. For guidance on upgrading your existing code, please check out MapSuite 10 Upgrade Guide.

map_suite_wpf_desktop_edition_sample_bread_crumb_trail.jpg

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.


Centering And Rotating WPF

map_suite_wpf_desktop_edition_sample_centeringandrotatingwpf.jpg

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.


Centering Map with Tolerance

map_suite_wpf_desktop_edition_sample_centering_map_with_tolerance.jpg

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.


Detect GPS

map_suite_wpf_desktop_edition_sample_detect_gps.jpg

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.


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.


Traveling Salesman Problem

map_suite_wpf_desktop_edition_sample_traveling_salesman_problem.jpg

In today’s project, we are seeing a variant of the sample “Traveling Salesman Problem” of the “How Do I” samples of the Routing product. At the request of a Discussion Forum user, we added a new API to the GetRouteViaVisitStops function where now you can have distinct start and end points. For being able to run this app, you will need the version 3.1.427.0 or later.


Vehicle Direction

map_suite_wpf_desktop_edition_sample_vehicle_direction.jpg

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.


Centering and Rotating

map_suite_services_edition_sample_centering_and_rotating.jpg

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.


Centering On Moving Vehicle

map_suite_services_edition_sample_centering_on_moving_vehicle.jpg

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.


Chemical Plume

map_suite_services_edition_sample_chemical_plume.jpg

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.


Filter Radar Image

map_suite_services_edition_sample_filter_radar_image.jpg

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.


Rotated Image Style

map_suite_services_edition_sample_rotated_image_style.jpg

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.


Snap GPS to Street

map_suite_services_edition_sample_snap_gps_to_street.jpg

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.

map_suite_wpf_desktop_edition_vehicle_tracking_samples.txt · Last modified: 2017/03/17 02:10 by tgwikiupdate