User Tools

Site Tools


map_suite_services_edition_all_samples

Table of Contents

Map Suite Services Edition All Samples

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

Map Suite Services Edition How Do I Sample

The “How Do I?” samples collection is a comprehensive set containing dozens of interactive samples. Available in both C# and VB.NET, these samples are designed to hit all the highlights of Map Suite, from simply adding a layer to a map to performing spatial queries and applying a thematic style. Consider this collection your “encyclopedia” of all the Map Suite basics and a great starting place for new users.


Decimal Degrees Formatting

LEAD Technologies Inc. V1.01

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.


Label to Show Location

map_suite_services_edition_sample_label_to_show_location.jpg

This project shows how to use layers not for displaying but for getting location information on the current extent of the map. Getting information of the administrative divisions of the current extent of the map is convenient because it gives a spatial clue when the map is zoomed in too close to have any major features recognizable. In this project, we use the WorldMapKit as a background and the shapefiles state and counties are used for displaying the spatial clue.


Labeling Based On Columns

map_suite_services_edition_sample_labeling_based_on_columns.jpg

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.


Multi Column Labeling

LEAD Technologies Inc. V1.01

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.


ENC Viewer for displaying S-57 (*.000) File

map_suite_wpf_desktop_edition_s57viewer.jpg

Today’s project is a tool of ENC Viewer for displaying unencrypted Electronic Navigational Charts (ENCs) available in the S-57 exchange format (*.000).
This tool takes use of Map Suite HydrographyExtension to display ENC data in compliance with the latest version of ECDIS Presentation Library Edition 4.0, which is defined by the International Hydrographic Organization (IHO) in the special publication S-52.

NOTE: the styling file “NauticalCharts.xml” for drawing S-57 (*.000) file is included in the source code package.


GPS EXchange Format FeatureLayer

This sample demonstrates how to read GPS EXchange Format file(*.gpx) with Map Suite. GPX (GPS Exchange Format) is a light-weight XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications and Web services on the Internet, which you can find more information:here. Now Map Suite supports the GPX 1.0 and 1.1 schema. This sample works with Map Suite development branch daily build 7.0.275.0 or later.


Maritime S57 FeatureLayer

This sample demonstrates how to display unencrypted Electronic Navigational Charts (ENCs) available in the S-57 exchange format (*.000). It follows the style schema defined in the latest version of ECDIS Presentation Library Edition 4.0 (S-52), which is published by International Hydrographic Organization (IHO).

NOTE: This sample works with Map Suite development branch daily build 9.0.31.0 or later, Map Suite Unmanaged Dependencies 9.0.31.0.msi or later needs to be installed.


Build Custom Shapefile Indexes

map_suite_services_edition_sample_build_custom_shapefile_indexs.jpg

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.


CAD FeatureLayer

map_suite_services_edition_sample_display_cad_file.jpg

This sample demonstrates how you can read data from an CAD file(*.dwg, *.dxf) in your Map Suite GIS applications, and how to render it with CAD embedded style as well as a customized style. It works with Map Suite daily development build version 7.0.46.0 or later, and Setup Unmanaged Dependencies 7.0.46.0 or later needs to be installed to make the sample work. This Cad File support would work in all of the Map Suite controls such as WPF Desktop Edition, Silverlight Edition, Web Edition, MVC Edition. The CAD dependencies assemblies can be downloaded from http://wiki.thinkgeo.com/wiki/File:MapSuiteCADDependencies8.0.109.0.zip


TAB FeatureLayer With Embed Style

map_suite_services_edition_sample_display_tab_file.jpg

This sample demonstrates how you can read data from an Tab file(*.tab) in your Map Suite GIS applications, and how to render it with Tab embedded style as well as a customized style. It works with Map Suite daily development build version 8.0.208.0 or later. This Tab File support would work in all of the Map Suite controls such as WPF Desktop Edition, Silverlight Edition, Web Edition, MVC Edition.



Compass

map_suite_services_edition_sample_compas.jpg

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


File Geodatabase

map_suite_services_edition_sample_filegeodatabase.jpg

