User Tools

Site Tools


map_suite_wpf_desktop_edition_faq_all_questions

Table of Contents

Map Suite Wpf Desktop Edition FAQ All Questions

What is the difference between Map Suite WPF Desktop Edition and the standard Map Suite Desktop Edition?

The standard Map Suite Desktop Edition comes with two types of GIS controls: a Winforms control and a WPF control. The WPF control included with the standard Desktop Edition is built on the same codebase as the Winforms control, and thus doesn't take advantage of many of the new technologies being offered by WPF.

In contrast, Map Suite WPF Desktop Edition includes a natively-designed WPF control for GIS. This new control has been redesigned from the ground-up to leverage many of the advantages of WPF, including direct canvas drawing, multi-threaded drawing, transitions during panning and zooming, and much more. If you want to build a WPF application with Map Suite, then Map Suite WPF Desktop Edition will deliver a broader range of features and capabilities.

It should be noted that both the standard Desktop Edition and the new WPF Desktop Edition support the same framework of GIS core features, including renderers, track shapes, geometric functions, data format support, and so forth.

Do I have control over how the map looks and fits into my application?

Yes, absolutely. Map Suite WPF Desktop Edition is a control, so you can easily integrate it into your application just like any other control from the Toolbox. We expose a large amount of APIs that allow you to customize every aspect of the map and the user interface so that they fit in with the look and feel of your application.

What other software is required to work with Map Suite WPF Desktop Edition?

To work with Map Suite WPF Desktop Edition, you will need a copy of Microsoft Visual Studio or Visual Studio Express to build the code for your custom application.

What type of map data does Map Suite WPF Desktop Edition Support?

Map Suite WPF Desktop Edition lets you use virtually any map dataset of your choosing. If you have your own map data you can use it, or you can utilize our Map Suite World Map Kit extension or other base maps like Google Maps, just to name a few options.

What formats can my data be in?

Map Suite WPF Desktop Edition comes with native support for the most popular vector and raster file formats, and includes a free extension that enables support for more than a dozen more vector formats and more than 80 raster formats. If you have spatial data or imagery, chances are you can use it with Map Suite. Check our Developer Blog for the master list of data formats that Map Suite currently supports.

How big of a learning curve is there to using Map Suite WPF Desktop Edition?

Map Suite WPF Desktop Edition was designed to be easy to understand and easy to use. While mapping/GIS controls typically have a larger learning curve than other simpler controls like grids or charts, we feel Map Suite has taken the complexity out of mapping and allows you to develop your application in days or weeks instead of months or years.

Where do I go if I need help with Map Suite WPF Desktop Edition?

We have a very active Developer Community discussion forum, a large number of “How Do I?” sample applications with source code in VB.NET and C#, and we also offer professional services if you need to talk with a developer one-on-one.

What is the difference between Map Suite WPF Desktop Edition and Map Suite Services Edition?

Map Suite WPF Desktop Edition comes with built-in functionality to construct a robust user interface in a desktop environment, while the Services Edition is designed for back-end applications like web services, Windows services and console applications where no user interface elements are needed.

Are there add-ons or extensions for Map Suite that add new features?

Yes. We offer a number of Map Suite add-ons that extend the functionality and map coverage of your application, including the World Map Kit dataset plugin, and the Routing Extension that generates routes, turn-by-turn directions and more. Additionally, check out the Map Suite Code Community for an ever-expanding number of add-on projects that bring new features and ideas to your Map Suite projects - there's something new each week.

How do I reprojected a decimal degrees shape file to display on Google Maps?

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

Sample:Shapefile to Google Map

In the project “GPS to Google Map”, we learned how to project a single point in Longitude/Latitude so that it displays correctly on Google Map. In today’s project, we apply the same principle of projection to a shapefile to have it showing on Google Map. Notice how we also set the extent of the map based on the projected shapefile.

How do I show GPS data in decimal degrees on Google Maps?

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

Sample:GPS to Google Map(Desktop)

Today we have the Desktop version of the Web project “GPS to Google”. In this project, we show how to display on Google Map point data coming from some GPS reading in Geodetic (Longitude/Latitude). It also shows how to set the extent of the map so that it is centered on the GPS point.

How do I show a great circle line on Google Maps?

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

Sample:Great Circle with Google Map

The purpose of this Web project is to complete an earlier project “Great Circle on Pacific Rim” which showed how to create the Great Circle between two points over the Pacific with the geodetic projection (decimal degrees). In this project, we apply Great Circle to Google Map showing on the Pacific Rim going from America to Asia.

How do you display OpenStreetMap imagery?

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

Sample:OpenStreetMap

OpenStreetMap (OSM) is a collaborative project to create free geographic data for the entire world. It can be thought of the “Free Wiki World Map”. Now, the latest version of MapSuite desktop can support that. In order to run this project, you will need the Development Build 4.0.72.0 or later.

How do I show a mini map on Google Maps?

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

Sample:Mini map with Google Map

At the request of a Discussion Forum user who wants to know how to use a map locator with Google Map, today we publish a Desktop project that shows how to extent the AdornmentLayer for creating a locator mini map that can use Google Map.

Is there a way to abort a track shape that is current drawing?

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

Sample: Canceling TrackOverlay

This project shows how to implement aborting a trackshape with Esc key as you could do it in MapSuite 2.x. As with Dynamic Info on TrackShape project, it shows how TrackOverlay can be extended to add some custom functionalities. You will see how to handle some events of the map such as KeyDown and how to manipulate TrackOverlay.

How do I override the default behavior of the TrackInteractiveOverlay?

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

Sample:Custom Track Line

In today’s project, we are going to see how to extend the TrackInteractiveOverlay in the Desktop edition to have the desired behavior when tracking a line. In this case, we show how to override the MouseDownCore function to have the line being tracked at left mouse click and have the last vertex added deleted at right mouse click.

Sample:Custom Track Polygon

In the project “Custom Track Line”, we saw how to extend the TrackInteractiveOverlay to have the behavior of deleting the last added vertex when right click on a track line. In today’s project, we show how to implement this same behavior for tracking polygon.

How do I prevent a vertex from being dragged within the tolerance of another vertex while editing?

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

Sample:Vertex Tolerance

Basically, this project shows the opposite of yesterday’s project “Snap To Layer”. Instead of having the dragged control point snapping to a vertex if within a tolerance, we show how to not allow a control point get within a set tolerance. This technique can be handy to implement if you have a requirement to have vertices of a shape being no less than a certain distance between each others. To implement that technique, again we use the power and flexibility of the EditInteractiveOverlay of the Desktop edition.

How do I save tracked shapes to WKT (Well Known Text)?

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

Sample:Tracked Shapes to WKT

In today’s project, we show how to save a tracked shape to WKT (Well Known Text). You will notice that we make the distinction between the shape being tracked and the finished tracked shape thanks to two different events of TrackOverlay, TrackEnding and TrackEnded.

How do I use the track zoom feature without the shift key?

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

Sample:Track Zoom In Without Shift

This project is for DesktopEdition users. In Map Suite 2.x, different modes of the map are offered to the developer to choose what kind of behavior the map has at a mouse action. In Map Suite 3.x, we went away from modes to have a more flexible model using InteracticeOverlay. By default, track zoom in is done by clicking and dragging the mouse on the map while holding the Shift key. This is very convenient but what if you want to offer the users the same experience as with 2.x, where the same mouse action has different behavior such as TrackZoomIn and Pan through the use of modes. In this project, we show how to build your own InteractiveOverlay to emulate in Map Suite 3.x the mode behavior 2.x has.

How do I snap vertices while editing?

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

Sample:Dragged Point Style

In the Discussion Forum Post “Snapping help needed”, we show the solution to have a dragged vertex snapping to a vertex of another layer. You can see that by default the control point being dragged turns yellow. In this project, we focus our attention on how to have control on the style of the control points. You will see how to override the DrawCore function of EditInteractiveOverlay. This is a project for the Desktop edition.

How do I add labels to control points while editing?

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

Sample:Dragged PointStyle with Label

In our series of projects dedicated to EditInteractiveOverlay, today you will see how easy it is to add some labeling to your dragged control point showing dynamic information. Here we show how to display the distance from the dragged control point to the closest point of a reference shape. Also, to augment the experience of the user, the closest point of the reference shape is also shown varying as the control point is dragged around.

