User Tools

Site Tools


map_suite_silverlight_edition_all_samples

Table of Contents

Map Suite Silverlight 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 Silverlight Edition How Do I Samples

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.


GPS to Google Map(Web)

map_suite_silverlight_edition_sample_gps_to_googlemap_web.jpg

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.


Great Circle with Google Map

map_suite_silverlight_edition_sample_great_circle_with_googlemap.jpg

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.


Mini map with Google Map

map_suite_silverlight_edition_sample_mini_map_with_google_map.jpg

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.


OpenStreetMap

map_suite_silverlight_edition_sample_openstreetmap.jpg

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.


Shapefile to Google Map

map_suite_silverlight_edition_sample_shapefile_to_googlemap.jpg

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.


Custom Track Line

map_suite_silverlight_edition_sample_custom_track_line.jpg

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.


Custom Track Polygon

map_suite_silverlight_edition_sample_custom_track_polygon.jpg

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.


Dragged Point Style

map_suite_silverlight_edition_sample_dragged_point_style.jpg

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.


Dynamic Info On TrackShapes

map_suite_silverlight_edition_sample_dynamic_info_on_trackshapes.jpg

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.


EditOverlay Styles

map_suite_silverlight_edition_sample_editoverlay_styles.jpg

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.


Select with Track Shape

map_suite_silverlight_edition_sample_select_with_trackshape.jpg

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.


Tracked Shapes to WKT

map_suite_silverlight_edition_sample_tracked_shapes_to_wkt.jpg

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.


Vertex Tolerance

map_suite_silverlight_edition_sample_vertex_tolerance.jpg

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.


Labeling based on size

map_suite_silverlight_edition_sample_labeling_based_on_size.jpg

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.


MultiLine Labeling

map_suite_wpf_desktop_sample_multiline_labeling.jpg

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.


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


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.



Best Practices - Silverlight Edition

silverlighteditionsample_clientandserverdata_cs_110614.jpg

In this Silverlight-based project, we demonstrate the best practices for rendering and querying data that resides on the server or the client. The Map Suite Silverlight Edition provides the developer with many different options on where and how to render your map data. This sample renders one shapefile(airports) on the client side and another shapefile(counties) on the server side. Querying the client-side airport data is very simple and the coding is very similar to the desktop, WPF or WebEditions. Querying the server-side county data is a little more involved and requires the client to communicate back to the server side using a WCF service. This sample presents the developer with a ready to use sample that demonstrates both methods.


You can also check out Part 1 and Part 2 of the video which provides a brief summary of this sample.


Out of Browser Support

map_suite_silverlight_edition_sample_out_of_browser_support.jpg

We have extended the reach of our Silverlight client to utilize the Out-Of-Browser (OOB) feature. This allows you to launch Silverlight applications either disconnected or connected without the browser as the container.

Important Points:

1. To run application in out-of-browser mode, you have to right-click the project and show the “Project Properties” window, then select “Enable running application out of the browser”. You must also click the button labeled “Out-of-Browser Settings…” and make sure the item “Require elevated trust when running outside the browser” is selected.

2. To make sure the ServerLayerOverlay works properly in out-of-browser mode, the property “ConnectorHost” URL of the ServerLayerOverlay must be set. This represents the URL of the page that is hosting the SilverlightMapConnector.


Custom Scale Bar

map_suite_silverlight_edition_sample_custom_scale_bar.jpg

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.


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.


MDI Form

map_suite_silverlight_edition_sample_mdi_form.jpg

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.


Topology Validation

map_suite_desktop_edition_sample_topology_validation.jpg

Starting with version 6.0.113.0, Map Suite includes topology validation capabilities. This Topology Validator sample application makes it simple to visualize and test topology rules. You simply select the case you want to test, use our drawing tools to create the shapes necessary, and then hit the play button to run the test. The error cases are highlighted on the screen and saved to the test, and their Well-Known Text (WKT) is copied to your clipboard. At any time, you can view or edit the WKT which makes up the case. We save our test cases as XML files that contain not only the test case features but also the errors. This makes it a snap for you to share your cases with us or other colleagues.

For more details including a list of topology cases that you can test, see this article or watch the video overview


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.


Use Progress Bar

map_suite_silverlight_edition_sample_use_progressbar.jpg

In this Silverlight-based project, we demonstrate how to implement a custom Overlay inherited from Overlay to add a progress bar indicator while a layer is rendering. The project is simple and meant to show only the basic logic; to extend it, you could add some other information or a loading image instead of a progress bar.


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


Large Scale Map Printing