This sample demonstrates how you can read data from an ESRI FileGeodatabase in your Map Suite GIS applications. The sample will read data from 3 tables of one FileGeodatabase, and you will find the code as straightforward as consuming any other data source in Map Suite. It works with Map Suite daily development build version 6.0.115.0 or later, and you will need to run the “Setup Unmanaged Dependencies” installer from your daily build package in order for the sample to work The FileGeodatabase sample works in all of the Map Suite controls such as WPF Desktop Edition, Silverlight Edition, Web Edition, MVC Edition and so on.

Video Overview


Hook Up External Data to Shapefile

map_suite_services_edition_sample_hook_up_external_data_to_shapefile.jpg

This sample shows how to hook up external data to shapefile. The US states shapes are from a shapefile while the population values for Washington and New York come from an external database. From this sample, we can see how to use the event FeatureSource.CustomColumnFetch to introduce an external data source and utilize Dictionary objects to cache the external data.



Isolines

map_suite_services_edition_sample_isolines.jpg

In this sample we show how you can use Map Suite to add isolines (commonly known as contour lines) to your .NET application. 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. This 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.

Please note that you will need version 5.0.87.0 or newer of Map Suite in order to use isolines. For more information on how to upgrade, see the Map Suite Daily Builds Guide.

From 6.0.187.0, the sample has been updated that polygons can also be returned as IsoLines results. You need version 6.0.187.0 or newer of Map Suite in order to use this sample.


Isolines with Kriging

map_suite_services_edition_sample_isolines_with_kriging.jpg

In this sample we show how you can generate isolines (commonly known as contour lines) using Kriging Interpolation Models. We integrated 5 Kriging interpolation models (Circular, Exponential, Gaussian, Linear, Spherical) in Map Suite which you can see from the sample are powerful and very straightforward to use. It works with Map Suite 6.0.126.0 or later.



MapShapes

map_suite_services_edition_sample_map_shapes.jpg

One of the most requested features left out of Map Suite 3.0 is MapShapes. For those who are not familiar with MapShapes, in Map Suite 2.0 they were a group of self-contained features that had their own styles, projection and column data. This meant that each one could be unique; however, this also meant you had to specify all of the attributes about each single MapShape.

In working with customers using MapShapes for a number of years, we found a common pattern. First, users tried MapShapes by adding one to the screen. This was very simple and got them up and running fast. They next added a few more as they started to build more of their application. After a short amount of time they realized that it was cumbersome to set the projection, styles, zoom levels, etc. on so many MapShapes, especially since the MapShapes often represented the same kind of underlying feature, like a fire hydrant or road block. The problem was that there was no good solution with Map Suite 2.0 to handle lots of very similar dynamic features.

In designing Map Suite 3.0, we took this into account and created the InMemoryFeatureLayer and InMemoryFeatureSource. These allowed you to treat all of the same kinds of similar features as if they were one group, which solved many problems. What we later found was that it made it more difficult for the cases where you truly had dozens or hundreds of features that were each unique and you needed to represent them as such. Having not implemented MapShapes, we were caught with a hole in our offering.

To fill this gap, we are presenting a project for a simple MapShapeLayer. This is a simple version of a more powerful one that we will include as part of the core framework in the near future. What really struck us when we were creating this new Layer was just how easy it was to do! It is a testament to our 3.0 framework and we decided to include the section below on how we implemented it.
Notes from the developer:

Success! This was about as easy as I thought it would be. All of the heavy lifting was done by existing classes and all I needed was a little glue code. In retrospect, I would had liked to do this by inheriting from the FeatureLayer and FeatureSource, because then it would have made the layer accessible by spatial queries. In the interests of time, and so I could post this on our forums as fast as possible, I inherited from Layer, which is really simple. You can see that the comments and my notes here take up more room than the code itself!

I think you will find this works nearly exactly as the 2.0 MapShapes did. It doesn't support projection; however, I think this could be easily added. We will be creating a production version of this class to include with the framework in the near future, and if projection is indeed easy to add, it will support projection and spatial querying.

In a nutshell, what I did was to create a MapShape class that housed a ZoomLevelSet and a single Feature. The ZoomLevelSet has all of the zoom levels, styles, etc. on it, so that part was nice to reuse. I matched this up with a new kind of Layer. I created the MapShapeLayer by inheriting from Layer. The only required overload was Draw, which was nice. I added to the class a MapShape's GeoCollection to store all of your MapShapes. In the Draw I simply looped through the MapShapes, and for each of them I found the zoom level that would be drawing and called its Draw method. In just a few lines of code, it all came together.