In the GIS field, enterprises have different needs on how they edit there data and on how smooth the editing should be allowing the maximum control and precision to the technician editing the data. This example on how to use the EditInteractiveOverlay demonstrates how powerful and flexible editing is with Map Suite map control.

How do I drag and drop icons on the map?

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

Sample:Dragging Icon

In today’s sample, we show how to drag icons representing vehicle on the map. This is a handy feature if you want to give your users the ability to drag and drop some non stationary features such as vehicles. You can see that to accomplish this functionality, you can use EditInteractiveOverlay as it already has all the necessary logic for dragging purposes. Look at the code to see how to set up that overlay to have the expected behavior.

Sample:Dragging Icon Advanced

This project is a more complete version of a previous project “Dragging Icon”. In addition to showing how to use EditInteractiveOverlay for dragging and dropping features represented by an icon, we also show how to add new features on the map by left double clicking on the map. You will also see how to remove a feature by right double clicking on its icon.

How do I enable snapping while editing?

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

Sample:Snap To Layer

This project shows how you can apply snapping to an EditInteractiveOverlay. There are many aspects to snapping. Previously, we showed a project with the mouse pointer snapping to the closest vertex of an editable polygon. Today, we show the technique to drag a control point and have it snap to the closest vertex of a layer if within tolerance. The tolerance can be set in world (meter, feet etc) or screen (pixels) coordinates. Notice that we are also using the technique showed in the previous project “Dragged Point Style”.

Sample:Snapping to Vertex

This project is the first one of a series that will be dedicated to snapping using InteractiveOverlay. In this project, we show how to snap the mouse pointer to the closest vertex of an editable polygon if it is within a set tolerance. The tolerance is shown as a circle around the vertices. This technique can also be applied to snapping vertices within the same shape, between different shapes or even based on a layer. Those different types of snapping will be the subject of future projects related to snapping using InteractiveOverlay.

Sample:Snapping to Layer2

The purpose of this Wpf project is to address some limitations of the class SnapToLayerEditInteractiveOverlay found in a previous sample Snap To Layer. This class allowed the snapping of the mouse pointer to the closest vertex of a polygon if it is within a set tolerance. While this worked great for simple polygons, there was a performance limitation with complex polygons made of many vertices. This Wpf sample addresses this limitation and allows responsive dragging and snapping of vertex regardless of the size of polygon to snap to.

How do I display dynamic information as track shapes are being drawn?

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

Sample:Dynamic Info On TrackShapes

This project is for the Desktop version and it shows how to handle TrackOverlay to obtain dynamic information about the shape being tracked.

In this example, you will see displayed in a groupbox, properties such as perimeter and area as the shape is being tracked. In this project, you will learn how to handle events such as TrackStarted, MouseMoved and TrackEnded of TrackOverlay for that purpose. Getting dynamic info of a shape being tracked can be handy in situation where before committing to get the completed shape, you want to know more about the shape. For example, if you are tracking a search zone, you get dynamically info about its area. This project will be followed by other related projects. One will show how to create one’s own inherited TrackOverlay for having the possibility to abort tracking by pressing a key. Another project will show how to display dynamic info inside the shape itself instead of using a separate control.

How do I allow users to edit rectangles?

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

Sample:Editing Rectangles

This sample shows how to extend the EditInteractiveOverlay rectangles as shapes rather than polygon shapes by setting special column values. For features (Well Known Text and Binary), the concept of a rectangle is not supported and typically rectangles are handled as polygons. This feature allows users to modify the rectangle but requires that the modification keep a rectangular form. The rectangle doesn't need to be straight as long as all of the corner angles are at 90 degrees relative to each other.

To activate the feature, you need to assign the value of the column called “Edit” to “rectangle”. The resize function will keep the ratio of width and height of the rectangle, otherwise it will use the original method. For more information you can see the discussion forum post below: http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5822/afv/topic/Default.aspx

How do I change the style of shapes being edited?

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

Sample:EditOverlay Styles

In today’s Web project, we learn how to control the styles of the EditOverlay for both the default style and the editing style. In order to accomplish this, we write some javascript code. Look at the code in the “script” tag to see how we can control the fill color, the opacity, the border width etc of the features in the EditOverlay.

How do I select features from a layer based on a user drawn track shape?

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

Sample:Select with Track Shape

In today’s Desktop project, we combine the skills we learned in the samples “Spatial Query A Feature Layer” and “Track And Edit Shapes”. You can see how we use the event TrackEnded to get the RectangleShape from the tracked shape of TrackOverlay to do the spatial query. In this example, we use a Rectangle but you could also very easily use another shape such as Polygon, Circle, etc.

How do I allow you to drag features based on a column value?

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

Sample:Select and Drag(wpf)

In this Wpf project, we show how to select a feature from a shapefile based on a column value using the GetFeaturesByColumnValue. We also show to setup the EditOverlay to give the user the ability to drag the selected feature. In this project, you can also see how to get the world coordinates at the mouse move event. Notice that the code for doing this is quite different in Wpf compared to the winforms edition.

What should be the standard size of the illustrating picture?

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

Sample:Select Vertices

The purpose of this sample is to help you, the developer understand some intricacies of inheriting from EditInteractiveOverlay when implementing your own editing logic. Here we show how to keep control points drawing as selected even after the dragging operation is finished. For this purpose, we need to override three protected functions, OnControlPointSelected, MouseUpCore and DrawCore. Please, read carefully the comments to understand the inner workings of EditInteractiveOverlay.

How do I Drag/Select Vertices As Group?

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

Sample:Drag Select Vertices As Group

With EditInteractiveOverlay, we know how to drag a feature such as polygon as a whole. We also know how to drag an individual vertex by setting the appropriate properties. Here we go a little further and we show how to create an inherited class from EditInteractiveOverlay to implement the logic for selecting vertices and dragging them as a group. See how the protected methods MouseDownCore, MouseUpCore, MouseClickCore and MouseMoveCore were overridden for that purpose. This is a Desktop app that also applies to Wpf.

How to track Shapes to File?

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

Sample:Tracked Shapes to File

In this Wpf sample, we show how to persist the tracked shapes by saving the WKT (Well Known Text) to a file using the TrackEnded event. Also, you can see how to retrieve the WKT from files to create the features for the TrackShapeLayer of the TrackOverlay when loading the map. You will need the MapSuiteCore.dll and WpfDesktopEdition.dll references for this sample.

How to preset Vertex To Tracked Polygon?

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

Sample:Preset Vertex To Tracked Polygon

This Desktop sample shows how to extend TrackInteractiveOverlay to give the ability to add a preset vertex to a track polygon while tracking. This can be handy in the situations where you need to add a vertex outside the current extent of the map or when you need to add a vertex with precise X and Y values. In the custom PresetVertexTrackInteractiveOverlay, you can see how the protected function GetTrackingShapeCore was overridden to implement this tracking behavior of the polygon.

How can I display decimal degrees as degrees, minutes and seconds?

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

Sample:Decimal Degrees Formatting

The purpose of this project is to complete the static class DecimalDegreesHelper. This class offers functions to go to and from Decimal Degrees but it lacks the functions handling various formats such as Degrees Decimal Minutes and Degrees Minutes Decimal Seconds. Those formats can be output by different GPS devices and it is handy to know how to manipulate them and convert them to Decimal Degrees, the only format that can be input into a GIS or Mapping application.

How do I control how labels are displayed based on fields in the data?

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

Sample:Labeling Based On Columns

As a developer developing a mapping application, you may encounter point based shapefile for labeling. All the characteristics for labeling such as font, size, angle, color can be found in the attribute information of the shapefile itself. This project will show how to create a custom TextStyle that will get the value for those different columns and display each feature accordingly.

How do I adjust the size of the labels based on feature column data?

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

Sample:Labeling based on size

In the sample app “Draw thematic features” of the “How Do I” samples, we show how to use the ClassBreakStyle to display countries based of what population range they belong to. In today’s project, we show some more advanced uses of ClassBreakStyle to show how to label countries based on the area. You will notice that we also take advantage of the various zoom level sets for labeling purposes. The result is an eyed pleasing labeling of the countries with the size proportional to the countries’ area with more labels of smaller countries appearing as you zoom in.

How do I use multiple columns in one label?

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

Sample:Multi Column Labeling

In this project, we show some techniques to label features based on various columns. With the CustomStyles property and CustomColumnFetch event, you will see the flexibility you have to label the way you desire in a few lines of code. In this example, we label volcanoes based on four columns on two lines and using two different font styles.

