This task downloads OpenStreetMap® vectors based on the result of a query. OpenStreetMap data is available under Open Database Licence, www.openstreetmap.org/copyright.

Example


This example downloads and displays vectors for buildings, highways, and schools. Copy and paste the code into the IDL Editor and save it as DownloadOSMVectorsTaskExample.pro. Then compile and run the example.

PRO DownloadOSMVectorsTaskExample
COMPILE_OPT IDL2
 
; Start the application
e = ENVI()
 
; Open an input file
File = Filepath('qb_boulder_msi', Subdir=['data'], $
  Root_Dir=e.Root_Dir)
Raster = e.OpenRaster(File)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('DownloadOSMVectors')
 
; Specify inputs
Task.SUB_RECT=[-105.23, 39.98, -105.2, 40.01]
Task.FEATURE_NAMES=['Buildings','Highways and Roads']
Task.CUSTOM_NAMES=['amenity=school']
Task.VECTOR_TYPES=['Polygon','Polyline']
 
; Run the task
Task.Execute
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Raster)
 
FOREACH vector, Task.OUTPUT_VECTOR DO BEGIN
 
  ; Add to Data Manager
  e.Data.Add, vector
 
  ; Display the result
  Layer2 = View.CreateLayer(vector)
 
ENDFOREACH
END

Syntax


Result = ENVITask('DownloadOSMVectors')

Input parameters (Set, Get): CUSTOM_NAMES, FEATURE_NAMES, MERGE_FEATURES, OUTPUT_DIRECTORY, SUB_RECT, VECTOR_TYPES

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


CUSTOM_NAMES (optional)

Specify a string array with custom feature names to query, using the format key=value. For example, the "power" feature (key) contains several sub-features (values) such as "plant", "cable", and "line." See https://wiki.openstreetmap.org/wiki/Map_Features for a list of keys and values. An example is power=tower. Not all sub-features will be available for a given feature, depending on the selected query region.

FEATURE_NAMES (optional)

Specify a string array with the standard feature names to query. The following are valid strings to use:

Aerial Transportation
Airport Infrastructure
Amenities
Barriers
Boundaries
Buildings
Crafts
Emergency
Geological
Highways and Roads
Historic
Land Use
Leisure
Man Made
Military
Natural
Offices
Places
Power
Public Transport
Railways
Routes
Shops
Sports
Tourism
Waterways

MERGE_FEATURES (required)

Set this parameter to true to merge features into a single vector file. For example, if you select three features to query, then all polygon vectors from these features will be merged into one vector file. The same applies for polyline and point vectors. The default value is false.

OUTPUT_DIRECTORY (optional)

Set this parameter to a string indicating the directory in which to save the resulting files. By default, the selected features will be downloaded and saved as shapefiles to the directory indicated in the ENVI Temporary Directory preference.

SUB_RECT (required)

Set this parameter to a four-element array expressing the spatial range for the query. The array is of the form: [minLongitude, minLatitude, maxLongitude, maxLatitude] in geographic coordinates.

VECTOR_TYPES (required)

Specify a string array with the vector types to download. Sometimes a single feature will contain elements of different vector types that must be stored in different files. The default behavior is to download all three vector types.

Polygon
Polyline
Point

Output Parameters


OUTPUT_VECTOR

This parameter contains an array of output ENVIVectors.

Methods


Execute

Parameter

ParameterNames

Properties


DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

Version History


ENVI 5.5. 1

Introduced

See Also


ENVITask, ENVIVector, ReprojectVector Task