mcpField
S
syncfusion-winforms-map

syncfusion-winforms-map

github.com/syncfusionData & databases278 installsUpdated 1w ago
Repository

About syncfusion-winforms-map

A guidance skill for implementing Syncfusion Maps in Windows Forms. It helps desktop developers render geographic data from shape files and build statistical, multi-layer, and interactive map views.

Key features

  1. 01Shape file rendering
  2. 02Multi-layer maps and data binding
  3. 03Bubble maps with size and color mapping
  4. 04Legends and annotations
  5. 05Tooltips, selection, zoom, and pan

Use cases

  1. 01Population maps by region
  2. 02Sales territories and volume
  3. 03Election results by area
  4. 04Location analytics dashboards

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/syncfusion/winforms-ui-components-skills --skill syncfusion-winforms-map

After installing, type/syncfusion-winforms-mapin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
annotations.md
bubbles.md
customization.md
getting-started.md
layers.md
legends.md
map-points.md
user-interaction.md

Details

From the project README

Implementing Maps in Windows Forms

The Syncfusion WinForms Maps control is a powerful geographical data visualization component that renders shape files and displays statistical information with interactive features like zooming, panning, tooltips, and selection.

When to Use This Skill

Use the Maps control when you need to:

  • Geographical Visualization: Display geographical data on world maps, country maps, or regional maps
  • Statistical Maps: Create choropleth maps showing statistical data by region (population, sales, demographics)
  • Bubble Maps: Visualize data using bubbles of varying sizes on map locations
  • Multi-Layer Maps: Combine multiple geographical layers (e.g., world map with highlighted regions)
  • Interactive Maps: Enable user interaction with tooltips, selection, zooming, and panning
  • Dashboard Integration: Add map visualizations to desktop dashboard applications
  • Location Analytics: Build applications that analyze and display location-based data

Component Overview

Key Features:

  • Shape file rendering (.shp, .dbf, .shx)
  • Multiple layer support with SubShapeFileLayers
  • Data binding with ItemSource
  • Bubble visualization with size and color mapping
  • Legend support with customizable positioning
  • Interactive features: tooltips, selection, zooming, panning
  • Annotations for custom markers
  • Extensive customization options for colors, strokes, and fills

Documentation and Navigation Guide

Getting Started

📄 Read: references/getting-started.md

  • Assembly deployment and NuGet installation
  • Key concepts and map structure
  • Shape file description and requirements
  • Adding shape files as embedded resources
  • Uri property configuration
  • Creating your first map
  • Basic implementation example
Layers and Shape Files

📄 Read: references/layers.md

  • ShapeFileLayer architecture
  • Adding multiple layers (MultiLayer support)
  • SubShapeFileLayer usage
  • LayoutType configuration (Default vs Tile)
  • ItemSource data binding
  • ShapeIDPath and ShapeIDTableField mapping
  • Layer customization
Bubbles

📄 Read: references/bubbles.md

  • Adding bubbles to maps
  • BubbleSetting properties (AutoFillColors, MaxSize, MinSize)
  • ValuePath and ColorValuePath configuration
  • Range color mapping for bubbles
  • StrokeThickness and Fill customization
  • Bubble visualization examples
Legends

📄 Read: references/legends.md

  • Legend visibility (ShowLegend)
  • Legend positioning (Position, PositionX, PositionY)
  • Legend header and title
  • Legend categories (layers vs bubbles)
  • LegendType and LegendIcon
  • Legend shape customization
User Interaction

📄 Read: references/user-interaction.md

  • Tooltip support (ShowToolTip)
  • Single and multiple selection
  • EnableSelection and SelectionMode
  • SelectedShapeColor customization
  • Zooming with ZoomFactor and ZoomLevel
  • Panning and navigation
  • ShapeSelected event handling
Map Points

📄 Read: references/map-points.md

  • Point shape files and geometries
  • Loading point data layers
  • Point vs polygon vs polyline shapes
  • Styling point markers
  • Point data binding
  • Multiple point layers
Annotations

📄 Read: references/annotations.md

  • Adding custom annotations
  • Latitude and Longitude positioning
  • AnnotationDrawing event
  • Custom markers and icons
  • Annotation collections
  • Drawing custom graphics on maps
Customization

📄 Read: references/customization.md

  • Map appearance styling
  • Shape fill and stroke customization
  • Color value paths
  • FillSetting configuration
  • ColorMappings for ranges
  • Theme integration
  • Advanced styling techniques

Quick Start

Step 1: Install NuGet Package
Install-Package Syncfusion.Maps.WinForms
Step 2: Add Shape Files to Project
  1. Add shape files (e.g., world1.shp, world1.dbf, world1.shx) to your project
  2. Select files in Solution Explorer
  3. Set Build Action to Embedded Resource
  4. Set Copy to Output Directory to Copy if newer (optional)