How do I display multi labels for a given feature?

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

Sample:Multiple Labels

This sample shows how you can display multiple labels for a given point or feature. You can do this by setting a single TextStyle or multiple TextStyles. If you use a single TextStyle, you can simply use a pattern like “ColumnName1[ColumnName2]” and when Map Suite displays the text it will combine the values of the columns in your pattern. If you use a different styling method, you will need to manually control the offset of each piece of text to avoid overlapping.

For more information you can see the discussion forum post below: http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6955/afv/topic/Default.aspx

How do I drag the labels to place them at the desired location?

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

Sample:Draggable Labels

In this wpf project, we are going to show how to place labels from a shapefile into a SimpleMarkerOverlay. Using the DragMode property of the SimpleMarkerOverlay, the user can then drag the labels to place them at the desired location for the most pleasing labeling effect. This project will be later completed to show how to save the state of the dragged labels from the SimpleMarkerOverlay and reload them.

How do I display multi line labeling?

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

Sample:MultiLine Labeling

For labeling purpose, TextStyle has a property called LabelAllPolygonParts that will label all the parts making up a polygon based feature. Unfortunately, we don’t have an equivalent API for labeling all the parts of a line based feature. But thanks to the flexible framework of Map Suite, we show in this Wpf sample how easily you can expand the TextStyle class to allow this labeling capability. Look at the custom class MultiLinetextStyle and how DrawCore function is overridden to have the expected labeling behavior.

How do I save or serialize my objects once I have created them?

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

Sample: Serialize To Xml

This sample shows you how to serialize objects in Map Suite to XML and then deserialze them back to objects. This is usefully in many GIS mapping application to save the state of styles, layers, projections or just about anything. The XML is readable and well formatted, great for working with in you GIS application.

How do I generate source code from objects once I have created them?

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

Sample: Code Generator

This sample shows you how to generate source code calls from Map Suite objects. Imagine that you have a Layer that has been styled a particular way and uses a certain projection. Once the object is created you can pass it to the code generator and it will create source code to re-create the model passed in. This is very helpful especially in GIS applications where users define things through a custom UI but then want to leverage that in code.

How do I export the current extent to a geo-referenced bitmap?

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

Sample:Current Extent to Bitmap

In today’s project we learn how to convert to bitmap the current extent of the map. In order to have the bitmap georeferenced or being tied to the ground an accompanying world file needs to be created. That way it can be used as an image layer along with the other layers of the same projection (in this case geodetic). To test the result, you can load the bitmap to Map Suite Explorer and add a vector layer in geodetic to see how the two layers align with each other.

How do I create a custom scale bar that is accurate in another projection?

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

Sample:Custom Scale Bar

In today’s Web project, we learn how to extend ScaleBarAdornmentLayer to create a custom scale bar that is based on a projection of choice instead of the projection of the map. This can be useful when the displayed projection of the map has highly distortable distances especially at high latitudes such as Spherical Mercator (used by Google Map, Virtual Earth, Yahoo maps etc). Using a scale bar based on distance geometry of the Geodetic (WGS84) projection will give a more accurate result. Note that the CustomScaleBar class is based on MapSuiteCore and can be used in any other versions of MapSuite such as Desktop.

How do I use the map with the MVC framework?

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

Sample:Use Map with MVC Framework

This project demonstrates how to create a web-based map using Microsoft ASP.NET MVC 1.0 and Map Suite Web Edition. To meet the requirements of MVC, we inherit the interface IMapInitializer in the controller, which has a function InitializeMap that is overridden in the controller. We then implement the class “MapInitializerHelper” to initialize the map instance.

How can I draw an exception instead of being thrown during drawing?

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

Sample:Draw Custom Exception

This sample shows how you can suppress and draw exceptions in desktop overlays instead of throwing them. There is a little-known feature in the Map Suite Desktop Edition Overlay class that allows you to draw an exception in the event an exception is thrown during the drawing process. We have a default image we draw in this case; however, you can override this using the DrawExceptionCore method and draw whatever you want. By default we always throw expections, but to start drawing them you can use the Overlay.DrawExceptionMode property.

How do I convert the current extent of a raster layer to a bitmap?

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

Sample:Raster Layer to Bitmap

Today’s project is comparable to “Current Extent to Bitmap” project where we learned how to convert the current extent of the map to bitmap with its accompanying world file. Here we learn how to get the bitmap of a raster layer (in our example a Mr Sid image) and convert it to bitmap. We learn some techniques such as how to get the image size of the raster layer using ExtentHelper static functions and how to manipulate GeoImage. This project brings a good foundation for building applications converting different image formats.

How do I have a map in an MDI form?

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

Sample:MDI Form

In today’s project, we show how to have the WinformsMap control in a MDI form. Using an MDI form with a map background can represent a challenge. You will see in this project the technique to display properly a child form on top of the map. You can also notice how the map is accessed from the child form by plotting points on it from the child form.

How do I display world coordinate on a map?

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

Sample:World Coordinates

The purpose of this project is to complete the section “Screen & World Coordinates” of the “How Do I?” sample apps. You will learn how to display world coordinates at the mouse event. Notice that the Layer is in Mercator projection and we use a projection conversion to display Longitude and Latitude in addition to the world coordinates values in meters from the Mercator projection. Also, we are reusing the DecimalDegrees static class we used in a previous project for formatting decimal degrees.

How do I display proper world coordinates when a map is being rotated?

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

Sample:World Coordinate with Rotation

In the “How Do I” sample apps, in the section “Projection”, you can find the sample “Use RotationProjection for a feature layer”. It allows to basically rotating the map to any angle. You can see how useful this can be by having the map rotated according to a vehicle direction, for example. Now, what is missing in this sample are the world coordinates in the status bar at the mouse move event. Today we show how to do that and what technique to use.

How can I change the datum while keeping the projection the same?

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

Sample:Datum Transformation

The purpose of today’s project is show how to handle the scenario where you have to apply a datum transformation to your data while keeping the same projection. This project addresses some confusion that might exist about the difference between datum and projection. We take a concrete example of a point in degrees using the ED50 datum and we apply a datum transformation so that it is in degrees using the WGS84 datum. Please, read carefully the comments to better grasp some key concepts.

How do I get the intersecting point of two streets?

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

Sample:Street Intersection

From a request in the Discussion Forum, we decided to post a project today related to street intersection. In this project, we show how to get the intersection point of two streets. Basically, we get all the street features according to the street name and based on the shapes from those features, we do use some geometric function to determine what the intersection point of those two streets is. Keep in mind that the code provided in this sample app might not be the fastest or more optimized but it basically shows the algorithm for that purpose. This algorithm will be used to complement the Map Suite Geocoder product for Intersection geocoding.

How do I know which state plane projection to use based on a decimal degree point?

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

Sample:Geodetic to State Plane

Having to project a layer from geodetic (decimal degrees) to State Plane is a common task in GIS. One of the challenges is to know what State Plane zone a layer belongs to. This project is basically a little utility for State Plane projection needs. With the help of the State Plane zones layer provided, any layer in geodetic can be projected automatically to State Plane without having to do research to know the specific zone a layer belongs to. The opposite task (that comes even more frequently) of going from State Plane to Geodetic is unfortunately impossible to accomplish the same automatic way.

How do I automatically project my decimal degree data to UTM?

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

Sample:Geodetic to UTM on the fly

A common situation with dealing with geographic data from different sources is to have to “match” data in decimal degrees (Geodetic) with data in the local system of UTM. For example, you may have vector data in decimal degrees and an image in UTM. Projecting vector data is always more straightforward than projecting image data, that is why it is preferable to project the vector data to the image, rather than the opposite. In this project, we show the example of projecting a vector layer in decimal degrees (Geodetic) to UTM to “match” a tiff in that projection.

The appropriate EPSG number for our example can be found at: http://spatialreference.org/

How do I convert shape file data from one projection to another?

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

Sample:Save To Projection

In the Projection section of the “How Do I” sample apps, there is a sample app that shows how to project on the fly a layer in one projection to another. While this is useful, you may be in the need to actually create a new layer in the desired projection. This project shows how to use the API SaveToProjection of ShapeFileFeatureLayer. In this project we use the example where you need your data in a regional projection saved to WGS84 (decimal degrees) to match other data such as GPS readings or the WorldMapKit.

