Table of Contents

Map Suite Web Edition FAQ All Questions

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

Yes, absolutely. Map Suite Web Edition is an ASP.NET 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 Web Edition?

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

Does Map Suite Web Edition require any third party controls to be downloaded and installed on the client browser?

No. Map Suite Web Edition utilizes JavaScript to handle all browser-side operations, so no third party ActiveX controls are needed.

What type of map data does Map Suite Web Edition Support?

Map Suite Web Edition lets you use virtually any map dataset of your choosing. If you have your own map data, you can utilize it. Alternatively, you can utilize our Map Suite World Map Kit extension, Google Maps, Virtual Earth or Yahoo Maps — just to name a few options.

What formats can my data be in?

Map Suite Web 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 Web Edition?

Map Suite Web 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 Web Edition?

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

What is the difference between Map Suite Web Edition and Map Suite Services Edition?

Map Suite Web Edition comes with built-in functionality to construct a robust user interface in a web 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.

I'm seeing an "Unlicensed for Runtime" watermark on the map after I deploy my web application to IIS.?

You are seeing this message because the Production Web Server license is not installed on your server. There are two kinds of licenses for Map Suite Web Edition:

  1. The Development License is for a development environment. It allows you to develop your application within Visual Studio.
  2. The Production Web Server License is for a production environment. It removes the “Unlicensed” watermark in runtime.

To install the Production Web Server License, you need to run the Map Suite Web Edition Server Preparation Tool that can be found in the My Downloads section of the Customer Portal. Easy-to-follow installation instructions are included with the tool.

How do I display Google Maps without the satellite layer?

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

Sample:Custom Map with Google Labels

In this web-based project, we show you how to use Google Maps in GoogleMapType.Hybrid mode but without the satellite layer. In other words, we'll request a transparent image that just contains streets and labels from the Google Map Server. This is useful in cases where you have access to local aerial photography that is higher quality and more up-to-date than Google Maps' satellite layer, and you want to display that imagery with Google's streets and labels on top.

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(Web)

Today we have a Web project. In our experience and based on a number of requests in the Discussion Forum, many of the users of Map Suite for web applications have a need to display point data coming from some GPS readings on Google map. This project shows in the most straightforward way how to interpret the GPS data often in the decimal degrees format, project it correctly to match Google Map and plot it on the map.

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.

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 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 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 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 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 efficiently display a subset of a shape file without splitting it?

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

Sample: Build Custom Shapefile Indexes

This sample shows how you can display a subset of a shapefile without splitting the physical shapefile. For example, you may have a single shapefile that contains both highways and local roads. To improve display speed, you may be temped to split it into two separate shapefiles so you can quickly display local roads with one style and highways with another style (and avoid using a value style, which can be slow). But at this project demonstrates, rather than split your shapefile you can simply build two custom indexes, one for each road type. Then, when you create your ShapeFileFeatureLayer, you'll simply use your original shapefile and specify a custom index. Each custom index will limit the records that can be seen by the Layer, making it very fast and efficient.

For more information and a real-world example, please see the Map Suite discussion forum post at: Forum Post

How do I display highways and local roads using different symbols from the same shape file?

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

Sample: Build Custom Shapefile Indexes

This sample shows how you can display a subset of a shapefile without splitting the physical shapefile. For example, you may have a single shapefile that contains both highways and local roads. To improve display speed, you may be temped to split it into two separate shapefiles so you can quickly display local roads with one style and highways with another style (and avoid using a value style, which can be slow). But at this project demonstrates, rather than split your shapefile you can simply build two custom indexes, one for each road type. Then, when you create your ShapeFileFeatureLayer, you'll simply use your original shapefile and specify a custom index. Each custom index will limit the records that can be seen by the Layer, making it very fast and efficient.

For more information and a real-world example, please see the Map Suite discussion forum post at: Forum Post

Is there something faster than the ValueStyle?

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

Sample: Build Custom Shapefile Indexes

