User Tools

Site Tools


map_suite_mvc_edition_zooming_panning_moving_samples

Map Suite MVC Edition Zooming Panning Moving Samples

Center Map Based On Lat/Long

map_suite_web_edition_sample_center_map_based_on_latlong.jpg

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.


Centering Map with Tolerance

map_suite_web_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.


Customize ZoomLevels

This web-based project demonstrates how to customize the ZoomLevels of your Map Suite Web Edition map. There are 20 default ZoomLevels, but sometimes they don’t fit your requirements. In that case, you can specify your own scale which corresponds to a certain ZoomLevel. It’s easy to do and requires just a few lines of code.


GetZoomLevel

map_suite_web_edition_sample_get_zoomlevel.jpg

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.


Map Scales

map_suite_web_edition_sample_map_scales.jpg

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.


Moving Features with Ajax

map_suite_web_edition_sample_move_features_with_ajax.jpg

For our first Visual Studio 2010 sample, we use a Web app for showing how to have features moving smoothly on the map without PostBack and using Ajax. In this sample, you will find three ways to move dynamically features on the map, one using regular PostBack, one using OpenLayers and one using Ajax. For this sample, you will need Visual Studio 2010 and you will need references to the 4.5 version of MapSuiteCore.dll and WebEdition.dll.


Raster Layer with extent

map_suite_desktop_edition_sample_raster_layer_with_extent.jpg

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.


Restricting Extent

map_suite_desktop_edtion_sample_restricting_extent.jpg

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.


Zoom In To Feature

map_suite_web_edition_sample_zoom_in_to_feature.jpg

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.


Zoom In To Point

map_suite_web_edition_sample_zoom_in_to_point.jpg

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.


Zoom Levels Partitioning

no_screenshot.jpg

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.


Zoom to Full extent

map_suite_web_edition_sample_zoom_to_fullextent_wpf.jpg

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.


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.


Custom Zoom Levels

no_screenshot.jpg

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.


Zoom to Full extent

map_suite_services_edition_sample_zoom_to_fullextent_service.jpg

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.

Map Suite License File Generator

The Map Suite License File Generator shows how to take the advantage of MapSuiteLicense.dll to create the Map Suite Production Server license in your application on the fly. When you activate a Map Suite Production Server license that you have purchased, that license is verified with ThinkGeo’s online servers as part of the activation process. The simple process ensures that you are activating a license that you are entitled to. ThinkGeo takes care of all the particulars, and the process is seamless if you have an internet connection.

NOTE: please ask support@thinkgeo.com for MapSuiteLicense.dll

map_suite_mvc_edition_zooming_panning_moving_samples.txt · Last modified: 2015/10/10 07:31 (external edit)