How do I route in one projection and display the route information in another projection?

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

Sample:Routing with Projections

From a Discussion Forum request, in today’s project we show how to perform routing in one projection and display the result in another. You may be in the situation where you have your routable street data in State Plane meters and you have your base map in Geodetic (decimal degrees). This project shows you how to handle this case.

How do I show a great circle line across the pacific rim?

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

Sample:Great Circle on Pacific Rim

This project extends what we learned in Pacific Rim. We show how to apply the Offset projection to Great Circle to have it displaying correctly over the pacific as opposed to Google Map where the same Great Circle is shown broken down.

How can I visualize the distortion of a projection will cause on my data?

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

Sample:Projection Distortion

Today’s project is more about learning and raising awareness about map projections than about a specific programming technique. By monitoring the Discussion Forum, we have encountered a large number of questions related to projections and distances. Many Map Suite users are unsettled by getting different distances from the same locations on various projections. To try to demystify this a little bit, we show how a regular grid on lat/long points get distorted in various ways depending on the projection applied. By visually seeing the distortion happening, it helps understand why distances can vary so wildly. You will also find some link to study this topic a little further if you wish.

How do I measure the distance of a line accurately in different projections?

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

Sample:Projection Distance LineStyle

This Web project is similar to the project “Distance Line Style”. Here we show how to use a projection of choice different from the projection used on the map. For example, you may have your map using Google map as a background. Google map uses Spherical Mercator projection which is not ideal for distance measurements, that is why using a more appropriate projection for distance measurement such as State Plane will give more accurate results. The CustomDistanceLineStyle inheriting from LIneStyle has the logic built in to have the distance calculated based on a projection of choice instead of the projection of the map. As for the previous project “Distance Line Style”, you can see how the DrawCore function is overridden for the a specific need of style: displaying the distance label on each line segment making up a LineShape. In addition to the overriding of the DrawCore function, you will find useful some geometry functions such as GetPointOnLine to find the midpoint of a line segment and GetAngleFromTwoVertices to incline correctly the labels according to the orientation of each line segment. You will notice that the CustomDistanceLineStyle works for features made of LineShape and you will have to slightly modify to have it working with MultilineShape.

How do I display a polygon across the Meridian?

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

Sample:Polygon across Meridian

Following a request from the Discussion Forum on how to handle cases where the shape straddles the 180 degree meridian on a Decimal Degree map, we created this project. The solution is to split the shape into two main parts to be displayed on the two ends of the map. In this case, we use the case of a Polygon but this could easily be adapted for any other shapes such as lines.

How can I get an accurate measurement between two points in decimal degrees?

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

Sample:Measurements Decimal Degrees

This project is in response to a Discussion Forum post that has generated plenty of debate on the meaning of measuring area for shapes in decimal degrees. In this project, you will see how to get area and length measurements according to the projection used from a shape in decimal degrees. For more information on why different measurements can be obtained from the same shapes, please read the Discussion Forum “GetArea on Buffered shape not working as expected” http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6565/afv/topic/Default.aspx

How do you display the Pacific Rim area?

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

Sample:Pacific Rim

This project shows how to display the Pacific Rim and Asia if you pan to the west, so that the world “wraps around,” as it does with Google Maps. Many of our Map Suite sample applications include an example of the world being displayed using a world ShapeFile. The ShapeFile is in Decimal Degrees and it displays the world according to longitude and latitude value ranges. These ranges are from -180 to 180 for longitude and 90 to -90 for latitude. In our various examples that use this ShapeFile, you see the Western Hemisphere on the left and the Eastern Hemisphere on the right. Now, a common request that we receive is to display the Pacific Rim and Asia if you pan to the west, so that the world “wraps around,” as it does with Google Maps. This can be accomplished in Map Suite 3.x by using a custom projection that offsets all of the points by 360 for the x (longitude) values. (180 + 180 = 360). You will see how to create OffsetProjection class inheriting from Projection. Notice the code in the overrided method GetexternalProjection. It simply loops thru all the points making each feature and offset the X value by 360.

How to use GetFeaturesWithinDistanceOf/GetFeaturesNearestTo methods when the data is reprojected?

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

Sample:Distance Query on Projected Layers

In this sample, we learned how to use the method GetFeaturesWithDistanceOf when the data is projected. We just input the unit which is projected to, do not need to mind what the real unit is for the internal data before projection. It works fine with Map Suite Assemblies 4.5.54.0 or later.

How to wrap dateline?

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

Sample:Wrap_Dateline_Mode

In this Wpf project, we show a new property of Overlay, WrapDatelineMode. When you set this property to WrapDatelineMode.WrapDateline, the overlay will display to the right or left as you continuously pan west or east. This is very useful when dealing with world maps and you want to display the pacific rim as one extent. You have to be aware that this feature comes with some limitations. For example, on the “virtual” maps, the world coordinates are no longer valid and you need a special projection that we created (WrapDatelineProjection) to have the world coordinates displaying correctly. In order to run this sample, you will need the latest Dev Daily Build for Wpf with references to MapSuiteCore.dll and WpfDesktopEdition.dll.

Sample:Wrap Dateline Mode With Projection

In this Wpf project, we show a new property of Overlay, WrapDatelineMode. This property that allows to continuously pan west or east with world map was already available in the dev branch. This concept was shown in the previous sample “WrapDatelineMode”. Now it is fully supported in Map Suite 5 and you can see in this sample how the behavior for the map in both Decimal Degrees (Lat/Long) and Spherical Mercator (Google Map/Bing map projection). In order to run this sample, you will need the latest release for Wpf with references to MapSuiteCore.dll and WpfDesktopEdition.dll.

How to use distance query on wrap dateline mode?

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

Sample:Distance Query on WrapDatelineMode

In this Wpf sample is on the same theme as the previous sample WrapDatelineMode. Here we show how to take advantage of the projection class WrapDatelineProjection for doing spatial query when on a “virtual map”. From this spatial query example, the developer should understand how the same principle using the same projection class can be applied for other operations such as Spatial Queries, Identify etc. In order to run this sample, you will need the latest Dev Daily Build for Wpf with references to MapSuiteCore.dll and WpfDesktopEdition.dll.

How to use custom parameters projection?

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

Sample:Custom Parameters Projection

In today’s Wpf project, we learn more about projection and how to handle a special case where the projection information in the PRJ file of a shapefile is not found as an EPSG or ESRI code in the spatial reference web site (www.spatial-reference.org). The strategy in this case is to build a proj4 string based on the parameters found in the PRJ file. Note that you must pay special attention to the false easting or northing parameters as they are always expressed in meters even if the projection is in another unit such as feet. For this example, we show how to convert from the local projection in Lambert Conformal Conic with regional specific parameters to Geodetic (WGS84) to match the World Map Kit.

How to use custom rotation projection?

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

Sample:Custom Rotation Projection

In today’s project, we show how to create your own projection class that allows projecting a layer from any internal projection to any external while doing a rotation at the same time. Having the capability to apply those two operations in one step may come handy if the original layer was created in a different projection with the north at an angle and you want to align it on the base map. This is a Wpf project and you will need references to MapSuiteCore.dll and WpfDesktopEdition.dll to run it.

How to use local datum UTM?

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

Sample:Local Datum UTM

The purpose of this Wpf sample is to get familiar with the concept of datum and datum shift in UTM and Geographic coordinates. Using local data, you might be required to apply datum transformation to your data to go from an old datum to a more recent datum. Here we are taking the example of Australia which went to change its datum (from AGD84 to GDA94) for its mapping purposes. We show how to apply the datum transformation in both the longitude/latitude coordinate system and in the local UTM systems (AMG based on AGD84 and MGA based on GD94). See the code and read with attention the comments in the MouseMove event where all the projection logic is taken place. Notice that the correction is about 200 meters. Once you understand for the case of Australia, you will be able to apply the same principles for your own datums in UTM. For further reading: http://www.cage.curtin.edu.au/~will/datum.html http://www.usq.edu.au/course/material/SVY3107/lectures/Breeze/SVY2106amgmgafund/index.html

How to google Map to Geodetic?

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

Sample:Google Map to Geodetic

