Adding Data to a Map


AspMap supports a variety of vector and raster data formats.

 


To add a file-based layer:

 

Add a Shapefile vector layer

 

Map1.AddLayer("c:\mapdata\states.shp")

 

Add a TAB vector layer

 

Map1.AddLayer("c:\mapdata\states.tab")

 

Add a TIFF/GeoTIFF image layer

 

Map1.AddLayer("c:\mapdata\earth.tif")

 

Add a ECW image layer

 

Map1.AddLayer("c:\mapdata\earth.ecw")

 

Add a GeoJPEG image layer

 

Map1.AddLayer("c:\mapdata\earth.jpg")

 

Add a JPEG 2000 image layer

 

Map1.AddLayer("c:\mapdata\earth.jp2")

 

To add a spatial database layer:

 

See the Spatial Databases chapter.

 

To add a dynamic layer:

 

Use the MapShapes property of the Map control (the shapes will be persisted between postbacks)

Dim lineShape As Shape = new Shape(ShapeType.Line)

Dim linePoints As Points = new Points()
linePoints.Add(-117.90, 33.20)
linePoints.Add(-117.10, 33.80)
linePoints.Add(-116.60, 34.10)
lineShape.Add(linePoints)

Map1.MapShapes.Add(lineShape, "Road")

 

Add a DynamicPoints object

Dim points As DynamicPoints = new DynamicPoints() 
points.Type = LayerType.Point ' add as a point layer 
points.Add(-117.90, 33.88, "Los Angeles") 

Map1.AddLayer(points) 

Add a DynamicLayer object

Dim layer As DynamicLayer = new DynamicLayer()
layer.LayerType = LayerType.Line ' add as a line layer
Dim lineShape As Shape = new Shape(ShapeType.Line)

Dim linePoints As Points = new Points()
linePoints.Add(-117.90, 33.20)
linePoints.Add(-117.10, 33.80)
linePoints.Add(-116.60, 34.10)
lineShape.Add(linePoints)
layer.Add(lineShape, "Road")

Map1.AddLayer(layer)

© 2018 VDS Technologies
Converted from CHM to HTML with chm2web Standard 2.85 (unicode)