This sample shows how you can display a subset of a shapefile without splitting the physical shapefile. For example, you may have a single shapefile that contains both highways and local roads. To improve display speed, you may be temped to split it into two separate shapefiles so you can quickly display local roads with one style and highways with another style (and avoid using a value style, which can be slow). But at this project demonstrates, rather than split your shapefile you can simply build two custom indexes, one for each road type. Then, when you create your ShapeFileFeatureLayer, you'll simply use your original shapefile and specify a custom index. Each custom index will limit the records that can be seen by the Layer, making it very fast and efficient.

For more information and a real-world example, please see the Map Suite discussion forum post at: Forum Post

How do I draw a north arrow on my map?

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

Sample:Compass

In the project “North Arrow”, you saw how to extend AdornmentLayer to create a North Arrow AdormentLayer. In this project, we expand on that idea and create a more sophisticated class. You will see how you can combine two images to create a compass. Compare to “North Arrow” project, we also added some other handy properties such as a Position property. Also, the compass can be of varied sizes thanks to the SizePercentage property. Finally, if you pass just one image, the compass can behave just like a regular north arrow.

We also added new designs of compass in smaller version. See the attached file: Rotating Compass New Smaller Designs.zip.

How do I display graphs and charts on the map?

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

Sample:Zedgraph

In our “How Do I” apps, there is sample app that shows how to add graphs to the map using the ZedGraph library. In this project, using the same data, the US cities, we elaborate a little bit on the pie chart. You will see how to add some gradient colors to the chart, how to label the different pie slices, how to add a title etc. Zedgraph is a truly massive library for graphics and Pie chart is only one type of chart among many others. As you can add pie charts to your map, you can also add bar charts, trend charts etc. I suggest you check out this site for more info on ZedGraph

http://zedgraph.org/wiki/index.php?title=Main_Page

With Map Suite, you have the whole ZedGraph API available with an easy interface to add the graphs to the map.

For this project, in addition to the MapSuiteCore.dll, you will also need the ZedGraph.dll and ZedGraphStyleExtension.dll references. We will have several projects showing how to integrate other types of charts to your map.

How do I add a watermark to the map?

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

Sample:Watermark Adornment Layer

This project shows how to create a WaterMarkAdornmentLayer class inheriting from AdormentLayer. Notice that in the overridden method DrawCore, the drawing is done using screen coordinates. This is a characteristic of Adornment Layer and any layer inheriting from it. In this example, the code in the DrawCore method places the water mark text at regular interval but you could easily modify the code to have the water mark text placed randomly on the map. Notice that WaterMarkAdornmentLayer is added to the StaticLayers collection of the MapEngine meaning that you can place this adornment layer on top of all the other layers or between any other layers. This class is useful for providing demos to clients.

How do I encrypt a shape file for security?

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

Sample:Shapefile Encryption

In today’s project, we are looking at a way to encrypt shapefiles to prevent them from being used outside the application. We show how to encrypt and decrypt shapefiles using streams. You will see that a very simple encryption algorithm is used but by looking at the example, you will be able to implement your own. Disclaimer: This encryption system can be used only on small shapefiles due to the amount of memory used. A typical use would be to encrypt some valuable small shapefiles you don't want your users to access. In the future, Map Suite will provide a full encryption system as an API.

How do I get geometry data from the server using WCF in Silverlight?

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

Sample:Get Data From Server With WCF

In this Silverlight-based project, we are going to take a look at how to get geometry data from the server side using the WCF service with Map Suite Silverlight Edition, while keeping all map data on the server side. You can click any of the countries on the map to call a WCF service, which will require data from the server, and then a popup will appear with information about that country.

How do I display a scale bar using custom units?

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

Sample:Scale Bar

Map Suite already offers classes such as ScaleBarAdornmentLayer for displaying scale bars on the map but they are limited to certain common units like meters, kilometers, feet and miles. In this project, you are going to learn the basics for creating a scale bar using the unit of your choice. The class CustomUnitScaleBar displays a very simple scale bar but you will find the logic for basics of creating a scale bar. Looking at the code, you will be able to create more sophisticated stylish scale bars for your own needs.

How can I show my own logo on the map?

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

Sample:Graphic Logo for Web