In today’s Wpf project, we are showing a trick for getting the current extent of the map with Google Map as an image and displaying it on a map in decimal degrees unit. You may be in a situation where you want the details and accuracy of Google Map, especially the satellite view but want to have it displayed on your map in decimal degrees. In this sample, you will see how to get the Google Map image and create the accompanying world file for decimal degrees. Notice that we are realizing an affine transformation on the image to go to Geodetic as illustrated in the case 3 http://en.wikipedia.org/wiki/World_file#Definition. You can also use this technique for any other background maps such as Bing Map, Open Street Map using Spherical Mercator. Warning: It is possible to use a world file with parameters for a Geodetic system from an image originally in Spherical Mercator due to some similar projection characteristics. Applying the same operation for other projections such as Lambert or UTM will not work.

How to use Spherical Mercator Projection Adjustment?

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

Sample:Spherical Mercator Projection Adjustment

The purpose of this sample is to address a projection issue that you may encounter when converting your data from your local projection to Google Map. It has been reported by Map Suite users that in some cases reprojecting their data to Google Map or other base maps using Spherical Mercator (Bing Map, Open Street Map etc) is inaccurate with the data being shifted a few hundreds of meters. This problem has been identified as being caused by an unnecessary grid shift when going from ellipsoid datum to spherical datum. Among other projections, the British National Grid (BNG) and the German Gauss-Kruger system have that problem when going to Spherical Mercator. This sample uses the example of BNG to demonstrate the problem and how to fix it. The Map Suite development team will offer a permanent solution to this projection issue but in the meantime, as a rule of thumb, if your data shows some inaccuracies when going to Spherical Mercator, use the method you find this sample. This is a Desktop app but the concept shown applies to all editions of Map Suite.

How do I clip one polygon layer based on a polygon?

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

Sample:Clipping

This project along with “Spatial Join”, “Dissolve” and “Dissolve with Statistics” show another type of geoprocessing technique that can be applied to a layer. Clipping a layer can be handy in situation where the layer has a geographic extent larger than necessary and you just need a portion of it based on some defined area. For example, you might have the world layer of evergreen but you are working at the national level for Brazil and you don’t need the rest of the world. Clipping the layer will reduce it to the geographic area you are only interested in.
With “Clipping”, you will see how to combine the GetIntersection geometric function with other functions for creating and editing a layer into a coherent one step operation. Notice that this project only deals with clipping polygon based layer. It is also possible to clip line and point based layers. That will be the subject of future projects.

How do I clip one point layer based on a polygon?

Sample:Clipping On Point Layer

After the project “Clipping” where we saw how to clip a polygon layer based on a polygon, in this project we see how to clip a point based layer. Clipping a point based layer is quite a simpler task than clipping a polygon based layer as no geometric functions are necessary such as GetIntersection (overlap) besides the spatial query. It is also a much faster task to run.
After the projects on clipping polygon and point based layers, we will show a project on clipping line based layers.

How do I create a convex hull around a feature?

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

Sample:Convex Hull

ConvexHull is a geometric function that returns the smallest ring containing all the points of a shape. Another way to think about it is to imagine a set of points on a plane as nails pounded into a board. If you wrap the entire set with a rubber band snapping it into place, it will form a convex hull, which is the minimum-energy wrapper that encloses all the points. This is the theory, now you may be wondering what the practical use of this is in GIS. In today’s project, we show how to contruct a convex hull polygon from a set of point in a concrete situation of oil rigs offshore. Creating a convex hull could be used to determine the perimeter for constructing a barrier around the oil rigs to help protect from hurricanes. It could also be used for a barrier to keep spilled oil contained within.

How do I snap line based nodes together based on a tolerance?

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

Sample:Correcting Nodes

As for the projects “Spatial Join” and “Dissolve”, in this project we see how to edit FeatureLayers. In this case, we show some techniques to clean up a line based layer. You may be in a situation where you have to do that on a layer representing a network. Due to a poor digitizing, the end nodes of the lines don’t touch each other showing disconnected when in fact they should be connected. In this project, we show the technique to correct the location of the end vertices (nodes) so that they connect to each other. Keep in mind that the logic for correcting nodes shown here, is very simple and does not take into account various parameters such as tolerance, line order, multi line intersection etc. This logic works in the case of having an ordered sequential network as it is often digitized. The full logic taking into account all the different scenarios is vastly more complicated. We plan to offer this full logic in the future as an API within our core product. Also, notice that we create a custom LineStyle, NodeLineStyle for the purpose of showing the start and end nodes of each line as different color than the body of the line.

How do I create inner rings for track polygon?

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

Sample:Create Inner Ring

In today’s Desktop project, we learn how to create inner rings to a polygon based on another polygon using the GetDifference function. We also learn how to perform Union on a collection of polygon and how to set up the event TrackEnded. To use this app, you need to track a polygon, double click to end it and it will create an inner ring from the unioned result of the polygons completely within the tracked polygon. You can look at the TrackEnded event handler to see all the different operations taking place for that task.

How do I create a polygon programatically?

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

Sample:Create Polygon Programatically

Having a list of vertices with X and Y representing a polygon is a common scenario in GIS. For example, you might have a list of vertices (in Longitude and Latitude) representing plumes from a chemical dispersion. How do I create the polygons from that and how to I display that on the map? In this project, we show how to accomplish this from text files.

How do I draw a pie shape with a sweep angle as in radar applications?

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

Sample:Sweep Angle

For your GIS needs, you might have the need to construct a shape as a pie with a sweep angle for doing spatial analysis similar to radar. In this project, we show how to build a polygon based on a sweep angle and have it dynamically widens the angle while checking the containment of a collection of points. The key function in this project is CreatePie that has all the geometry necessary for creating such a shape.

Sample:Sweep Angle Desktop

The purpose of today’s project is to show how to make a desktop project from a Servicess one. Many of the projects published in the Code Community are in the Servicess edition because the only reference for Map Suite required for running them is MapSuiteCore.dll. That dll comes in any of the Map Suite products. We are taking the example of the “Sweep Angle” Servicess project to show how to adapt it to a Desktop project. With the understanding of some basic concepts such as Overlay, you will be able to easily convert a Servicess project to a Desktop one. So, for this project, you will need the references for both MapSuiteCore.dll and DesktopEdition.dll. Next, we will see how to convert a Servicess project to a Web one.

How do I dissolve a shape file based on a common attribute?

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

Sample:Dissolve on Shapefile

This project shows how to perform some geoprocessing on a shapefile, in this case dissolving a shapefile based on a common attribute. Dissolving shapefiles can be handy in situation where the shapefiles are too broken down for what they are intended to be used for. For example, you may have a shapefile of all the states of the US and they all have attributes for what sales region each belong to. If what really matters to you are the sales regions and not the individual states, it makes sense to dissolve the shapefile.

In this small project, you will see the technique to dissolve a shapefile based on a common attribute using some key methods such as Union static method to efficiently union together a large number of shapes. You will also find useful the code for creating a shapefile from scratch. This project will soon be followed by another project on how to apply statistics when dissolving a shapefile. Also, there will be another related project on how to do Dissolve on a generic FeatureSource.

Sample:Dissolve with Statistics

In the project “Dissolve”, we saw the geometric aspect of the Dissolve operation with the Union function etc. In this project, we going a little further and we apply statistics on the layer while dissolving. For each column of the layer being dissolved, we can apply various statistics such as sum, average, count etc. For example if you are dissolving the states of the US based on what region they belong to, you may want to get the sum of the population of each state within the same region and save that to the output dissolved layer.

How do I split polygon based on an intersecting line?

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

Sample:Split Polygon

Map Suite offers functions such as GetLineOnLine or GetPointOnLine to work to get portion of a line for dynamic segmentation. While this is very useful, many organizations dealing with road networks may have there roads represented as polygons as opposed to lines. This project shows the technique of splitting a polygon based on lines for situation where you have the roads represented as polygons with a center line for the road.

How do I perform spatial join?

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

Sample:Spatial Join

This project shows how to perform a Spatial Join on a point Layer based on a Polygon layer. It adds the relevant info to the point layer based on the spatial characteristics of the features of the point layer in comparison to the polygon layer. For example, we have two layers. One is polygon layer of the countries; the other is point layer of the cities. We don’t have any attribute information about what country each city belongs to. We can perform a Spatial Join to add that info to the point layer. A Spatial Join looks at what country of the polygon layer, each city belongs to using a spatial query. Spatial Join requires handling various techniques such as creating, updating layer and spatial queries in one coherent function. In this project, you will also see the technique of displaying a label based on more then one columns. In this example, we show a Spatial Join based on containing rule. Other types of Spatial Joins can be performed based on proximity, or some other topological rules. Later, we will show other projects of Spatial Joins.

