Click or drag to resize

Map Class

Verizon Connect Logo
Print this page
Learn more about Verizon Connect GeoBase.
Get information about the latest release
Generates Maps.
Inheritance Hierarchy
SystemObject
  Telogis.GeoBaseMap

Namespace:  Telogis.GeoBase
Assembly:  geobase.net (in geobase.net.dll) Version: 4.99.0.0
Syntax
public class Map : IMap, IDisposable, INotifyPropertyChanged

The Map type exposes the following members.

Constructors
  NameDescription
Public methodMap
Create with default size, center and zoom level.
Public methodCode exampleMap(LatLon, Int32, Int32, Double)
Create a map with the given parameters.
Top
Properties
  NameDescription
Public propertyBusy
Indicates if this Map is busy processing an asynchronous map request.
Public propertyCode exampleCenter
Gets or sets the current center point of the map.
Public propertyCode exampleCenterPixelOffset
Used to line up tiles. Sets an offset Point, in pixels, for the center of this Map tile, relative to the Center point of the center Map tile.
Public propertyCode exampleDisplayScale
Gets or sets the scale of map overlay objects (such as labels, shields, direction arrows, and highlights) relative to the underlying map tiles.
Public propertyCode exampleHeading
Gets or sets the heading of the map.
Public propertyCode exampleLayers
Gets or sets an array of map layer names. These layers are rendered in accordance with the LayersRenderMode property.
Public propertyLayersRenderMode
Gets or sets the render mode used to render the map's Layers.
Public propertyCode exampleMapQuality
Gets or sets the quality at which this Map will be rendered.
Public propertyCode exampleMapRepository
Gets or sets the Repository used to render the map.
Public propertyCode exampleMapScale
Gets the scale of the map.
Public propertyCode exampleMaxZoom
Gets the maximum zoom value of this map.
Public propertyMinSizeToBrand
Public propertyCode exampleMinZoom
Gets the minimum zoom value of this map.
Public propertyPaddingSize
Gets or sets the number of additional pixels to load on each side of the map as padding.
Public propertyCode examplePerspective
Gets or sets the perspective of this map. See MapPerspective.
Public propertyPixelSizeMeters
Gets the number of meters each pixel of the map represents.
Public propertyPixelSizeMiles
Gets the number of miles each pixel of the map represents.
Public propertyProjected
Gets or sets whether this map is projected (curved) or not.
Public propertyProjectionCentre
Represents the center of the map projection. By default this value is null and the center is always the center of the visible map area.
Public propertyRenderer
An IMapRenderer that will be called when the map is rendered.
Public propertyRenderLabels
Controls whether labels are rendered on the map.
Public propertySatellite
Gets or sets whether the map is rendered using satellite imagery.
Public propertyCode exampleSatelliteLayerName
The name of the map layer that will be used to provide satellite imagery. If specified then the imagery will be taken from the appropriate WMS layer in the GeoStream's layers.config file. Otherwise, standard GeoBase satellite imagery will be used.
Public propertySize
Gets or sets the map size in pixels.
Public propertyStickyLabels
Gets or sets whether map labels are sticky.
Public propertyStyle
Gets or sets the MapStyle used to draw the map. Set this value to null to use the default map style.
Public propertyStyleName
Gets or sets the name of the style used to draw the map. Set this value to null to use the default map style.
Public propertyTilePerSuperTile
Gets or sets the number of tiles per supertile.
Public propertyTileSize
Gets or sets the size of a tile.
Public propertyTimeStatistics
For internal use only.
Public propertyWarnings
Gets all local Warnings associated with this map.
Public propertyZoom
Gets or sets the zoom height of the map.
Public propertyZoomLevel
This defines the current zoom level. This differs from Zoom, in that ZoomLevel is expressed in terms of the array of Zooms; ZoomLevel is an index into the array.
Public propertyZooms
Defines the set of zoom levels to use.
Top
Methods
  NameDescription
Public methodCancelAsync
Cancels a pending asynchronous map request, if there is one.
Public methodContains
Check whether the map contains the given LatLon.
Public methodDispose
Disposes of this Map.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetBoundingBox
Gets the BoundingBox of the Map.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetMap
Generate an Image of the map using the current Center, Size, and Zoom.
Public methodCode exampleGetMap(Boolean, MapProgress, Boolean)
Generate an Image of the map using the current Center, Size, and Zoom.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodLatLontoXY
Convert from a LatLon to an X,Y location on the map.
Public methodSetProperty
Sets internal map parameters.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodXYtoBoundingBox
Gets the BoundingBox of two pixel locations, x1,y1 and x2,y2
Public methodXYtoLatLon
Convert from map X,Y co-ordinates to a LatLon.
Public methodZoomToBoundingBox(BoundingBox, Int32)
Zooms and centers the map to the given BoundingBox.
Public methodZoomToBoundingBox(BoundingBox, MapBuffer)
Zooms and centers the map to the given BoundingBox.
Top
Events
  NameDescription
Public eventCenterChanged
This event handler is called when the map is panned so that the center point changes.
Public eventPropertyChanged
This event handler is called when a map property is changed.
Public eventSizeChanged
This event handler is called when the size of the map (in pixels) changes.
Public eventZoomChanged
This event handler is called when the zoom level of the map changes.
Top
Remarks

Map classes can also be used to translate from X, Y points to LatLon for panning and zooming operations.

A Map object is not a lightweight object. Operations on the map are swift but the object has a memory footprint proportional to the size of the image to be generated. Therefore, we recommend that you use the pattern below when dealing with maps in a transient fashion.

Also note that the Image returned by GetMap will be disposed when the Map object is disposed. To work around this, copy the Bitmap object as demonstrated in the snippet below.

Related articles: Map Concept.

Examples
C#
Image toKeep;
using (Map map = new Map(center, width, height, zoom)) {
       toKeep = new Bitmap(map.GetMap());    // toKeep is a copy, so will not be disposed.
       ...
       Image transient = map.GetMap(); // This image will be disposed when this block exits.
}
C#
// -- Create a map and adjust the zoom level with a mouse scroll wheel

// Create a 400px x 300px Map object in California with a zoom value of 3
Telogis.GeoBase.Map myMap = new Telogis.GeoBase.Map(new LatLon(33.694165, -117.956236), 400, 300, 3);

// Create a PictureBox to display the map on the Form
PictureBox myPictureBox = new PictureBox();

public Form1() {
    InitializeComponent();

    // Set the PictureBox size
    myPictureBox.Size = new System.Drawing.Size(400, 300);

    // Set the PictureBox image to the Map image
    myPictureBox.Image = myMap.GetMap();

    // Add the PictureBox to the form
    Controls.Add(myPictureBox);

    myPictureBox.Select();

    // Create a mouse wheel event
    myPictureBox.MouseWheel += new MouseEventHandler(_MouseWheel);
}

void _MouseWheel(object sender, MouseEventArgs e) {
    if (e.Delta != 0) {
        double zoomVal = myMap.Zoom;
        if (e.Delta <= 0) {
            // Zoom map out
            myMap.Zoom = zoomVal + 1;
        } else {
            // Zoom map in
            myMap.Zoom = zoomVal - 1;
        }
        // Update the picturebox image
        myPictureBox.Image = myMap.GetMap();
    }
}
See Also