Mini Map Adornment Layer

map_suite_services_edition_sample_mini_map_with_adornment_layer.jpg

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




Multi Geo Raster Layer

no_screenshot.jpg

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.


Multi Index

map_suite_services_edition_sample_multi_index.jpg

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


North Arrow

map_suite_services_edition_sample_north_arrow.jpg

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.


Oledb Point FeatureSource

map_suite_services_edition_sample_oledb_point_featuresource.jpg

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


Oledb FeatureSource

map_suite_services_edition_sample_oledb_featuresource.jpg

This project shows how you can store your geometry data in any OLEDB compatible database. The sample provides a custom FeatureSource and FeatureLayer that allows you to query, insert and edit a full range of spatial. The spatial data is stored in binary using Well Known Binary and its index is a series of four columns describing the bounding box. This solution does not require your database to support any sort of special spatial indexing as it is all build into table structure and uses plain SQL statements to query back the data. This sample is also a great way to see how it is easy and efficient to extend Map Suite to meet your specific requirements.

NOTE: For portability and allowing the sample to be self-contained with minimal setup we have used a Microsoft Access database. Due to this there is a limitation there the “Microsoft.Jet.OLEDB” engine can only run in X86 mode. This is reflected in the target for this project. If you use another OLDB source then is limitation is no longer applicable.


Scale Bar

map_suite_services_edition_sample_scale_bar.jpg

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.


SQLInMemoryLayer

The purpose of this sample is to show you a quick and easy way to read data from a SQL data source and display it on the map using an InMemoryFeatureLayer. Since geometric feature data can be stored in a number of different formats such as X and Y coordinates, WKT (Well Known Text), and Geometry data types, this sample shows you how to load, edit and save data to a SQL data source for each different type of format. The sample includes a SQL script you need to run first, in order to create and populate a SQL Server table with sample data. You will also need to change the connection information in the code on lines 71 and 204 so that it points to your SQL Server.

Note: The approach in this sample works best for small amounts of data (less than 10,000 features) since it loads all of the data into memory. For larger datasets, we recommend using the SQL2008FeatureLayer or the ''OledbFeatureSource'', which only reads the data for the given extent you are working in (much more efficient for larger datasets).


Styles with InMemoryFeatureLayer

In this WPF project, we show how to build an InMemoryFeatureLayer from a text file. You'll notice how the columns are set up so that styles can be used as if the InMemoryFeatureLayer were a static layer such as a Shapefile. Here, we apply a Class Breask Style and a Text Style to our InMemoryFeatureLayer. What we learn in this sample can be applied to all the different editions of Map Suite.


Swine Flu

map_suite_services_edition_sample_swine_flu.jpg

In today’s project is going to apply some of the techniques we learned in the previous projects to some swine flu data available on the web.
On the web site
http://www.mapcruzin.com/free-download-h1n1-swine-flu-arcgis-shapefile.htm, it is possible to download point based shapefiles of swine flu occurrences in the world. While this information is valuable, it is a little difficult to display it at world level. At high zoom levels, all the points are on top of each other making the map very difficult to read and get overall information of the swine flu situation at the world level as you can see in the image with the map of the upper left.

Using some the techniques we used before such as Spatial Join with some modification, we can create a new polygon based layer from the country layer adding info from the swine flu layer. That resulting layer can be displayed with the info being a lot more readable as you can see in the map of the lower right corner of the image.

We basically use the techniques we saw in the “Spatial Join” project with getting the info from the swine flu layer into the country layer based on spatial relationship. We also use the techniques from “Dissolve with statistics” for doing some statistics on the swine flu records according to what country they belong to. See the comments in the project for more details.

Keep in mind that the project is for shapefile data format, if there are people expressing interest for doing the same thing with other data format, we will create a new more generic project.


Watermark Adornment Layer

map_suite_services_edition_sample_watermark_adornment_layer.jpg

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.


WMTS Layer