How can I draw a pie shape defined by an ellipse?

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

Sample:Draw a Pie shape

This sample shows you how to draw a pie shape defined by an Ellipse prototype. The pie shape is not a standard shape provided by the Map Suite component, though it could be considered part of the ellipse or circle if special enough. In essence, you can create a pie shape by adding additional points to a given ellipse shape.

For more information, please see the discussion forum post below: http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6963/afv/topic/Default.aspx

How can I perform dynamic segmentation?

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

Sample:Dynamic Segmentation

The purpose of this project is to give a very quick introduction to Dynamic Segmentation, the area of GIS that has to do with network analysis. This project should interest professionals working in road management, accident analysis and pavement management.

The key method used here is GetLineOnLine that offers many parameters to get a segment of an existing line. In our example, we get a line segment based on a distance from the start and the length. You can see how this could be applied for application such closing a segment of a highway after an accident for example. This project will be followed by other more advanced projects related to Dynamic Segmentation.

How do I suppress features from being drawn in a layer?

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

Sample:FeatureIdsToExclude

The purpose of this project is to show how to use the FeatureIdsToExclude collection of FeatureLayer. In the project, you will see how you can exclude some features from being part of the GetFeaturesNearestTo function. Using that collection is a handy method for not taking into account some features in doing spatial queries, searching and even drawing without having to change the structure of the layer or create another layer.

How do I find a feature the user clicked on?

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

Sample:Get Feature Clicked On(Desktop)

The purpose of this project is to show the technique for finding the feature the user clicked on. To give the user the expected behavior, a buffer in screen coordinate needs to be set so that the feature get selected within a constant distance in screen coordinate to where the user clicked on regardless on the zoom level. This project will show how to accomplish that task regardless of the layer type (polygon, line or point based) and the zoom level of the current extent of the map. This is a Desktop project.

How do I remove a LineShape from a MultiLineShape?

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

Sample:Remove LineShape

MultilineShape is a line based shape type consisting of a collection of LineShapes. In today’s project, we will show some editing on how to remove a LineShape of the MultilineShape. In this process, you have to be aware of various issues such as removing the LineShape using the correct index and recreating a new feature with the edited MultilineShape with the correct ColumnValues if necessary.

How do I register a shape to the ground from a non-geographic coordinate system?

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

Sample:Register Shape

In this sample, we show a geometric function that allows tying to the ground or registering shapes from some non geographic coordinate to the map (in world coordinates). To better understand how useful this can be for your mapping needs, imagine the following scenario: You have some geometric shapes in a CAD for chemical plume. In a CAD or specialized program generating chemical models, you can do all your scientific manipulation, transformation etc. Once you are finished generating the chemical models with your specialized program, you are ready to put it on the map. Using anchor points, one of origin and one of destination, you can tie to the ground the shapes with the help of the Register function. This operation cannot be confused with Projection. Projecting a shape means going from one geographic projection to another one, for example from Geodetic to Spherical Mercator and some deformation of the shape can occur. Registering is simply placing a shape from a non geographic coordinate to a specific location on the map.

How do I identify a feature when clicking anywhere on its icon?

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

Sample:Identify Point with Icon

This project shows what technique to use when identifying at mouse click a feature represented with an icon. From the user’s perspective, the expected behavior when is to get the information of the feature when the user clicks on the icon, any part of the icon. The icon is the feature for him.

Today, we show how to implement that mode of getting info from a feature with icons of any size.

How do I determine if a point is inside an inner ring of a polygon?

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

Sample:Inner Ring Containment

The Contains function of PolygonShape when passing a PointShape is a convenient way to find out if a point is inside a polygon or not. But you have to be aware that the function is going to return false whether the point is completely outside the polygon or is inside one of the inner rings (holes of the polygon). While this is technically accurate, you might be in the position where you need to be able to make the distinction between those different types of containment for a polygon possessing inner rings. In today’s project, we create a function gives you the information whether a point is completely outside or inside one of the inner rings.

How do I split a line based on an intersecting line?

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

Sample:Intersect Line

In today’s project, we show how to split a line based on an intersecting line. To accomplish this task, basically two steps are needed. First, you need to find the crossing point using the GetCrossing function and then you split the line based on the crossing point using the GetLineOnLine function. If you are in the utilities industry working with electric network, gas pipes etc, you will find this project useful.

How do I handle self-intersecting polygons?

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

Sample:Intersecting Multi Polygon

In today’s project, we learn how to handle graciously the case of an invalid MultipolygonShape. Having a MultipolygonShape (The MutiPolygon according to OGC) with intersecting (overlapping) PolygonShapes is not a valid geometric shape. Although it draws (with some quirks) without throwing errors, such a shape cannot be used for doing spatial queries or other geometric functions. There are two options to solve the problem. One is to create a collection of individual PolygonShapes. The other one is to correct the MultipolygonShape by unioning the overlapping parts. In this project, you will see the code for both approaches. Keep in mind that the two different approaches are not just different methods, they also give different resulting shapes. You have to choose what solution fits the best your case.

How do I intersecting two layers?

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

Sample:Intersecting Two Layers

In the project “Clipping”, we saw how to clip a layer with another to have a resulting layer of the desired geographical extent. In the project “Intersecting two layers”, we see the technique of intersecting two layers which goes a few steps further compared to simply clipping a layer.

Let say you have a layer of stratigraphy and a layer of counties and you need to do some analysis based on info from the county layer and info from the stratigraphy layer. You can combine the two layers by intersecting them and get only the common data of the two layers while adding the attributes of both original layers. The resulting layer has geographical extent that is common to both layers (as for clipping) while adding the information from both original layers. As for other geoprocessing techniques, writing the code for Intersecting requires combining layer editing with geometric functions.

How do I merge two line layers?

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

Sample:Merge Line Layers

From the previous project, on the geoprocessing technique of merging point layers, here we show the same technique applied to line layers. Remember that an alternative approach to merging is to use a multi index and treating all the various files as one layer. You can see this Discussion Forum post for more info on that: http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5921/afv/topic/Default.aspx

How do I merge two point layers?

Sample:Merge Point Layers

This project is similar to a previous project related to geoprocessing for merging polygon layers “Merging Layers”, but applied to point layers.

An alternative approach to merging is to use a multi index and treating all the various files as one layer. You can see this Discussion Forum post for more info on that: http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5921/afv/topic/Default.aspx Next we will show how to do the same thing for line layers.

How do I treat multiple shape files as one shape file without physically merging them?

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

Sample:Merging Layers

If you have many files of the same type and representing the same type of features, Map Suite offers an API for building a multi index and treating all the various files as one layer. You can see this Discussion Forum post for more info on that: http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5921/afv/topic/Default.aspx

While this is very convenient, you may still want to combine all your files into one for maintenance purpose. This project shows the geoprocessing technique of accomplishing that task with merging. The logic for writing the merging algorithm is simpler than other geoprocessing tasks since no geometric functions are involved. Keep in mind that this project shows how to merge polygon based shapefiles into one. In the future, we will post a more generic project for layer of various format and type.

How do I move a point parallel to a line segment?

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

Sample:Offset Point at Right Angle

This project shows some geometry for moving a point parallel to a line segment. The GetLineOnLine method allows you to do some dynamic segmentation on a road. After doing that you may need to offset the start and end points at a right angle by a certain distance. This project will show you how to accomplish that.

How do I buffer shapes based on multiple distances?

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

Sample:Multi Ring Buffering

This project shows how to create a multi ring buffer on shapes, in this case MultilineShapes from a line based layer, a road. From buffering the road at various distances, we create concentric rings. Then, we can determine how many features from the point based layer (schools) are in each ring.

In this project, you learn how to handle geometry functions such as Buffer, Union and Difference for the goal of doing some spatial analysis with the resulting rings.

How do I perform a negative buffer?

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

Sample:Negative Buffering

This project is meant for addressing a current limitation of Map Suite API concerning the geometric operation of buffering. Currently, the Buffer function can only be done for buffering to the outside of a shape but not to the inside of the shape. This project shows the different steps to follow using various geometric functions to accomplish the result of negative buffering. In the future public release of Map Suite, negative buffering will be fully supported. This project is still useful in understand how to manipulate various geometric functions to get the desired result.

