Redraws the map with new spatial reference properties.
Syntax
Parameters
- newSpatialReference
- Spatial reference to use when drawing the map.
Return Value
CartoImage object, whose Url property contains the URL location of the map
image.
Example
The following example draws the map with a new spatial reference set to the
Robinson projection. It sets the map extent using a geographic coordinate system
(4326). It assumes a MapView exists named mapView, and an image control in the page
named imgMap.
C# | Copy Code |
---|
// Set the map extent to the area desired Envelope newExtent = new Envelope(-170, -70, 170, 70); // Define the spatial reference of the extent // (required if the envelope has a difference reference than the // map's current reference, or the map's SpatialReference is null) newExtent.SpatialReference = new SpatialReference(4326); mapView.Extent = newExtent; // Define a new spatial reference for the map (Robinson is 54030) SpatialReference spatialRef = new SpatialReference(); // Draw the map with the new spatial reference CartoImage resultImage = mapView.Draw(54030); imgMap.ImageUrl = resultImage.Url; |
Visual Basic | Copy Code |
---|
Dim newExtent As New Envelope(-170, -70, 170, 70)
newExtent.SpatialReference = New SpatialReference(4326)
mapView.Extent = newExtent
SpatialReference spatialRef = New SpatialReference()
CartoImage resultImage = mapView.Draw(54030)
imgMap.ImageUrl = resultImage.Url
|
Remarks
See Also