Diagram for .NET / User's Guide / Maps / Maps - Getting Started

In This Topic
    Maps - Getting Started
    In This Topic

    Nevron Diagram for .NET provides support for importing and working with geographical data in the popular ESRI shapefile format.

     Architecture

    The following diagram illustrates the process that transforms geographical data into Nevron Diagram shapes:

    1. The process begins with specifying the source of the geographical data (e.g. an ESRI shapefile) by using the AddLayer method of the map importer. You can add one or more shapefiles to the map and configure them individually. The shapefile can come from a file on disk, a stream or a resource embedded in your application. For more information check out the Map Layers topic.
    2. The geographical data is then read by the map importer and the import of the shapes is ready to begin.
    3. First, a map projection transforms the 3D geographical coordinates to 2D coordinates by projecting the 3D geographical data to the plane.
    4. After the coordinates of all points are calculated by the projection, Nevron diagram shapes are created.
    5. A fill rule can be applied to the created shapes in order to color them, for example to create a political or a choropleth map.
    6. A shape created listener can be attached to the map importer in case you want to customize the imported shapes even further (for example to set tooltips).
     Code Example

    The following piece of code demonstrates how to create and configure a map importer and how to use it to import some geographical data in a Nevron diagram:

    Importing geographical data
    Copy Code
    // Create a map importer
    NEsriMapImporter mapImporter = new NEsriMapImporter();
    mapImporter.MapBounds = NMapBounds.World;
    
    // Add an ESRI shapefile
    NEsriShapefile countries = new NEsriShapefile(@"C:\Maps\countries.shp");
    countries.NameColumn = "CNTRY_NAME";
    countries.TextColumn = "CNTRY_NAME";
    countries.FillRule = new NMapFillRuleValue("COLOR_MAP", Colors);
    mapImporter.AddLayer(countries);
    
    // Read the map data
    mapImporter.Read();
    
    // Import the map to the drawing document
    mapImporter.Import(document, document.Bounds);