====== Map Suite Wpf Desktop Edition Layers & FeatureSources Samples ====== {{section>upgrade_map_suite_to_10.0}}
==== Raster Image Color Replacement ====
{{wpfedition:map_suite_wpf_desktop_editon_colorreplacement.png?300x180}}
[[Source_Code_WpfDesktopEditionSample_ColorReplacement.zip|View Source]] {{wpfedition:wpfdesktopeditionsample_colorreplacement.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today’s WPF project, we show you how to replace a specific color in a raster image, with the advantage of new added API Color Mapping. For the example, in this project, the lake in Green can be replaced with blue. To make sure this sample work, you will need to use the latest Development daily build of “MapSuiteCore.dll” and “WpfDesktopEdition.dll”, version 9.0.477.0 or higher.
----
==== DynamicMarkerOverlay ====
{{wpfedition:codesamples:map_suite_wpf_desktop_editon_dynamicmarkeroverlay.png?300x180}}
[[Source_Code_WpfDesktopEditionSample_DynamicMarkerOverlay.zip|View Source]] {{filehistory:WpfDesktopEditionSample_DynamicMarkerOverlay.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today’s WPF project, we show you how to retrieve data from a REST service and display them as markers with different styles based on its attributes. You can click on any marker to call a WCF service which returns data from the server. A popup displays a chart with information. All the markers and related information are updated dynamically after a specific time interval.
----
==== Native KML(Keyhole Markup Language) Support ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition KMLFile.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_KMLFile.zip|View Source]] {{filehistory:WpfDesktopEditionSample_KMLFile_141212.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today's WPF project, we show you how to take advantage of Map Suite to load the Keyhole Markup Language (KML) file, which is an XML notation for expressing geographic annotation and visualization within Internet-based brwosers. With the latest KML support in Map Suite, you can eaisily display such files on a Map Suite control, including adorment pictures, placemarks etc. Also you can do the conversion between KML and any other vector formats supported by Map Suite componenets.
----
==== Apply Quick Filter to FeatureSource ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition QuickFilter LinkSource.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_QuickFilter_LinkSource.zip|View Source]] {{filehistory:WpfDesktopEditionSample_QuickFilter_LinkSource_141212.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today's WPF project, we show you how to apply the quick filters to a FeatureSource with the help of LinkSource and LinkExpressions. With the LinkExpreesion, we can specify the query string to determine which features will be displayed. This feature can be applied in all Map Suite products.
----
==== NOAA Global Weather Station ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample NOAA Global Weather Station.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_NOAAGlobelWeatherStationLayer.zip|View Source]] {{filehistory:WpfDesktopEditionSample_NOAAGlobelWeatherStationLayer_141212.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today's WPF project, we show you how to query and display real time NOAA wather station data directly as a Layer, which allows you to display up-to-date weather station data from around the world on top of your maps. The weather station data is sourced from NOAA and is refreshed every 15 minutes in the background. As these classes are inherited from the FeatureSource and FeatureLayer, many properties are querable and can be used to create a variety of maps or analysis of current weather patterns. This feature can be applied in all Map Suite products.
----
==== Magnetic Declination ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Magnetic Declination.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_MagneticDeclination.zip|View Source]] {{filehistory:WpfDesktopEditionSample_MagneticDeclination_141212.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today's WPF project, we show you how to add the Magnetic Declination or Magnetic variation to the map, it's designed as an AdormentLayer, which is used for showing the angle on the horizontal plane between magnetic north (the direction in which the north end of a compass needle, corresponding to the direction of the Earth's magnetic field lines) and true north (the direction along a meridian towards the geographic North Pole). This angle varies depending on one's position on the Earth's surface, and over time. See http://en.wikipedia.org/wiki/Magnetic_declination for more details. This feature can be applied in all Map Suite products.
----
==== Delay Map Drawing Feature ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Delay Drawing.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_DelayDrawing.zip|View Source]] {{filehistory:WpfDesktopEditionSample_DelayDrawing_141212.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In this WPF project, we show you how to use the Delay Map Drawing feature to control whether or not redraw the layer after a specified delay. This option is very helpful for anyone wanting to do something before actually refresh the map, such as editing the elements, adding an animation etc. This effect can be avaible in all Map Suite products.
----
==== Combining Overlays ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Combining Overlays.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_CombiningOverlays_101011.zip|View Source]] {{filehistory:WpfDesktopEditionSample_CombiningOverlays_CS_101011.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today’s Wpf project, we show a technique of using a common FeatureSource for two different Overlays. From a physical shapefile representing cities, a regular LayerOverlay is used for the higher zoom levels while a FeatureSourceMarkerOverlay is used for the lower zoom levels. FeatureSourceMarkerOverlay is a Wpf specific overlay offering features for a better user experience such a Tooltips and ImageSource.
----
==== Create GRID ====
{{wpfedition:codesamples:Map Suite Desktop Edition Sample Create GRID.jpg?300x180}}
[[Source_Code_DesktopEditionSample CreateGRID CS 110512.zip|View Source]] {{filehistory:DesktopEditionSample CreateGRID CS 110512.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
Today’s sample shows the new feature available in this may release Map Suite 5 for creating GRID files. A GRID is a raster format that defines a geographic space as an array of equally sized squares (cells) arranged in rows and columns. Each cell stores a numeric value that represents an attribute (such as elevation, surface slope, soil pH etc.) for that unit of space. Each GRID cell is referenced by its x, y coordinate location. Typically a GRID file is created based on some sample points with known values. In today’s sample, we take the example of creating a GRID file based on a point based shapefile representing soil pH values of some sample locations in a field. Using the Inverse Weighted Distance algorithm for interpolation, we create the GRID with the pH value for the entire extent of the field. Look at the code and comments for more details on how GRID files get generated and displayed on the map. This sample is a Desktop application but GRID can be used in all the editions of Map Suite.
----
==== Edit Attribute Of Shapefile ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Edit Attribute Of Shapefile.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_EditAttributeOfShapefile_CS_110306.zip|View Source]] {{filehistory:WpfDesktopEditionSample_EditAttributeOfShapefile_CS_110306.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
The purpose of this Wpf sample is to show how to edit the attribute of a feature of a shapefile. This sample is useful for anyone wanting to actualize the attribute part of its data by simply clicking on the desired feature on the map and updating its attribute in a textbox. You will find the editing part of the code in the KeyDown event of the textbox.
----
==== Edit Geometry Of Shapefile ====
{{wpfedition:codesamples:Map Suite Desktop Edition Sample Edit Geometry Of Shapefile.jpg?300x180}}
[[Source_Code_DesktopEditionSample_EditGeometryOfShapefile_CS_101021.zip|View Source]] {{filehistory:DesktopEditionSample_EditGeometryOfShapefile_CS_101021.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
The purpose of this sample is to show how to update the geometry of a feature of a shapefile in one step. This sample is useful for anyone wanting to actualize the geometry part of its data. You can see how only a few lines of code are necessary for this process and that the spatial index gets automatically updated after calling the committing the change. Notice that this sample does not show all the fanciness for manipulating at user interaction the geometry to be updated. For this purpose, you can see all the samples related to TrackInteractiveOverlay and EditInteractiveOverlay.
----
==== Get Data From Server With WCF ====
{{wpfedition:codesamples:RequireDataFromServerUsingWcf.PNG?300x180}}
[[Source_Code_SilverlightEditionSample_GetDataFromServerWithWcf_CS.zip|View Source]]
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In this Silverlight-based project, we are going to take a look at how to get geometry data from the server side using the WCF service with Map Suite Silverlight Edition, while keeping all map data on the server side. You can click any of the countries on the map to call a WCF service, which will require data from the server, and then a popup will appear with information about that country.
----
==== Graphic Logo Adornment Layer ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Graphic Logo Adornment Layer.png?300x180}}
[[Source_Code_DesktopEditionSample_GraphicLogoAdornmentLayer_CS_100128.zip|View Source]] {{filehistory:DesktopEditionSample_GraphicLogoAdornmentLayer_CS_100128.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
This sample shows how you can display your logo on the map using an AdornmentLayer. The advantage of using an Adornment is that the graphic stays in place and doesn't move as you pan your map. The sample should work for various kinds of logos and allow you to change the position using the AdornmentLayer's properties.
----
==== Heat Map ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Heat Map.jpg?300x180}}
[[Source_Code_DesktopEditionSample_HeatMap_CS_091022.zip|View Source]] {{filehistory:DesktopEditionSample_HeatMap_CS_101210.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
Heat maps is a technique increasingly used in various fields such in biology and other fields. See http://en.wikipedia.org/wiki/Heat_map. They are also used for displaying areas of webs page most frequently scanned by users. http://csscreme.com/heat-maps/.\\ \\ At ThinkGeo, we are taking this concept to GIS and applying it to geographic maps. Heat maps are a great way to give the users a visually compelling representation of the distribution and intensity of geographic phenomenon. \\ \\ Today, we are posting two Desktop projects on that subject. The first one is using the swine flu data we used in an earlier project. You can see how powerful the visualization of that data is to show the spatial distribution flu swine cases. In the next project, you will see how to take into account column values to produce various degrees of intensity using some earthquake data. In those two projects, you will need references to MapSuiteCore.dll and DesktopEdition.dll.
----
==== Highlight at Mouse Hover ====
{{wpfedition:codesamples:Map Suite WPF Desktop Edition Sample Highlight At Mouse Hover.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_HighlightAtMouseHover_CS_120131.zip|View Source]] {{filehistory:WpfDesktopEditionSample_HighlightAtMouseHover_CS_120131.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In this WPF project, we show you how to highlight a feature when the user hovers the mouse pointer over it. This effect can be realized in Map Suite by using a timer and doing some spatial querying based on the location of the mouse pointer. This sample works with area-based features but the same could be accomplished with point- or line-based features simply by using different spatial queries.
----
==== Heat Map with earthquakes ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Heat Map with earthquakes.jpg?300x180}}
[[Source_Code_DesktopEditionSample_HeatMapWithEarthquakes_CS_091022.zip|View Source]] {{filehistory:DesktopEditionSample_HeatMapWithEarthquakes_CS_101210.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
After the project on displaying swine flu data using the heat map technique, here you learn how to apply parameters other than strictly spatial distribution to affect the coloring of the map.\\ \\ In this example, the magnitude of each earthquake (from 0 to 12) is taken into account to influence the displaying of the heat map. The result is California appearing even more intense than if only the spatial distribution were taken into account.\\ \\ As for the previous project, you will need references to MapSuiteCore.dll, DesktopEdition.dll. As a caveat on heat map in GIS, it is worth mentioning that while this is great tool for displaying data in a very appealing and communicative way, it cannot be used as an analysis tool for studying spatial behaviors. For spatial analysis, GRID is the appropriate tool. Although a heat map looks like a GRID, it is not one and it cannot substitute GRID for spatial analysis.
----
==== Image Stream Loading ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Image Stream Loading.jpg?300x180}}
[[Source_Code_DesktopEditionSample_ImageStreamLoading_CS_100701.zip|View Source]] {{filehistory:DesktopEditionSample_ImageStreamLoading_CS_100701.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
As an alternative to loading an Image with the image file from the file system, you can choose to pass your own stream. This project shows you how to use the event StreamLoading of GdiPlusRasterSource for this purpose. In this project, we show how to do this using a Tiff image but you can also use that event for ShapeFileFeatureSource as we show in a previous project “Shapefile Encryption”. Keep in mind that this technique only works with images besides MrSid, ECW and Jpeg2000. These types of images do not work because the providers do not support streams in their decoding SDKs.
----
==== KML Extension ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample KML Extension.jpg?300x180}}
[[Source_Code_DesktopEditionSample_KmlExtension_CS_100623.zip|View Source]] {{filehistory:DesktopEditionSample_KmlExtension_CS_100623.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
KML is the file format for displaying geographic data in a Google Earth browser such as Google Earth. Now, you can also display such a file on a Map Suite control. Thanks to its flexible architecture to extent to new file formats, in today’s project we wrote the logic for supporting KML. Look at the class KmlfeatureSource inheriting from FeatureSource to see how the logic for reading FML files was implemented. As well, you can see the class KmlStyle inheriting from Style for the drawing logic. And feel free to modify and improve those classes with your own implementations.
----
==== Latitude Longitude Graticule ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Latitude Longitude Graticule.jpg?300x180}}
[[Source_Code_DesktopEditionSample_LatLongGraticule_CS_090827.zip|View Source]] {{filehistory:DesktopEditionSample_LatLongGraticule_CS_090827.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
After the projects on North Arrow and Compass, we created another project related to Adornment Layer to have a more stylish map and give more information to the user navigating the map.\\ \\ In this project, we create a Graticule Adorment Layer that shows Meridians and Parallels displaying through the map. Meridians are lines of longitude and they have a North South orientation. Parallels are lines of latitude and they have an East West orientation. \\ Showing graticule for latitude and longitude is a standard way in cartography to give spatial references to the users. \\ \\ You will find two zip files. One is for the Desktop Edition “LatLongGraticule” and it shows nicely the effect of the meridians and parallels as you pan and zoom in and out. You will also see, as additional spatial references to the users, the latitude and longitude location at the mouse pointer in labels at the mouse move event. You will see that information in the decimal degrees format and in the Degrees Minutes Seconds format.\\ \\ For those that don’t have the Desktop Edition, you will find the zip file “LatLongGraticuleServices” for the Service edition. It is using exactly the same GraticuleAdormentLayer class.\\ \\ In the future, we will offer another class for graticule with more options for formatting and displaying the graticule. It will also offer projection support for map that are not in Decimal Degrees map unit.
----
==== Native TAB File Suppport ====
{{wpfedition:codesamples:TabFileSupport.jpg?300x180}}
[[Source_Code_DesktopEditionSample_NativeTabFileSupport_CS_110524.zip|View Source]] {{filehistory:DesktopEditionSample_NativeTabFileSupport_CS_110524.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
One of the most exciting new features in MapSuite 5.0 is native TAB file support. In the past, the FDO extension was used for displaying TAB files in MapSuite. Now with the new TabFeatureLayer, we have a simpler and more stable method of working with TAB files. \\ \\ This Code Community project demonstrates how to load and display a TAB file using the new TabFeatureLayer. The example also allows you to add, edit and delete features from the TAB file.
----
==== Numbered Grid ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample Numbered Grid.jpg?300x180}}
[[Source_Code_DesktopEditionSample_NumberedGrid_CS_100622.zip|View Source]] {{filehistory:DesktopEditionSample_NumberedGrid_CS_100622.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In many atlases, you can see maps with a numbered grid to give the page reference for a more detailed map. In today’s project, we show how to construct such a grid. Based on the extent of the feature, the number of columns and rows, a grid can be created with the page number in each cell.
----
==== PopupOverlay ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample PopupOverlay.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_PopupOverlay_101007.zip|View Source]] {{filehistory:WpfDesktopEditionSample_PopupOverlay_101007.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In this Wpf project, we explore more capabilities of the PopupOverlay and its collection of Popups. With the Content property, we can add a TextBox or any other control to a Popup. For example, here we show how to have the column value of a selected feature appear in a Popup on the user MapClick event. Notice how that column value can be easily changed by typing in the TextBox of the Popup and committing the edit.
----
==== Save & Load State ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Save Load State.jpg?300x180}}
[[Source_Code_WpfDesktopEditionSample_SaveLoadState_101019.zip|View Source]] {{filehistory:WpfDesktopEditionSample_SaveLoadState_101019.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
The purpose of this Wpf project is to show how to use the new SaveState and LoadState of the SimpleMarkerOverlay. We show how you can simply drag the icons to change their location, save their state to a file and then reload the state from that file. For this sample to work, you will need to use the latest [[Map Suite Daily Builds Guide|production daily build]] of "MapSuiteCore.dll" and "WpfDesktopEdition.dll", version 4.0.40.87 or higher. This project applies to Map Suite Wpf Desktop Edition only.
----
==== Shapefile Encryption ====
{{:No_screenshot.jpg?300x180}}
[[Source_Code_DesktopEditionSample_ShapefileEncryption_CS_100417.zip|View Source]] {{filehistory:DesktopEditionSample_ShapefileEncryption_CS_100417.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
In today’s project, we are looking at a way to encrypt shapefiles to prevent them from being used outside the application. We show how to encrypt and decrypt shapefiles using streams. You will see that a very simple encryption algorithm is used but by looking at the example, you will be able to implement your own.\\ \\ Disclaimer: This encryption system can be used only on small shapefiles due to the amount of memory used. A typical use would be to encrypt some valuable small shapefiles you don't want your users to access. In the future, Map Suite will provide a full encryption system as an API.
----
==== WMTS Overlay ====
{{wpfedition:codesamples:Map Suite Wpf Desktop Edition Sample WmtsTiledOverlay.PNG?300x180}}
[[Source_Code_WpfDesktopEditionSample_WmtsTiledOverlay_121116.zip|View Source]] {{filehistory:Source_Code_WpfDesktopEditionSample_WmtsTiledOverlay_121116.zip|C# Download}}
[[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] \\ [[Map Suite Samples Alternate Languages | Need it in another language?]]
This project shows how to consume data from a WMTS Server using WmtsOverlay. You would find the code pretty straightforward, while behind the scenes we request tiles from the server asynchronously and efficiently, and stitch them into a proper map. \\ This class is introduced from version 6.0.187.0, besides this WmtsOverlay, we also have WmtsLayer available. Here is the [[Map_Suite_Services_Edition_Layers_FeatureSources_Samples#WMTS_Layer|WMTSLayer Sample]].
---- {{page>Map Suite Services Edition Layers FeatureSources Samples}}