Step 3: Basic Map Implementation
using System;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Maps;

namespace WinFormsMapsExample
{
    public partial class Form1 : Form
    {
        private Maps mapsControl;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // Create Maps control
            mapsControl = new Maps();
            mapsControl.Name = "mapsControl";
            mapsControl.Size = new Size(880, 585);
            mapsControl.Dock = DockStyle.Fill;
            mapsControl.MapBackgroundBrush = new SolidBrush(Color.White);

            // Create and configure shape layer
            ShapeFileLayer shapeLayer = new ShapeFileLayer();
            shapeLayer.Uri = "world1.shp";  // Shape file name
            
            // Add layer to map
            mapsControl.Layers.Add(shapeLayer);
            
            // Add control to form
            this.Controls.Add(mapsControl);
        }
    }
}

Common Patterns

Pattern 1: Data-Bound Map with Statistical Visualization
private void CreateDataBoundMap()
{
    // Prepare data
    MapViewModel model = new MapViewModel();
    
    // Create shape layer
    ShapeFileLayer shapeLayer = new ShapeFileLayer();
    shapeLayer.Uri = "world1.shp";
    
    // Bind data
    shapeLayer.ItemSource = model.Countries;
    shapeLayer.ShapeIDPath = "NAME";            // Property in data model
    shapeLayer.ShapeIDTableField = "NAME";      // Column in .dbf file
    
    // Configure shape display
    shapeLayer.ShapeSetting.ShapeValuePath = "Population";
    shapeLayer.ShapeSetting.ShapeColorValuePath = "Population";
    shapeLayer.ShapeSetting.ShapeDisplayValuePath = "NAME";
    
    // Style settings
    shapeLayer.ShapeSetting.ShapeFill = "#E5E5E5";
    shapeLayer.ShapeSetting.ShapeStroke = "#C1C1C1";
    shapeLayer.ShapeSetting.ShapeStrokeThickness = 1.5;
    
    // Enable features
    shapeLayer.ShowToolTip = true;
    shapeLayer.EnableSelection = true;
    
    mapsControl.Layers.Add(shapeLayer);
}

// Data Model
public class Country
{
    public string NAME { get; set; }
    public double Population { get; set; }
}
Pattern 2: Multi-Layer Map
private void CreateMultiLayerMap()
{
    // Base world layer
    ShapeFileLayer worldLayer = new ShapeFileLayer();
    worldLayer.Uri = "world1.shp";
    worldLayer.ShapeSetting.ShapeFill = "#E5E5E5";
    worldLayer.ShapeSetting.ShapeStroke = "#C1C1C1";
    worldLayer.ShapeSetting.ShapeStrokeThickness = 0.5;

    // Highlighted region 1
    SubShapeFileLayer africaLayer = new SubShapeFileLayer();
    africaLayer.Uri = "africa.shp";
    africaLayer.ShapeSetting.ShapeFill = "#8DCEFF";
    africaLayer.ShapeSetting.ShapeStroke = "#2F8CEA";
    africaLayer.ShapeSetting.ShapeStrokeThickness = 0.5;

    // Highlighted region 2
    SubShapeFileLayer australiaLayer = new SubShapeFileLayer();
    australiaLayer.Uri = "australia.shp";
    australiaLayer.ShapeSetting.ShapeFill = "#FFA07A";
    australiaLayer.ShapeSetting.ShapeStroke = "#FF6347";
    australiaLayer.ShapeSetting.ShapeStrokeThickness = 0.5;

    // Add sublayers to main layer
    worldLayer.SubShapeFileLayers.Add(africaLayer);
    worldLayer.SubShapeFileLayers.Add(australiaLayer);
    
    mapsControl.Layers.Add(worldLayer);
}
Pattern 3: Bubble Map with Color Ranges
private void CreateBubbleMap()
{
    ShapeFileLayer shapeLayer = new ShapeFileLayer();
    shapeLayer.Uri = "world1.shp";
    shapeLayer.ItemSource = GetCountries();
    shapeLayer.ShapeIDPath = "NAME";
    shapeLayer.ShapeIDTableField = "NAME";

    // Configure bubbles
    shapeLayer.BubbleSetting.AutoFillColors = false;
    shapeLayer.BubbleSetting.MaxSize = 70;
    shapeLayer.BubbleSetting.MinSize = 25;
    shapeLayer.BubbleSetting.ValuePath = "Population";
    shapeLayer.BubbleSetting.ColorValuePath = "Population";

    // Define color ranges
    shapeLayer.BubbleSetting.ColorMappings = 
        new System.Collections.ObjectModel.ObservableCollection<ColorMapping>
        {
            new RangeColorMapping 
            { 
                From = 1000000000, 
                To = 2000000000, 
                Color = Color.FromArgb(127, 32, 188, 238) 
            },
            new RangeColorMapping 
            { 
                From = 500000000, 
                To = 1000000000, 
                Color = Color.FromArgb(127, 167, 206, 56) 
            },
            new RangeColorMapping 
            { 
                From = 100000000, 
                To = 500000000, 
                Color = Color.FromArgb(127, 241, 178, 26) 
            },
            new RangeColorMapping 
            { 
                From = 0, 
                To = 100000000, 
                Color = Color.FromArgb(127, 235, 115, 124) 
            }
        };

    mapsControl.Layers.Add(shapeLayer);
}
Pattern 4: Interactive Map with Events
private void CreateInteractiveMap()
{
    ShapeFileLayer shapeLayer = new ShapeFileLayer();
    shapeLayer.Uri = "world1.shp";
    shapeLayer.ItemSource = GetCountries();
    shapeLayer.ShapeIDPath = "Country";
    shapeLayer.ShapeIDTableField = "NAME";
    
    // Enable interaction
    shapeLayer.ShowToolTip = true;
    shapeLayer.EnableSelection = true;
    shapeLayer.SelectionMode = SelectionModes.Multiple;
    
    // Style selected shapes
    shapeLayer.ShapeSetting.SelectedShapeColor = Color.Orange;
    
    // Enable zooming
    mapsControl.ZoomFactor = 1.0f;
    mapsControl.ZoomLevel = 1;
    
    // Subscribe to events
    mapsControl.ShapeSelected += MapsControl_ShapeSelected;
    
    mapsControl.Layers.Add(shapeLayer);
}