map_suite_wpf_desktop_edition_sample_large_scale_map_printing.jpg

served as a presentation of the different printing concepts such as page layout, the map element, legends, titles, data grids, logos and the user's interaction with them. Using all of the printing tools we introduced in the first sample, here we will demonstrate a real-world print scenario at a large scale with data for parcels at a county level. By reading the descriptive comments within the sample code itself, you will better understand how to handle your printing needs and follow cartographic standards for map presentation.

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.


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.


Custom Parameters Projection

map_suite_wpf_desktop_edition_sample_custom_paramters_projection.jpg

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.


Custom Rotation Projection

map_suite_wpf_desktop_edition_sample_custom_rotation_projection.jpg

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.


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.


Google Map to Geodetic

map_suite_wpf_desktop_edition_sample_googlemaptogeodetic.jpg

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.


Graticule with Projection

map_suite_wpf_desktop_edition_sample_graticule_with_google_projection.jpg

In today’s Wpf project, we explore more features of GraticuleAdornmentLayer which shows meridians and parallels at various intervals based on the zoom level. Being natively in Geodetic, GraticuleAdornmentLayer can be set to any projection. In this project’s example, you have the graticule showing with World Map Kit in Spherical Mercator (Google Map projection). Also, not how easily you can change the appearance with properties such as GraticuleLineStyle and GraticuletextFont.


Local Datum UTM

map_suite_wpf_desktop_edition_sample_local_datum_utm.jpg

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


Projection by Analyzing Prj File

projectionreadingprjfile.jpg

This project demonstrates how to use the new ConvertPrjToProj4 function to dynamically project shapefiles based on the contents of their .prj file. This is one of the most requested new features of MapSuite 5.0. In the past, you were required to know the EPSG number or proj4 string in order to use the Proj4Projection class. The new ConvertPrjToProj4 method used in this sample will determine a shapefile's projection at runtime by analyzing the contents of the .prj file. This will enable the developer to build applications that allow users to dynamically add shapefiles with various projections and reproject them dynamically at runtime.


Note: There is also a ConvertProj4ToPrj function that can be used to build a .prj file from a proj4 string. This is not covered in this sample, but could be useful in the future.


Projection Distance LineStyle

map_suite_silverlight_edition_sample_projection_distance_linestyle.jpg

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.


Wrap Dateline Mode With Projection

map_suite_wpf_desktop_edition_sample_wrap_date_line_mode_with_projection.jpg

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.


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 On Line Layer

map_suite_wpf_desktop_edition_sample_clipping_on_line_layer.jpg

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.


Create Inner Ring

map_suite_silverlight_edition_sample_create_innerring.jpg

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.


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.


FeatureIdsToExclude

map_suite_silverlight_edition_sample_featureidstoexclude.jpg

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.


Get Feature Clicked On(Web)

map_suite_web_edition_sample_get_feature_clicked_on_web.jpg

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.


Get Feature Clicked On(Web)2

map_suite_silverlight_edition_sample_get_feature_clicked_on_web2.jpg

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.


Intersect Line

map_suite_silverlight_edition_sample_intersect_line.jpg

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.


Polygon Shapes To Multipolygon Shapes

map_suite_wpf_desktop_edtion_sample_polygon_shapes_to_multipolygon_shapes.jpg

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.


Shortest Line Between Two Features with Split

map_suite_wpf_desktop_edition_sample_shortest_line_splitting_lines.jpg

This sample will show you how to find the closest line between two features by using the GetShortestLineTo API and how to split a line at a given point using the GetLineOnALine API. These APIs can be very useful when doing spatial analysis and editing of features. This sample also allows you to dynamically alter the test features using the EditOverlay so you can try out different scenarios and see the results quickly. A MapShapes layer is used to display and style the individual results.

Note: This sample requires that you reference DLLs from the Map Suite WPF Desktop Edition daily development build version 7.0.318.0 or later.


Sweep Angle Desktop

map_suite_silverlight_edition_sample_sweep_angle_desktop.jpg

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.


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.


Default ValueStyle

map_suite_wpf_edition_sample_default_valuestyle.jpg

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.


Distance Line Style

map_suite_silverlight_edition_sample_distance_line_style.jpg

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.


EditOverlay Styles

map_suite_silverlight_edition_sample_editoverlay_styles.jpg

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.


Line Style With Increment

map_suite_desktop_edition_sample_line_style_with_increment.jpg

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.


Multiple Dot Density Styles

map_suite_wpf_desktop_edition_sample_multiple_dot_density_styles.jpg

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


MultiLine Labeling

map_suite_wpf_desktop_sample_multiline_labeling.jpg

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.


