ZoomAndCenterMapView Example - C# - Latest

Spectrum Spatial Guide

Product type
Software
Portfolio
Locate
Product family
Spectrumâ„¢ software
Product
Spectrumâ„¢ software > Spatial > Spectrum Spatial
Version
Latest
ft:locale
en-US
Product name
Spectrum Technology Platform
ft:title
Spectrum Spatial Guide
Copyright
2025
First publish date
2007
ft:lastEdition
2025-03-07
ft:lastPublication
2025-03-07T10:28:48.112000

The following shows a C# example that returns a ZoomAndCenterMapView object.


public static ZoomAndCenterMapView createZoomAndCenterMapView()
{
    ZoomAndCenterMapView zc = new ZoomAndCenterMapView();
    zc.Height = 600;
    zc.Width = 800;
    zc.unit = PaperUnit.Pixel;

    //sets the map resolution. If not specified, the default one is set to 96 DPI
    //zc.mapResolution = 200;

    // set up the zoom level of the map
    // it represents the full width of the map
    Distance zl = new Distance();
    zl.Value = 2000.0;
    zl.uom = DistanceUnit.Kilometer;
    zc.ZoomLevel = zl;

    // set the map centre of the map view
    Point centre = BuildGeometry.buildPoint();

    zc.MapCenter = centre;

    return zc;
}