This project shows how to consume data from a WMTS Server using WmtsLayer. You would find the code pretty straightforward, just like displaying a shapefile, while behind the scenes we request tiles from the server asynchronously and efficiently, and stitch them into a proper map.
This class is introduced from version 6.0.187.0, besides this WmtsLayer, we also have WmtsOverlays in different products. For example, this is the WPF WmtsOverlay Sample.


Zedgraph

LEAD Technologies Inc. V1.01

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.


Map Suite Explorer (ServiceEdition)

This week, we decided to publish in the Code Community the project for Map Suite Explorer. You are already familiar with that free Desktop tool that comes with any edition of Map Suite. It is a basic GIS tool that allows you to view your geographic data and its tabular information. It also allows doing some basic manipulation on your date such as building the spatial index. With the source code at your disposition, you can cut time developing your own application by having at your disposal the code for doing common tasks such as loading, unloading layers, building spatial index, changing styles etc. You will also find interesting the legend and see how you can add, remove, move up and down the different layers. It is by far the most comprehensive project in the Code Community to that date. You will need the reference for MapSuiteDesktop.dll and MapSuiteCore.dll (full or evaluation) to run it.


Tile Cache Generator

<div sample_otherlinks> [


screenshot

In this sample we show you how to add robust printing support to your Map Suite applications for the desktop, WPF, web or services environments. Using the code in this sample, you'll be able to build a Print Preview interface that lets your users interactively arrange items (such as a map, scale line, labels, data grid or image) on a virtual page before printing the result to a printer, exporting to a PDF or to a bitmap image. Maps are printed using vector graphics so you can be sure the output will look great on anything from a PDF to a large plotter. The printing system also includes low-level report building classes that make it easy to generate reports in the web or services environment.

To help you understand the sample, as well as Map Suite's new printing system upon which it is based, check out our instructional video that will introduce you to all of these concepts and walk you through the sample solution.

Please note that you will need version 5.0.102.0 or newer of Map Suite in order to use the new printing features. For more information on how to upgrade, see the Map Suite Daily Builds Guide.

Note: Users of Map Suite Web, Silverlight and Services Editions will not have access to the interactive drag-and-drop page layout interface pictured here. However, these editions can still be used to programmatically design page layouts in code and then export them to a printer.


Datum Transformation

map_suite_services_edition_sample_datum_transformation.jpg

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.


Geodetic to State Plane

map_suite_services_edition_sample_geodetic_to_state_plane.jpg

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.


Geodetic to UTM on the fly

map_suite_services_edition_sample_geodetic_to_utm_on_the_fly.jpg

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.


GeoRaster Projection

map_suite_services_edition_sample_raster_projection.jpg

This sample demonstrates how you can project raster layers in real-time for your .NET GIS application. In the sample it will show you show we switch a small sample image to and from a variety of projections. This sample was developer using the Map Suite Services Edition just to show how these feature are in the core of the framework. Projection can easily be applied to all of products such as the Wpf Desktop Edition, Silverlight Edition, MVC Edition and so on. It is important to note that this implementation is unmanaged and at the moment we do not have a managed version however we are working on it.


Great Circle on Pacific Rim

map_suite_services_edition_sample_great_circle_on_pacific_rim.jpg

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.


Measurements Decimal Degrees

LEAD Technologies Inc. V1.01

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”


Pacific Rim

picture_map_suite_samples_pacific_rim.jpg

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


Polygon across Meridian

map_suite_services_edition_sample_polygon_across_meridian.jpg

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.


Projection Distortion

map_suite_services_edition_sample_projection_distortion.jpg

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.


Projection in Feet

no_screenshot.jpg

You may be in the situation where you have data in a projection that is in feet. For example, you may have the data for the USA in the standard Lambert projection in feet. Unfortunately, many of the projections offered in the PROJ4 library (the default projection library in Map Suite), handles the different projections in meters. It is the case for USA Contiguous Lambert Conformal Conic projection (ESPG code 102004). It is only available in meters.This project will show you the trick to easily have the projection of your choice being in feet using the original projection in meters.


Routing with Projections

map_suite_services_edition_sample_routing_with_projection.jpg

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.


Save To Projection

LEAD Technologies Inc. V1.01

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.


Spherical Mercator Projection Adjustment

map_suite_desktop_edition_sample_spherical_mercator_projection_adjustment.jpg

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.


Street Intersection

map_suite_services_edition_sample_street_intersection.jpg

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.


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.


World Coordinates

LEAD Technologies Inc. V1.01

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.


Clipping

map_suite_services_edition_sample_clipping.jpg

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.


Clipping On Point Layer

map_suite_services_edition_sample_clipping_on_point_layer.jpg

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.


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.


Correcting Nodes

map_suite_services_edition_sample_correcting_nodes.jpg

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.


Create Polygon Programatically

map_suite_services_edition_sample_create_polygon_programatically.jpg

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.


Dissolve on Shapefile

map_suite_services_edition_sample_dissolve_on_shapefile.jpg

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.


Dissolve with Statistics

map_suite_services_edition_sample_dissolve_with_statistics.jpg

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.


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


Dynamic Segmentation

map_suite_services_edition_sample_dynamic_segmentation.jpg

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.


Get Feature Clicked On With Projection

map_suite_services_edition_sample_get_feature_clicked_on_with_projection.jpg

This WPF project shows a technique for finding the feature of a point, line or polygon-based layer that the user clicked on. As with the earlier sample entitled “Get Feature Clicked On”, in order to give the user the expected behavior, a buffer in screen coordinates needs to be set so that the selected feature is chosen within a constant distance in screen coordinates from where the user clicked on, regardless of the zoom level. In addition, this sample also addresses a limitation of the earlier sample by showing the contrast between using the functions GetFeaturesNearestTo and GetFeaturesWithinDistanceOf.

While the function GetFeaturesNearestTo as used in “Get Feature Clicked On” works quickly and is adequate in most cases, it is not guaranteed to get the closest feature. In contrast, with the new function GetFeaturesWithinDistanceOf, you can loop through the features within a specified tolerance and get their exact distance. While this approach requires some more code, it is guaranteed to get the closest feature in every case.

This sample also demonstrates another aspect of distance queries. We have the layers projected to the Google Map projection from WGS84, and you'll notice that the aforementioned distance functions (GetFeaturesWithinDistanceOf and GetFeaturesWithinDistanceOf) work seamlessly without requiring the developer to worry about whether the layers are projected or not.


Identify Point with Icon

map_suite_services_edition_sample_identify_point_with_icon.jpg

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.


Inner Ring Containment

map_suite_services_edition_sample_inner_ring_containment.jpg

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.


Intersecting Multi Polygon

map_suite_services_edition_sample_intersecting_multipolygon.jpg

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.


Intersecting Two Layers

map_suite_services_edition_sample_intersecting_two_layers.jpg

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.


Merge Line Layers

map_suite_services_edition_sample_merge_line_layers.jpg

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


Merge Point Layers

map_suite_services_edition_sample_merge_point_layers.jpg

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.


Merging Layers

map_suite_services_edition_sample_merging_layers.jpg

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


Multi Ring Buffering

LEAD Technologies Inc. V1.01

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.


Negative Buffering

LEAD Technologies Inc. V1.01

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.


Offset Point at Right Angle

map_suite_services_edition_sample_offset_point_at_right_angle.jpg

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.


Register Shape

map_suite_services_edition_sample_register_shape.jpg

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.


Remove LineShape

map_suite_services_edition_sample_remove_lineshape.jpg

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.


Spatial Join

map_suite_services_edition_sample_spatial_join1.jpg

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.


Split Polygon

LEAD Technologies Inc. V1.01

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.


Split Polygon Based On Grid

This utility was designed to grid high point-count polygons to aid in faster rendering. It is one of the utilities used in the Performance Guide section of the wiki and is also featured in a performance learning video.

From the Performance Guide:

One way to dramatically increase performance is to grid your polygons, thus getting them into an optimized state for rendering. What we want to do is get the average tile render time to be as low as possible. Typically, the features that take the longest time to draw are high point-count polygon layers. Imagine you are rendering a low-level tile that is essentially blank. Most places are empty space at the lowest level, containing perhaps only a small road segment or something similar. To render this, you typically use the country / region polygon to render the earth tone that is the background of your map. There may also be large polygons as well which, while not in view, will be loaded as the tile being rendered is within their spatial bounding box. In order for that simple tile to draw, it needs to read the large region polygon, which may have hundreds of thousands of points, and draw it. While most or all of the points are clipped at run-time, it still takes time to load the bytes from disk, transform to well-known binary, clip them, etc. In many examples, a simple tile can take 500 milliseconds to draw even though it is essentially blank. This makes every area on the map very heavy and inefficient.

To solve this issue, we suggest that you grid and split your polygon Shapefiles specifically for improved drawing speed. In this process we take your original high point-count polygon and split it with a grid, with a size depending on the target scale, so that much of the old polygon's area is made of very simple squares with each being composed of just the square's edges. When your simple tile goes to draw, it finds the simple square, draws that and the whole process avoids loading and drawing the tens of thousands of points. We regularly see rendering times for the layer decrease from 500ms to less than 5ms.


Split Polygon Dynamically into Grids based on the Area

This utility was designed to create a “Dynamic Grid” based on the area of the shape, for example, grids in Russia should be bigger than the grids in France. Compared with the fixed size grid in sample http://wiki.thinkgeo.com/wiki/map_suite_services_edition_all_samples#split_polygon_based_on_grid , it’s more efficient and has better drawing performance.



From the Performance Guide:

One way to dramatically increase performance is to grid your polygons, thus getting them into an optimized state for rendering. What we want to do is get the average tile render time to be as low as possible. Typically, the features that take the longest time to draw are high point-count polygon layers. Imagine you are rendering a low-level tile that is essentially blank. Most places are empty space at the lowest level, containing perhaps only a small road segment or something similar. To render this, you typically use the country / region polygon to render the earth tone that is the background of your map. There may also be large polygons as well which, while not in view, will be loaded as the tile being rendered is within their spatial bounding box. In order for that simple tile to draw, it needs to read the large region polygon, which may have hundreds of thousands of points, and draw it. While most or all of the points are clipped at run-time, it still takes time to load the bytes from disk, transform to well-known binary, clip them, etc. In many examples, a simple tile can take 500 milliseconds to draw even though it is essentially blank. This makes every area on the map very heavy and inefficient.

To solve this issue, we suggest that you grid and split your polygon Shapefiles specifically for improved drawing speed. In this process we take your original high point-count polygon and split it with a grid, with a size depending on the target scale, so that much of the old polygon's area is made of very simple squares with each being composed of just the square's edges. When your simple tile goes to draw, it finds the simple square, draws that and the whole process avoids loading and drawing the tens of thousands of points. We regularly see rendering times for the layer decrease from 500ms to less than 5ms.


Sweep Angle

map_suite_services_edition_sample_sweep_angle.jpg

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.


Splitting Polygons with a Line

split.jpg

This projects demonstrates how you can split a polygon with a line. This can be useful for users in land management allowing them to split fields and parcels or any other type of polygon.


Adjusted Scaling Image Style

map_suite_services_edition_sample_adjusted_scaling_image_style.jpg

The purpose of this project is to address some of the limitations of the ScalingImageStyle that we saw in the project of the same name. As with ScalingImageStyle, with AdjustedScalingImageStyle, you have the icon scaling up and down according to the zoom level; but you can also have the icon pointing correctly to the point feature it represents if for example you are using a pin as an icon. Also, the problem of the height of the image not sizing proportionally to its width has been corrected.


Cached Value Style

no_screenshot.jpg

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.


ClusterPointStyle

map_suite_services_edition_sample_cluster_point_style.jpg

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.


Decimal Degrees Formatting

LEAD Technologies Inc. V1.01

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.


Displaying One-Way Streets

LEAD Technologies Inc. V1.01

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


Doughnut Point Style

map_suite_services_edition_sample_doughnut_point_style.jpg

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.


Feature Centric Style

map_suite_services_edition_sample_feature_centric_style.jpg

This project got inspired for looking at the sample “ClassBreakStyle” of How Do I demo apps. Using a ClassBreakStyle, the data is displayed based on what class each feature belongs to. Using a custom FeatureCentricStyle, each feature is displayed in relation to a central feature. In this example, it shows all the countries that have a comparable population to a reference country.

To do that, we use a custom style FeatureCentricAreaStyle inheriting from AreaStyle and we override DrawCore and GetRequiredColumnNamesCore methods. The code in DrawCore loops thru all the features and checks if the value for a specified column is within a certain range of the central feature.

You can see how you could apply and extent the logic of this custom style to be used in Real Estate for example, where you could see all the properties that are comparable according to some criteria to a selected property.


Flashing Point Style

map_suite_services_edition_sample_flashing_point_style.jpg

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.


Hybrid TextStyle

map_suite_services_edition_sample_hybrid_textstyle.jpg

This project is a follow up to the Discussion Forum post here
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.


Image Style

As you probably already know, using the Map Suite API, you can easily display a point-based feature as an image. But how do you do the same thing for a line or a polygon-based feature? In this WPF project, we show you how to create custom Image Styles for both line and polygon features. With the new ImageAreaStyle, you can display a polygon feature that uses an image as its fill. You can see how an image for forest and water is used in the sample project. And with the new ImageLineStyle, you can do the same thing with line features. You'll see how an image of a pavement texture is used to represent streets.


Isolines

map_suite_services_edition_sample_isolines.jpg

In this sample we show how you can use Map Suite to add isolines (commonly known as contour lines) to your .NET application. 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. This 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.

Please note that you will need version 5.0.87.0 or newer of Map Suite in order to use isolines. For more information on how to upgrade, see the Map Suite Daily Builds Guide.


Rotate Icon

map_suite_services_edition_sample_rotate_icon.jpg

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.


Routing Styles

map_suite_services_edition_sample_routing_styles.jpg

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.


Scaling Image Style

map_suite_services_edition_sample_scaling_image_style.jpg

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.


Scaling TextStyle

map_suite_services_edition_sample_scaling_textstyle.jpg

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.


Scaling TextStyle for Polygon

map_suite_services_edition_sample_scaling_textstyle_for_polygon.jpg

In the project “Scaling TextStyle”, we learned how to create a custom TextStyle to have the font size proportional to the scale while zooming in and out the map when labeling point based features. In the project “Scaling Image Style”, we learned basically the same thing but applied to an icon or an image. In today's project, we also learn how to create a scaling textStyle but for polygon features. Notice in the overridden DrawCore function how we calculate the font size based on the current and how we make sure no label overlapping exists by using the function CheckOverlapping of the base class before drawing the label for each part of the polygon.


Sized Point Style

map_suite_services_edition_sample_sized_point_style.jpg

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.


Start End LineStyle

map_suite_services_edition_sample_start_end_line_style.jpg

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


TextStyle for Multi Line

map_suite_services_edition_sample_textstyle_for_multiline.jpg

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.


Time Based Point Style

map_suite_services_edition_sample_time_based_pointstyle.jpg

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.


Time Line

map_suite_services_edition_sample_time_line.jpg

In this project, we learn another way to inherit from Style creating the class DateBasedStyle to display features according to some time values. Using a Time Line based on a track bar, the user can scroll back and forth on the time line to see what states were parts of the Union at any year.

Also, notice that this project used three instances of the MapEngine to have the states of Alaska and Hawaii displayed on a different PictureBox.


ValueStyle with Countries

map_suite_services_edition_sample_valuestyle_with_countries.jpg

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.


WordWrapped TextStyle

map_suite_services_edition_sample_wordwrapped_textstyle.jpg

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


World Sized Image Style

map_suite_services_edition_sample_world_sized_image_style.jpg

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.


World Sized Text Style

map_suite_services_edition_sample_world_sized_textstyle.jpg

In our Discussion Forum, we have a user asking for how to label text at world coordinates. For example, how to display a label at a size of 50 kilometers? Now, you can find in this project a custom TextStyle called WorldSizedTextStyle that does that. Whether your map is in Meters, Feet or Decimal Degrees, you can have the labels displayed at the desired size in any real world distance unit such as kilometers, meters, miles, feet etc.


Label Point with Circle Symbol and Mask Description

In this WPF project we show how you can create a friends network using a point with a circle symbol. It’s a combination of PointStyle and TextStyle, including a description with a mask that keeps the labels in the same layer. It was originally required by a customer at http://community.thinkgeo.com/t/label-on-a-circle-with-lot-of-points/8193/6, it’s a solution with many applications.


Centering and Rotating

map_suite_services_edition_sample_centering_and_rotating.jpg

In the project “Centering On Moving Vehicle”, we learned how to have the map always centered on a moving vehicle. In this project, we go one step further and show how to have the map also rotating according to the direction of the moving vehicle. In this project, you will also see how to use the CompassAdornmentLayer that always indicates the north as the map rotates.


Centering On Moving Vehicle

map_suite_services_edition_sample_centering_on_moving_vehicle.jpg

A commonly requested feature when tracking a vehicle for GPS application is to have the map centered on a vehicle as it moves. Implementing this is fairly easy with Map suite using the CenterAt API. In this project, you will see this feature in action with a vehicle represented by a vehicle icon being always the center of the extent of the map. You can also take advantage of this project to learn some other techniques related to GPS such as reading GPS data from a text file and applying a rotation angle to show the direction.


Chemical Plume

map_suite_services_edition_sample_chemical_plume.jpg

In this project, we show how simple it is to display and do spatial analysis with chemical plumes.
The US department of transportation sets standards for protection and isolation zones according to the type of chemical involved. You can find all that publicly available information at http://www.phmsa.dot.gov/

With Map Suite, you can easily build those zones, display them and do spatial analysis.
You will notice an interesting feature of this project is that it combines WorldMapKit wms for street map background display and the actual vector street data for analysis.
For this project, you will need the very latest evaluation or full edition of MapSuiteCore.dll and WorldMapKit Wms.dll for displaying the background street map.


Filter Radar Image

map_suite_services_edition_sample_filter_radar_image.jpg

NOAA (National Oceanic and Atmospheric Administration) makes available for the public Radar images http://radar.weather.gov/ridge/Conus/RadarImg/
Those images show the precipitation activities based on the whole range of dBz scale. (see http://en.wikipedia.org/wiki/DBZ_%28meteorology%29)

You might want to keep only dBz scales superior to 20 which correspond to actual rain. You might also want to add some transparency to better show the layers below the radar image.

This project shows how to filter the image for that purpose. You will see how to create a new filtered image better fit to be displayed on the map. You will find particularly interesting the power of using directly the GDI+ API which is very handy with dealing with a Map Suite GDIPlusRasterLayer.


Rotated Image Style

map_suite_services_edition_sample_rotated_image_style.jpg

This project shows how to use an icon to rotate it according to the direction of some GPS readings. An InMemoryFeatureLayer is used with various Features representing vehicles. For representing the symbol a Custom Style is created inheriting from Style. Notice that the Custom Style overrides the methods DrawCore and GetColumnNamesCore. You will also see how to update the X and Y value of the PointShape making up each feature. This project is based on the Servicess edition, I recommend also to look at the project Vehicle Direction which is a Desktop App. The difference is in the use of the Layers and the drawing techniques to update the position and symbol of the features.


Snap GPS to Street

map_suite_services_edition_sample_snap_gps_to_street.jpg

In this sample we are going to handle the common case of snapping a point to a set of features in a layer. The common case for this is snapping real-time GPS points to road layers. GPS has an error factor and it's nice to display vehicles on a map snapped to the roads they are on. It can also be used for a number of other different cases as well, such as finding not just the road position but the road name. You may display or store the road name for the trip in your database.

In the sample we have set up a road layer; when you click on the map it will find the closest road segment within a tolerance and snap the point to that road. You can click repeatedly around a road and simulate GPS points coming in. Inside of the sample, we have encapsulated the functionality into a method that can easily support multiple layers, varying tolerances, and different data units.


Centering and Rotating

map_suite_services_edition_sample_centering_and_rotating.jpg

In the project “Centering On Moving Vehicle”, we learned how to have the map always centered on a moving vehicle. In this project, we go one step further and show how to have the map also rotating according to the direction of the moving vehicle. In this project, you will also see how to use the CompassAdornmentLayer that always indicates the north as the map rotates.


Custom Zoom Levels

no_screenshot.jpg

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


Zoom to Full extent

map_suite_services_edition_sample_zoom_to_fullextent_service.jpg

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

Map Suite License File Generator

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

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

map_suite_services_edition_all_samples.txt · Last modified: 2017/03/17 02:42 by tgwikiupdate