How to create a MultipolygonShape from various PolygonShapes?

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

Sample:Polygon Shapes To Multipolygon Shapes

In this Wpf project, we show how to create a MultipolygonShape from various PolygonShapes. Since a collection of PolygonShapes cannot be directly cast to a MultipolygonShape, we show the technique to build a MultipolygonShape passing an IEnumerable of PolygonShape. This is a Wpf sample and you will need the references for MapSuiteCore.dll and WpfDesktopEdition.dll.

How to use GetFeaturesWithinDistanceOf/GetFeaturesNearestTo methods when the data is reprojected?

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

Sample:Distance Query on Projected Layers

In this sample, we learned how to use the method GetFeaturesWithDistanceOf when the data is projected. We just input the unit which is projected to, do not need to mind what the real unit is for the internal data before projection. It works fine with Map Suite Assemblies 4.5.54.0 or later.

How to use distance query on wrap dateline mode?

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

Sample:Distance Query on WrapDatelineMode

In this Wpf sample is on the same theme as the previous sample WrapDatelineMode. Here we show how to take advantage of the projection class WrapDatelineProjection for doing spatial query when on a “virtual map”. From this spatial query example, the developer should understand how the same principle using the same projection class can be applied for other operations such as Spatial Queries, Identify etc. In order to run this sample, you will need the latest Dev Daily Build for Wpf with references to MapSuiteCore.dll and WpfDesktopEdition.dll.

How do I clip one line layer based on a polygon?

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

Sample:Clipping On Line Layer

This Wpf project completes the series of projects dedicated to the clipping geoprocessing. We already saw how to perform clipping on a polygon based layer in “Clipping” and on a point layer in “Clipping On Point Layer”. Here we show how to perform the clipping geopressing on a line based layer. As for the same operation on a polygon based layer, the key geometric function is GetIntersection. We will also appreciate the operation of creating a layer from scratch as in addition to the geometric operation itself, geoprocessing also involves creating a result layer from the original layers, the clipping layer and the clipped layer. You will need to get in the Dev Daily Build the latest MapSuiteCore.dll and WpfDesktopEdition.dll as references as the GetIntersection API for line based shapes was added only recentely.

How do I represent points using an animated GIF?

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

Sample: Animated Gif

In today’s project, we learn how to extend InMemoryFeatureLayer to have the ability to display animated gif for each layer in the Desktop edition. You will notice that for now, we are limited to have one animated gif per InMemoryFeatureLayer but in the future, we will show the technique to have a different animated gif for each feature of the InMemoryFeatureLayer.

Is there something faster than the ValueStyle?

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

Sample: Cached Value Style

The MapSuite API provides a Value Style as you can see in the sample app “Draw features based on value”. This is a great way to display feature features based on some value of a column. With this style and any other styles offered by the MapSuite API, each time the map has to redraw the value for each feature within the current extent has to be fetched. This can affect the performance especially if a large number of features are used. With CachedValueStyle, the value for each feature is cached into memory to reduce the overhead of having to go and fetch the value for each feature each time the map has to draw. Using this CachedValueStyle has a benefit on performance but you need to pay attention on memory usage.

How do I cluster multiple points into one point for display?

Sample:ClusterPointStyle

In this project, you will see how to use a custom style, ClusterPointStyle for clustering various features into one. Sometimes, the map may have many features stacked on top of each other at high zoom levels making the map too busy and difficult to read. Clustering is a usefull technique in those situation making the map more readable. It groups together various features into one symbol with the count of all the features being labeled.
There are many ways for finding the location of the cluster point. One of the simplest is to use the center of gravity of all the clustered features as used in this project.
In this project, we are using volcanoes because natural phenomenon are usually good candidates for being clustered.

How do I display a label in real world dimensions?

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

Sample:World Sized Text Style

At the request of a client, today we have a project showing how to have an ImageStyle of real world dimension. A good example to show that is to use an image representing a cruise ship. Knowing that the ship is of 300 meters of length and 90 meters of width, we can use an image representing a ship and set those dimension to it. It will be drawn on the map always at those dimensions regardless of the zoom level. The logic used for this is very similar to what we saw in the project World Sized TextStyle but applied to images.

How do I display an icon in real world dimensions?

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

Sample:World Sized Image Style

At the request of a client, today we have a project showing how to have an ImageStyle of real world dimension. A good example to show that is to use an image representing a cruise ship. Knowing that the ship is of 300 meters of length and 90 meters of width, we can use an image representing a ship and set those dimension to it. It will be drawn on the map always at those dimensions regardless of the zoom level. The logic used for this is very similar to what we saw in the project World Sized TextStyle but applied to images.

How do I word wrap my labels?

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

Sample:WordWrapped TextStyle

In the Discussion Forum post “Display word-wrapped text”, there is a discussion on how to implement a TextStyle doing word wrapping. In this project, you will actually find a working implementation. Notice that by using the class WordWrappingTextStyle, word-wrapping is applied according the proportion of the size of the text to the size of the bounding box of the feature to label. This means that the label can be word-wrapped or not depending on the zoom level.
You can find the discussion forum post on that topic at:
http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6421/afv/topic/Default.aspx

How do I draw features differently based on column values?

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

Sample:ValueStyle with Countries

In today’s project, we revisit the ValueStyle class that is introduced in the “How Do I” sample app “Draw Features Based on Values”. In that sample app we show how to use the ValueStyle on a point based layer to display cities according to their population rank. In today’s Code Community project, we apply the ValueStyle to the polygon based countries layer (supplied with the sample apps). The countries layer has a column named “Color_map” with values from 1 to 8. Each number is assigned a color; that way the countries are displayed with 8 various colors on the map helping to distinguish them easily. Also, in this project, we pay attention to some advisable cosmetic practices for using light or pastel colors. As a general rule, it is recommendable to use lighter colors for displaying general background features such as countries rather than brighter ones to have a more pleasing visual experience for the map users.

How can I display decimal degrees as degrees, minutes and seconds?

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

Sample:Decimal Degrees Formatting

The purpose of this project is to complete the static class DecimalDegreesHelper. This class offers functions to go to and from Decimal Degrees but it lacks the functions handling various formats such as Degrees Decimal Minutes and Degrees Minutes Decimal Seconds. Those formats can be output by different GPS devices and it is handy to know how to manipulate them and convert them to Decimal Degrees, the only format that can be input into a GIS or Mapping application.

How do I display a point based on real time data such as the current time?

Sample:Time Based Point Style

This project shows how to create a custom style to display info based on some live data. Here we display world capital with a symbol for day or for night according to the local time. The method GetRequiredColumnNamesCore is overridden to make sure the column for the time zone is used. The method DrawCore is also overridden. It contains the logic to determine if a feature is within day time or night time according to the time zone column and the system time on the machine.

How do I label each line in a MultiLineShape?

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

Sample:TextStyle for Multi Line

If you are labeling features based on MulilineShapes, using the default TextStyle, only one line of the collection of lines making up the MultilineShape is going to be label. In today’s project, we show how to create a new class inheriting from TextStyle that will label all the lines of the MultilineShapes. That behavior is similar to the property LabelAllPolygonParts of DefaultTextStyle for polygons.

How can I show one-way streets arrows on my roads?

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

Sample:Displaying One-Way Streets

In the Discussion Forum Post “Drawing one-way streets in the map”, we have a question on how to display an arrow on a street that is one way as Google Map does. In this project, we show the solution by creating a LineStyle specifically for that purpose. We take the shapefile “AustinWithOneWayRoad.shp” from the sample app “Route On One-Way Roads” of Map Suite Routing Extension to display the arrow according to the traffic direction on the one-way streets.

How do I draw a line with a different start and end style?

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

Sample:Start End LineStyle

Today, we are looking at how to extent LineStyle to have a style for lines that shows the start and end points. This is useful to display line features with that custom LineStyle if you are mindful of the order it was digitized and you want to know the direction of the lines. This project is similar to previous ones where LineStyle is extended such as “One Way Streets” and “Distance Line Style”.

How do I display the distance of a line as label?

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

Sample:Distance Line Style