From a request in a Discussion Forum post, today we decided to have the Web version of a similar project Graphic “Logo Adornment Layer” for Desktop. Here we show how to use the class GraphicLogoAdornmentLayer inheriting AdornmentLayer for the Web edition.

How do I display heat map?

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

Sample:Heat Map

Heat maps is a technique increasingly used in various fields such in biology and other fields See http://en.wikipedia.org/wiki/Heat_map. They are also used for displaying areas of webs page most frequently scanned by users. http://csscreme.com/heat-maps/. At ThinkGeo, we are taking this concept to GIS and applying it to geographic maps. Heat maps are a great way to give the users a visually compelling representation of the distribution and intensity of geographic phenomenon. For that purpose, we are releasing a new extention called MapSuiteHeatMapExtension. We invite you to try this out extension with your own data and give us feed back on it before we release it to our core products. Today, we are posting two Desktop projects on that subject. The first one is using the swine flu data we used in an earlier project. You can see how powerful the visualization of that data is to show the spatial distribution flu swine cases. In the next project, you will see how to take into account column values to produce various degrees of intensity using some earthquake data. In those two projects, you will need references to MapSuiteCore.dll, DesktopEdition.dll, WorldMapKitWms.dll (Evaluation or full versions) and MapSuiteHeatMapExtension.dll (included in the zip file).

Sample:Heat Map with earthquakes

After the project on displaying swine flu data using the heat map technique, here you learn how to apply parameters other than strictly spatial distribution to affect the coloring of the map.

In this example, the magnitude of each earthquake (from 0 to 12) is taken into account to influence the displaying of the heat map. The result is California appearing even more intense than if only the spatial distribution were taken into account. As for the previous project, you will need references to MapSuiteCore.dll, DesktopEdition.dll, WorldMapKitWms.dll (Evaluation or full versions) and MapSuiteHeatMapExtension.dll (included in the zip file). As a caveat on heat map in GIS, it is worth mentioning that while this is great tool for displaying data in a very appealing and communicative way, it cannot be used as an analysis tool for studying spatial behaviors. For spatial analysis, GRID is the appropriate tool. Although a heat map looks like a GRID, it is not one and it cannot substitute GRID for spatial analysis.

How can I load an image from a stream rather than a file?

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

Sample:Image Stream Loading

As an alternative to loading an Image with the image file from the file system, you can choose to pass your own stream. This project shows you how to use the event StreamLoading of GdiPlusRasterSource for this purpose. In this project, we show how to do this using a Tiff image but you can also use that event for ShapeFileFeatureSource as we show in a previous project “Shapefile Encryption”. Keep in mind that this technique only works with images besides MrSid, ECW and Jpeg2000. These types of images do not work because the providers do not support streams in their decoding SDKs.

How can I draw KML on the map?

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

Sample:KML Extension Web

Upon requests from Map Suite Web developers, we created this project. It is the web version of the Desktop project “KML Extension” where we learned how to display on the map files in the KML format.

KML is the file format for displaying geographic data in a Google Earth browser such as Google Earth. Now, you can also display such a file on a Map Suite control. Thanks to its flexible architecture to extent to new file formats, in today’s project we wrote the logic for supporting KML. Look at the class KmlfeatureSource inheriting from FeatureSource to see how the logic for reading FML files was implemented. As well, you can see the class KmlStyle inheriting from Style for the drawing logic. And feel free to modify and improve those classes with your own implementations.

How do I display latitude and longitude graticule lines?

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

Sample:Latitude Longitude Graticule

After the projects on North Arrow and Compass, we created another project related to Adornment Layer to have a more stylish map and give more information to the user navigating the map.

In this project, we create a Graticule Adorment Layer that shows Meridians and Parallels displaying through the map. Meridians are lines of longitude and they have a North South orientation. Parallels are lines of latitude and they have an East West orientation. Showing graticule for latitude and longitude is a standard way in cartography to give spatial references to the users. You will find two zip files. One is for the Desktop Edition “LatLongGraticule” and it shows nicely the effect of the meridians and parallels as you pan and zoom in and out. You will also see, as additional spatial references to the users, the latitude and longitude location at the mouse pointer in labels at the mouse move event. You will see that information in the decimal degrees format and in the Degrees Minutes Seconds format. For those that don’t have the Desktop Edition, you will find the zip file “LatLongGraticuleServices” for the Service edition. It is using exactly the same GraticuleAdormentLayer class. In the future, we will offer another class for graticule with more options for formatting and displaying the graticule. It will also offer projection support for map that are not in Decimal Degrees map unit.

