ReprojectVector Task

This task reprojects the records in a vector from one coordinate system to another.

Example

This example reprojects a shapefile of U.S. counties to the same coordinate system as a raster so that they can be displayed in the same view.

; Start the application

e = ENVI()

 

; Open a shapefile of counties

VectorFile = Filepath('counties.shp', $

  Subdir=['classic', 'data', 'vector'], $

  Root_Dir=e.Root_Dir)

Vector = e.OpenVector(VectorFile)

 

; Open an input raster

RasterFile = Filepath('bhtmref.img', $

  Subdir=['classic', 'data'], $

  Root_Dir=e.Root_Dir)

Raster = e.OpenRaster(RasterFile)

 

; Get the coordinate system of the raster

CoordSys = ENVICoordSys( $

  COORD_SYS_CODE=Raster.SPATIALREF.COORD_SYS_CODE)

 

; Get the task from the catalog of ENVITasks

Task = ENVITask('ReprojectVector')

 

; Define inputs

Task.INPUT_VECTOR = Vector

Task.COORD_SYS = CoordSys

 

; Run the task

Task.Execute

 

; Display the reprojected vector over the raster

View = e.GetView()

RasterLayer = View.CreateLayer(Raster)

VectorLayer = View.CreateLayer(Task.OUTPUT_VECTOR)

View.Zoom, 0.14

Syntax

Result = ENVITask('ReprojectVector')

Input parameters (Set, Get): INPUT_VECTOR, COORD_SYS, OUTPUT_VECTOR_URI

Output parameters (Get only): OUTPUT_VECTOR

Parameters marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Parameters marked as "Get" are those whose values you can retrieve but not set.

Input Parameters

INPUT_VECTOR (required)

Specify the input vector to be reprojected.

COORD_SYS (required)

Specify the output coordinate system.

OUTPUT_VECTOR_URI (optional)

Specify a string with the fully qualified path and filename for OUTPUT_VECTOR.

Output Parameters

OUTPUT_VECTOR

This is a reference to the output vector.

Methods

Execute

Parameter

ParameterNames

Properties

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History

ENVI 5.5. 3

Introduced

See Also

ENVITask, ENVICoordSys, ENVIVector, ReprojectRaster Task