private void MapsControl_ShapeSelected(object sender, ShapeSelectedEventArgs e)
{
    if (e.Data != null)
    {
        foreach (Country country in e.Data)
        {
            Console.WriteLine($"Selected: {country.Country}");
        }
    }
}

Key Properties

Maps Control Properties
PropertyTypeDescription
LayersLayerCollectionCollection of ShapeFileLayers
MapBackgroundBrushBrushBackground color of the map
MapItemsShapeMapItemShapesShape of map items (Circle, Diamond, etc.)
ZoomFactorfloatZoom level factor
ZoomLevelintZoom level multiplier
SelectedMapShapesCollectionCurrently selected shapes
ShapeFileLayer Properties
PropertyTypeDescription
UristringPath to shape file (.shp)
ItemSourceobjectData source for binding
ShapeIDPathstringProperty name in data model
ShapeIDTableFieldstringColumn name in .dbf file
ShowToolTipboolEnable/disable tooltips
EnableSelectionboolEnable/disable selection
SelectionModeSelectionModesSingle or Multiple selection
ShowLegendboolShow/hide legend
LayoutTypeLayoutTypeDefault or Tile layout
SubShapeFileLayersCollectionAdditional shape layers
ShapeSetting Properties
PropertyTypeDescription
ShapeFillstring/ColorFill color for shapes
ShapeStrokestring/ColorStroke color for shapes
ShapeStrokeThicknessdoubleBorder thickness
ShapeValuePathstringProperty for value binding
ShapeColorValuePathstringProperty for color mapping
SelectedShapeColorColorColor for selected shapes
BubbleSetting Properties
PropertyTypeDescription
AutoFillColorsboolAuto-generate bubble colors
MaxSizedoubleMaximum bubble size
MinSizedoubleMinimum bubble size
ValuePathstringProperty for bubble size
ColorValuePathstringProperty for bubble color
ColorMappingsCollectionRange-based color mappings

Common Use Cases

Use Case 1: Population Density Map

Display world population by country with color-coded regions based on population ranges.

Use Case 2: Sales Territory Map

Visualize sales data by region with bubbles representing sales volume and colors indicating performance tiers.

Use Case 3: Election Results Map

Show election results by state/province with color-coded winners and tooltips displaying vote counts.

Use Case 4: Regional Analytics Dashboard

Create a dashboard with multiple map layers showing different data dimensions (demographics, economic indicators, etc.).

Use Case 5: Location-Based Application

Build a desktop application that highlights specific locations with custom annotations and allows users to interact with map regions.

Troubleshooting

Issue: Shape files not loading

  • Verify files are added as Embedded Resources
  • Check that Uri matches the shape file name exactly
  • Ensure .dbf file is included with .shp file

Issue: Data not binding to shapes

  • Confirm ShapeIDPath matches property in data model
  • Verify ShapeIDTableField matches column in .dbf file
  • Check that values match exactly (case-sensitive)

Issue: Colors not displaying correctly

  • Set AutoFillColors = false when using ColorMappings
  • Ensure color ranges cover all data values
  • Verify ColorValuePath points to correct property

Issue: Selection not working

  • Set EnableSelection = true
  • Configure SelectionMode (Single or Multiple)
  • Ensure shapes have bound data for selection

Comments

Markdown supported