How can I display a legend on my map?

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

Sample:Legend Adornment Layer

Following inquiries on how to show a legend on the map in the discussion Forum, we decided to post a project on that topic in the Code Community. In this project, you will find the class LegendAdornmentLayer which shows the basics of displaying the symbols for each layer belonging to each Overlay of the Map. Looking at the code, you will understand how to extend that class and build a more sophisticated Legend on your own.

How do I display point data from an OLE DB complied data source?

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

Sample:Oledb Point FeatureSource

This project shows the power of MapSuite by giving to the developer the possibility to create its own layer based on an existing format containing spatial information. If the developer is familiar with a certain format like oledb, he can create its own FeatureSource reading the database and its own FeatureLayer wrapping the FeatureSource and providing the drawing logic.

In this project, we create the class OledbPointFeatureSource inheriting from FeatureSource and OledbPointFeatureLayer inheriting from FeatureSource.

How do I show a mini map?

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

Sample:Mini Map Adornment Layer

This project shows how to create a simple mini map to give a reference of where you are when you zoomed in. As for WaterMarkAdornmentLayer, the MiniMapAdormentLayer inherits from AdornmentLay.

How do I display multi geo-raster files as one layer?

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

Sample:Multi Geo Raster Layer

MapSuite API has RasterLayer from which inherits MrSIDRasterLayer and ECWRasterLayer etc. If we have many raster files, we would need to add all the raster files as separate layer. However this has a performance issue. In this project, we show how to create a class MultiGeoRasterLayer that treats all the raster file as one layer.

This class show how to do that using JPEG images with its associating JGW world file. It speeds up the loading of a large number of Raster layers by loading and drawing on demand only the files in the current extent. It loads a reference file that contains the bounding box, path and file information for all of the Raster files. We load this information into an in-memory spatial index. When the map requests to draw the layer, we find the Rasters that are in the current extent, create a layer on-the-fly, call their Draw method and then close them. In this way, we load on demand only the files that are in the current extent.

How do I work with multi index files?

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

Sample:Multi Index

Today our purpose is to gather into one concise project all the different knowledge we learned about multi index in various Discussion Forum posts such as: http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5921/afv/topic/Default.aspx http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5958/afv/topic/Default.aspx Consolidating various physical shapefiles into one layer is a flexible and clean way to handle your data. Thanks to multi index, you can treat your layers as one. Depending on your needs you can choose to use all the shapefiles in one folder or only a few. In this project you will see the different ways to use the powerful static function MultipleShapeFileFeatureLayer.BuildIndex()

How do I create a numbered grid for a given extent?

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

Sample:Numbered Grid

In many atlases, you can see maps with a numbered grid to give the page reference for a more detailed map. In today’s project, we show how to construct such a grid. Based on the extent of the feature, the number of columns and rows, a grid can be created with the page number in each cell.

How do I draw a north facing arrow when using rotation?

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

Sample:North Arrow

This project demonstrates basically two techniques; How to rotate a map and how to have a North Arrow keeping the right north orientation. Rotating the map:

To rotate the map, you have to be aware that you have to use RotationProjection class provided by MapSuite API. All the layers need to have their projection property set to RotationProjection. Beware that if a Layer does not have that property set, it will not rotate along with the rest of the map.

Displaying the North Arrow:

As the map rotate, it is important to keep track of the orientation of the map and to know what the direction to the North is. Inheriting from Adornment Layer, RotatingAdornmentLayer class takes an Image representing a North Arrow and with its RotateAngle property set according to the angle property of RotationProjection, it always shows the North correctly.

How to use a common FeatureSource for two different Overlays?

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

Sample:Combining Overlays