This Web project shows how to create a new style class CustomDistanceLineStyle inheriting from LineStyle class. You can pay attention to how the DrawCore function is override for a very specific need of style: displaying the distance label on each line segment making up a LineShape. In addition to the overriding of the DrawCore function, you will find useful some geometry functions such as GetPointOnLine to find the midpoint of a line segment and GetAngleFromTwoVertices to incline correctly the labels according to the orientation of each line segment. You will notice that the CustomDistanceLineStyle works for features made of LineShape and you will have to slightly modify to have it working with MultilineShape.

How do I display a point as a doughnut shape?

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

Sample:Doughnut Point Style

This project shows how to create a doughnut point style as this style is not offered by the MapSuite API. DonutPointStyle inherits from PointStyle and you will notice that in the overridden method DrawCore, no reference to any GDI + API is used. That means that this style is drawing system independent.

How do I draw points where the size is proportional to a column value?

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

Sample:Sized Point Style

Creating a Custom Style is a great way to encapsulate custom logic draw symbol based on some values. This project shows that using the concrete example world capitals. In this example, we draw capitals as circles with the size proportional to the population. We create the class SizedBasedPointStyle inheriting from PointStyle. We override the method DrawCore for the drawing logic. We also override the method GetRequiredColumnNamesCore to make sure we have the column for Population that will be used in DrawCore method to calculate the correct size of the circle for each feature.

How do I rotate a side view icon based on its heading?

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

Sample:Side View Icon

This project is a little bit similar to the previous one Rotate Icon. It shows how to display correctly side view icons of moving vehicles. With top down view icons of vehicle, you simply rotate the icon according to the direction of the vehicle. But with side view icons of vehicle, it is a little bit trickier and you have to use a pair of icons. This project shows how to handle that and also how to calculate the direction of a vehicle based on the current GPS reading and the last one.

How do I change the style of shapes being edited?

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

Sample:EditOverlay Styles

In today’s Web project, we learn how to control the styles of the EditOverlay for both the default style and the editing style. In order to accomplish this, we write some javascript code. Look at the code in the “script” tag to see how we can control the fill color, the opacity, the border width etc of the features in the EditOverlay.

How do I draw an icon that flashes?

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

Sample:Flashing Point Style

In this project, we explore how to create a point style that flashes. Here we take the example of a vehicle moving around based on GPS location and flashes when entering prohibited zones. I think that this project will inspire people working on building a vehicle tracking application. This project is a general solution for a Servicess edition. Notice that we are using two MapEngines with one only for drawing the flashing vehicle to avoid redrawing the other layers at each flashing.

Later, we will publish projects specifically adapted for the Desktop and Web editions.

How do I make a text larger or smaller based on the current scale?

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

Sample:Scaling TextStyle

This project shows how to create a Style inheriting from TextStyle to have the label sizing according to the scale. You will see that the logic of scaling is basically the same as the on in the previous project “ScalingImageStyle” but applied to TextStyle.

How do I make an icon larger or smaller based on the current scale?

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

Sample:Scaling Image Style

This project presents a useful case where you want to have the icon representing a feature to be sized in proportion to the current scale. It is little bit similar to what we show in the project SizedPointStyle exept that the size of the symbol is based on the scale, not on some values specific to each feature. That explains why in the class ScalingImageStyle, the method GetRequiredColumnNames is not overriden. The whole drawing logic can be contained in DrawCore.

How do I create a custom style to display routes?

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

Sample:Routing Styles

The API for the Routing extension product provides a class RoutingLayer. RoutingLayer is basically a convenient layer to have the features for routing being displayed in a default way. You can add the start, end point, the routes and it is going to display that nicely for you without much work on your side. While this is convenient, you may be in the situation when you want more control on the styles and have the whole flexibility that an InMemoryFeatureLayer gives you. In this project, we show how to display in InMemoryFeaturesLayers the start and end points, as well as the resulting route using the full power of InMemoryFeatureLayer such as zoom levels and custom styles.

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 rotate a feature's text similar to word wrapping?

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

Sample:Hybrid TextStyle

This project is a follow up to the Discussion Forum post http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6652/afv/topic/Default.aspx Rotating the feature text (similar to wordwrap). In this project, we create a new Text Style combining word wrapping that we saw in the project http://code.thinkgeo.com/projects/show/wordwrapped and text rotation. You can see the labels word wrapping and rotating in harmony with the resizing and rotating of the shapes.

How do I measure the distance of a line accurately in different projections?

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

Sample:Projection Distance LineStyle

This Web project is similar to the project “Distance Line Style”. Here we show how to use a projection of choice different from the projection used on the map. For example, you may have your map using Google map as a background. Google map uses Spherical Mercator projection which is not ideal for distance measurements, that is why using a more appropriate projection for distance measurement such as State Plane will give more accurate results. The CustomDistanceLineStyle inheriting from LIneStyle has the logic built in to have the distance calculated based on a projection of choice instead of the projection of the map. As for the previous project “Distance Line Style”, you can see how the DrawCore function is overridden for the a specific need of style: displaying the distance label on each line segment making up a LineShape. In addition to the overriding of the DrawCore function, you will find useful some geometry functions such as GetPointOnLine to find the midpoint of a line segment and GetAngleFromTwoVertices to incline correctly the labels according to the orientation of each line segment. You will notice that the CustomDistanceLineStyle works for features made of LineShape and you will have to slightly modify to have it working with MultilineShape.

How do I set multiple dot density styles on the map?

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

Sample:Multiple Dot Density Styles

In this sample, we are looking in a little more detail at the DotDensityStyle. You can combine different DotDensityStyles on one FeatureLayer using different columns. Demographic data are usually well fit to be used with that type of style. Here each dot of a certain color represents 100,000 persons of the same age group by state. Using multiple DotDensityStyles, the dimension of age group demographics is added to the representation of population density. Note that the PointToValueRatio is used to set how many people a dot is going to represent. For example, if you want a dot to represent 100,000 persons, you set it to 0.00001 (1 / 100000). If you want it to be 500,000 persons, you set it to 0.000002 (1 / 500000).

How to create a cutomer valuestyle?

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

Sample:Default ValueStyle

In today’s Wpf project, we demonstrate the extensibility of ThinkGeo API by creating a custom Style. Inheriting from ValueStyle, we create a Default Value Style that handles the drawing of features that don’t have a value defined in the ValueStyle. Here we are using a point based layer with PointStyle. Note that the Default ValueStyle would also work with line and polygon based layers.

How to create a line style with increment?

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

Sample:Line Style With Increment

In today’s winforms desktop project, we expend on the functions of DistanceLineStyle shown on a previous sample, “Distance Line Style”. Here we show how to create a custom LineStyle for showing distance increment at a regular interval (every tenth kilometers). Having this LineStyle can be very handy when dealing with line network such as roads or railways.

How do I display multi line labeling?

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

Sample:MultiLine Labeling

For labeling purpose, TextStyle has a property called LabelAllPolygonParts that will label all the parts making up a polygon based feature. Unfortunately, we don’t have an equivalent API for labeling all the parts of a line based feature. But thanks to the flexible framework of Map Suite, we show in this Wpf sample how easily you can expand the TextStyle class to allow this labeling capability. Look at the custom class MultiLinetextStyle and how DrawCore function is overridden to have the expected labeling behavior.

How to create a weather line style?

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

Sample:Weather Line Style

In this Wpf sample, we learn how to extend LineStyle class to create a style for representing weather fronts such as cold front, warm front and occluded front for your weather maps. To achieve that styling a regular LineStyle is used for the front line itself. For symbolizing the type of front an icon is used. Notice the two handy properties to give you more control: Spacing property to adjust the distance in screen coordinate between each symbol on the line and Side property to control on what side of the line front the symbols should appear. Of course, as you zoom in and out on the map the spacing between each symbol remain the same as it is set in screen coordinate.

Can I create isolines (a.k.a. contour lines) with Map Suite?

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

Sample:Isolines

Yes. Starting with build 5.0.87.0 of Map Suite, you can add isolines to your applications with Map Suite – please see the code sample linked above. For the uninitiated, isolines are a way to visualize breaks between different groups of data such as elevation levels, soil properties, or just about anything else you can imagine. The above code sample also shows the various steps in creating isolines, including the gathering of point data, creating a grid using interpolation, and finally, picking your isoline break levels. We also quickly dive into some more advanced options such as generating isolines on the fly. To bring this all together, check out our instructional video that will walk you through the process of setting up and working with isolines in Map Suite.

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.

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_all_questions.txt · Last modified: 2015/09/08 03:37 by admin