User Tools

Site Tools


map_suite_wpf_desktop_edition_faq_zooming_panning_moving

Map Suite Wpf Desktop Edition FAQ Zooming Panning Moving

How do I center my map using Decimal Degrees when I map is projected?

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

Sample:Center Map Based On Lat/Long

In today’s web project, we show how to have the map centered and zoomed in according to some maximum and minimum longitude and latitude values. Doing this on a map using decimal degrees is a pretty straightforward operation but if you want to do this on a map displaying Google Map or other providers such as Virtual Earth, it requires some handling of projection. In this project, we show a concrete case, where Google Map is set to an extent corresponding to Florida according to the maximum and minimum longitude and latitude values.

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.

How do I zoom to the full extent based on a collection of layers?

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

Sample:Zoom to Full extent

This project shows you how to set the current extent based on a collection of layers. You can use this technique for the common task of having the map set to the full extent. Instead of having to manually set the full extent, now you can pass all the layers you want the full extent to be based on.

Sample:Zoom to Full extent

Today we have the first project in the Map Suite WPF Desktop version. This is a simple project that shows how to set the current extent based on a collection of layers. You can use this technique for the common task of having the map set to the full extent. Instead of having to manually set the full extent, you can pass all the layers you want the full extent to be based on. This project will be followed by many other WPF projects due to the increasing popularity of that Map Suite version.

How do I add additional, more granular, ZoomLevels to the twenty predefined ZoomLevels?

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

Sample:Zoom Levels Partitioning

Map Suite API conveniently offers 20 predefined zoom levels to set the different styles. With those 20 predefined zoom levels, at any change of extent, the map will snap to the nearest zoom level. While this is appropriate in most cases, you may want a more granular control on the zoom levels. This project shows how to set intermediate zoom levels between the existing predefined ones for more granularity. Since the zoom levels are based on scales, you can still use the predefined zoom levels to set the styles and have the additional custom zoom levels for more refined control on zoom level snapping. In this project, we have the WorldMapKit WMS as a layer and a regular point based shapefile. You can see how the intermediate custom zoom levels have the effect of stretching the WMS image to better fit. This is a Desktop project and you will need the full or evaluation references to MapSuiteCore.dll, DesktopEdition.dll and WorldMapKitWms.dll.

How do I zoom in and center the map based on where the user clicked?

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

Sample:Zoom In To Point

This project is for DesktopEdition users. As for the project TrackZoomInWithoutShiftKey, we show how to create a new class from InteractiveOverlay. InteractiveOverlay is a powerful way to interact with the map but it currently lacks documentation. While this project does not substitute a good documentation, it shows some techniques for using that class. You can take a look at the overriding method MouseDownCore to see how in a few lines of code, you can allow the users to have the map zoomed in and centered to the location the map was clicked on. In the next major public release of Desktop Map Suite, we will present a more complete documentation on InteractiveOverlay.

How do I highlight and zoom in to a specific feature?

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

Sample:Zoom In To Feature

This sample is similar to the sample “Find The Feature The User Clicked On” of the How Do I apps of the Web Edition. Here instead of showing information of the selected feature, we have the feature highlighted and the extent of the map set to the bounding box of that feature. Just click on a country and the map will zoom in to it.

How can I create custom zoom levels?

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

Sample:Custom Zoom Levels

In the project, “Zoom Levels Partitioning”, we showed how to partition the existing predefined zoom levels to have a finer level of control on how to display layers based on scale. In today’s project, we show how to set your own ten zoom levels based on a reference scale, each zoom level being half in scale of the previous one. So, in this case, we limit the number of zoom levels to ten instead of the twenty predefined ones.

How do I get the current ZoomLevel when the scale changes?

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

Sample:GetZoomLevel

In today’s project, we are going to show how to get the zoom level of the map each time we change its extent. Using custom zoom levels, you will see how to get the zoom level with its characteristics such as the upper and lower scale defining it. You can read the comments inside the project to better understand the relationship of scales with zoom levels.

How do I load an image layer when I don't have a world file but know the extent?

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

Sample:Raster Layer with extent

The purpose of this project is to show the alternate way to load a regular image layer such as tiff if you don’t have a world file but know the extent of the image in world coordinate. To accomplish that, you can use a RectangleShape. In this project, you will also find more info on the world file and what the different parameters mean.

How do I get and set the map scale?

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

Sample:Map Scales

With Map Suite, you can both set and get the scale of your map. In this project, we show some tricks on how to manipulate a scroll bar that allows setting the map at a scale from 1:1,000 to 1:40,000,000. We also show how to use a text box to set the map to the exact desired scale.

This project is also an opportunity to review the very basic concept of scale in GIS. The easiest way to think about scale is to think about a ratio between what you see on the screen and the real world. So, if the scale is 1: 10,000 it basically means that one centimeter (you can use any unit) on the screen represents 10,000 centimeters (or 100 meters) in the real world. Of course, there are some intricacies related to calculating the scale for a map according to the projection etc. But, if you think in that very simple way, you will have at least an idea what the scale represents for your maps.

How do I restrict extent for panning and restrict extent for zooming out?

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

Sample:Restricting Extent

In this sample, we show some technique for restricting the users from navigating the map beyond a certain area of the map. For this type of behavior of the map, two types of restricted extents are combined, one for panning and another larger one for zooming out. You want to handle two restricted extents to allow the users to pan and still zoom out within the restricted area. Notice that all the logic for restricting zooming out or panning is handled in the CurrentExtentChanging event.

map_suite_wpf_desktop_edition_faq_zooming_panning_moving.txt · Last modified: 2015/09/08 03:46 by admin