In today’s Wpf project, we show a technique of using a common FeatureSource for two different Overlays. From a physical shapefile representing cities, a regular LayerOverlay is used for the higher zoom levels while a FeatureSourceMarkerOverlay is used for the lower zoom levels. FeatureSourceMarkerOverlay is a Wpf specific overlay offering features for a better user experience such a Tooltips and ImageSource.

How to edit the geometry of a shapefile?

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

Sample:Edit Geometry Of Shapefile

The purpose of this sample is to show how to update the geometry of a feature of a shapefile in one step. This sample is useful for anyone wanting to actualize the geometry part of its data. You can see how only a few lines of code are necessary for this process and that the spatial index gets automatically updated after calling the committing the change. Notice that this sample does not show all the fanciness for manipulating at user interaction the geometry to be updated. For this purpose, you can see all the samples related to TrackInteractiveOverlay and EditInteractiveOverlay.

How to edit attribute of a shapefile?

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

Sample:Edit Attribute Of Shapefile

The purpose of this Wpf sample is to show how to edit the attribute of a feature of a shapefile. This sample is useful for anyone wanting to actualize the attribute part of its data by simply clicking on the desired feature on the map and updating its attribute in a textbox. You will find the editing part of the code in the KeyDown event of the textbox.

How to create GRID?

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

Sample:Create GRID

Today’s sample shows the new feature available in this may release Map Suite 5 for creating GRID files. A GRID is a raster format that defines a geographic space as an array of equally sized squares (cells) arranged in rows and columns. Each cell stores a numeric value that represents an attribute (such as elevation, surface slope, soil pH etc.) for that unit of space. Each GRID cell is referenced by its x, y coordinate location. Typically a GRID file is created based on some sample points with known values. In today’s sample, we take the example of creating a GRID file based on a point based shapefile representing soil pH values of some sample locations in a field. Using the Inverse Weighted Distance algorithm for interpolation, we create the GRID with the pH value for the entire extent of the field. Look at the code and comments for more details on how GRID files get generated and displayed on the map. This sample is a Desktop application but GRID can be used in all the editions of Map Suite.

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 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 add sub menu to the built-in context menu?

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

Sample:Context Menu with Sub Menu

Based on a discussion forum request, today's web project shows you how to add sub menus to ContextMenu. This is a built-in function in all of the most recent daily builds of Map Suite, which you can download from the ThinkGeo Customer Portal. This project also demonstrates how to enable the ContextMenu's auto wrap feature when you click on the edges of the map.

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 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 wrap dateline with projection?

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

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 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?

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

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? & 2 answers

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(Web)

This project is basically the Web version of the previous project “Get Feature Clicked On”. You can see in the Map_Click event of the map the logic for selecting the closest feature clicked on within a buffer in screen coordinate.

Sample:Get Feature Clicked On(Web)2

This project is a more advanced version of “Get Feature Clicked On (Web)”. We show how to deal with the scenario where you want to get the nearest feature clicked on using multiple layers of different types (point, line and polygon). To have smooth behavior on that function, you need to give priority to point based features, and then line based features over polygon. Please, look at the code to see how this is accomplished.

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?

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

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

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 can I call back to the server from JavaScript without a postback?

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

Sample: Callback for Fleet Tracker

In this web-based project, we use Callback technology to create a simple vehicle tracking application and show how to interact between the client side and server side. Almost all of the functionality is implemented by using client-side JavaScript. Therefore we don't need to post back to the server side every time, and the server side doesn't need to send the entire page to the client side. You can see how Callback technology minimizes the need to transfer data over the Internet, which enhances the user experience.

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 can I change the look of the vehicle when it moves within a certain distance of a reference point?

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

Sample:Detect GPS location

The purpose of this project is to complete “AutoRefreshOverlay” of the “How Do I“ sample apps. In this project, you can see the icon of a moving vehicle changing if it is within a certain distance of a reference point. For doing that you can see how to take advantage of SimpleMarkerOverlay and how to do some spatial queries such as GetFeaturesWithinDistanceOf function.

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 move features with Ajax?

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

Sample:Moving Features with Ajax

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

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.

Sample:Customize ZoomLevels

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

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.

How do I move features with Ajax?

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

Sample:Moving Features with Ajax

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