Projection Distance LineStyle

map_suite_silverlight_edition_sample_projection_distance_linestyle.jpg

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.


Side View Icon

map_suite_silverlight_edition_sample_side_view_icon.jpg

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.


Smooth Transparent Route

map_suite_silverlight_edition_sample_smooth_transparent_route.jpg

In the Routing extension, the API GetRoute of the RoutingEngine returns a MultilineShape made of a collection of LineShape. By default, the MultilineShape has LineShapes for each two vertex line segment. The result in the displaying of the route using some transparency is a route that looks dotted and irregular. In this project, we show the trick to get one continuous LineShape which will show as smooth and regular. We recognized that the default result is not the most adequate in most cases and we will correct that for the next major release of the Routing extension. In the meantime, you can use that project to get the result that you want to display your routes.


Weather Line Style

map_suite_wpf_desktop_edition_sample_weather_line_style.jpg

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.


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.


map_suite_silverlight_edition_sample_bread_crumb_trail.jpg

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.


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.


Centering And Rotating WPF

map_suite_wpf_desktop_edition_sample_centeringandrotatingwpf.jpg

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.


Centering Map with Tolerance

map_suite_silverlight_edition_sample_centering_map_with_tolerance.jpg

In the previous project, we showed how to center the map on a moving vehicle. While this is great, it has the disadvantage of having to refresh the map each time the vehicle changes position. In this project, we respond to this inconvenience by using a set tolerance used for determining if the map needs to be refreshed or not. If the vehicle moves within a rectangle of a certain size located in the center of the current extent of the map, the map will not refresh and only the moving vehicle will. If it moves outside the tolerance area, the entire map will be refreshed and the tolerance recalculated.


Detect GPS

map_suite_silverlight_edition_sample_detect_gps.jpg

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.


Detect GPS location

no_screenshot.jpg

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.


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.


Traveling Salesman Problem

map_suite_silverlight_edition_sample_traveling_salesman_problem.jpg

In today’s project, we are seeing a variant of the sample “Traveling Salesman Problem” of the “How Do I” samples of the Routing product. At the request of a Discussion Forum user, we added a new API to the GetRouteViaVisitStops function where now you can have distinct start and end points. For being able to run this app, you will need the version 3.1.427.0 or later.


Vehicle Direction

map_suite_silverlight_edition_sample_vehicle_direction.jpg

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.


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.


Center Map Based On Lat/Long

map_suite_silverlight_edition_sample_center_map_based_on_latlong.jpg

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


Centering Map with Tolerance

map_suite_silverlight_edition_sample_centering_map_with_tolerance.jpg

In the previous project, we showed how to center the map on a moving vehicle. While this is great, it has the disadvantage of having to refresh the map each time the vehicle changes position. In this project, we respond to this inconvenience by using a set tolerance used for determining if the map needs to be refreshed or not. If the vehicle moves within a rectangle of a certain size located in the center of the current extent of the map, the map will not refresh and only the moving vehicle will. If it moves outside the tolerance area, the entire map will be refreshed and the tolerance recalculated.


GetZoomLevel

map_suite_silverlight_edition_sample_get_zoomlevel.jpg

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


Map Scales

map_suite_silverlight_edition_sample_map_scales.jpg

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

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


Raster Layer with extent

picture_map_suite_samples_raster_layer_with_extent.jpg

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


Restricting Extent

map_suite_desktop_edtion_sample_restricting_extent.jpg

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


Zoom In To Feature

map_suite_silverlight_edition_sample_zoom_in_to_feature.jpg

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


Zoom In To Point

map_suite_silverlight_edition_sample_zoom_in_to_point.jpg

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

In the next major public release of Desktop Map Suite, we will present a more complete documentation on InteractiveOverlay.


Zoom Levels Partitioning

no_screenshot.jpg

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

This is a Desktop project and you will need the full or evaluation references to MapSuiteCore.dll, DesktopEdition.dll and WorldMapKitWms.dll.


Zoom to Full extent

map_suite_silverlight_edition_sample_zoom_to_fullextent_wpf.jpg

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

This project will be followed by many other WPF projects due to the increasing popularity of that Map Suite version.


Centering and Rotating

map_suite_services_edition_sample_centering_and_rotating.jpg

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


Custom Zoom Levels

no_screenshot.jpg

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


Zoom to Full extent

map_suite_services_edition_sample_zoom_to_fullextent_service.jpg

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

Map Suite License File Generator

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

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

map_suite_silverlight_edition_all_samples.txt · Last modified: 2017/03/17 05:07 by tgwikiupdate