This topic describes how to download, open, and display OpenStreetMap® vectors within ENVI. A common use is to overlay the vectors on an image or other dataset.

You can also write a script to download, open, and display OpenStreetMap vectors using the DownloadOSMVectors task.

To get started, open an image and select File > Open World Data > Download OpenStreetMap Vectors from the ENVI menu bar. Or, use the Alt+O keyboard shortcut. The Download OpenStreetMapVectors dialog appears. Follow the steps below to define an area of interest and to select features to download and display.

Specify a Bounding Box


You can optionally specify a bounding box to constrain the download of OpenStreetMap vectors to a specific geographic area. The server that you query has limitations with the amount of data it can send in one query, so you should try to reduce your query both geographically and by selecting only the features you need. If your image covers a large geographic area, opening a large number of vectors may take a longer amount of time.

The Download OpenStreetMap Vectors dialog initially displays the coordinates of the current view extent. Coordinates are expressed in Geographic latitude and longitude; for example:

If the displayed image does not have a spatial reference, then these fields are empty. You must specify a bounding box; use one of the following options to do this:

  • Enter map coordinates in the fields provided.
  • Click the From Dataset button to use the spatial extent of another dataset.
  • Click the From Current View button to use the spatial extent of the current view.
  • Click the Draw Bounding Box button , then click and drag to draw a box around a specific area. The map coordinate fields update with the extent of the bounding box.
  • To clear the bounding box values, click the Reset button .

Select Features


The Feature Names list shows the primary OpenStreetMap features that are available. See https://wiki.openstreetmap.org/wiki/Map_Features for a list of features.

Select none, one, or multiple primary features:

  • Use the Ctrl or Shift keys on your keyboard to select multiple features.
  • Click the Select All icon to select all features.
  • Click the Clear All icon to clear the selection of features.

Tip: When you click OK in the Download OpenStreetMap Vectors dialog, and reopen it, the dialog will remember the features that you last selected.

Click the Add Custom OSM Features button to query custom feature names from OpenStreetMap. This is an optional step. In the Add Custom OSM Features dialog, select one or more sub-features and click OK. You can also enter a search term in the Search field instead of scrolling through the features. Each sub-feature belongs to a primary feature. For example, the "power" feature (key) contains several sub-features (values) such as "plant", "cable", and "line."

The Custom Names field lists the resulting query, using specific keys and values from the OpenStreetMap database. See https://wiki.openstreetmap.org/wiki/Map_Features for a list of keys and values. An example is aeroway=helipad. Not all sub-features will be available for a given feature, depending on the selected query region.

If you already know a key/value pair, you can enter it directly in the Custom Names field without having to use the Add Custom OSM Features dialog. The Attribute Viewer also lists the keys and values for each feature; see Display Vectors and Attributes below.

Click the Reset button to clear the Custom Names field.

Specify Vector Types


Vectors downloaded from OpenStreetMap are polygons, polylines, or points. Each vector type will produce a separate shapefile on disk and will be displayed in a separate layer. You can use the Vector Types selection list to limit your result to specific vector types. The default is to download all types of vectors.

For example, if you select five features and choose Polygon, Point, and Line, then up to 15 vector layers will be created, depending on what vector types are available for that feature.

If you set the Merge Features option to Yes, and you select multiple features, then:

  • All polygon features will be merged into one layer .
  • All polyline features will be merged into one layer.
  • All point features will be merged into one layer.

For example, if you select three features, then any polygon vectors from these features will be merged into one vector layer. The same applies for polyline and point layers.

Specify an Output Directory


By default, the selected features will be downloaded and saved as shapefiles to the directory indicated in the ENVI Temporary Directory preference. Click the Browse button next to Output Directory to specify a different directory for storing the shapefiles.

Display Vectors and Attributes


Click OK in the Download OpenStreetMap Vectors dialog to download and display the selected features. The features are available as shapefiles, and you can use ENVI's vector editing tools to manipulate them further, if needed.

Tip: While OpenStreetMap vectors are geographically accurate, they may not overlay correctly with images that do not have a standard map projection (for example, Geographic Lat/Lon or UTM).

To change the color and symbology for a feature, double-click its name in the Layer Manager and select Properties. Use the Vector Properties dialog to change the color and properties of the point, polyline, or polygon layer. You can select secondary features from the Attribute drop-down list and use a color table to assign different colors to each feature. For example, suppose that you download the "Building" feature. In the Properties dialog for that feature, select the "building" feature from the Attribute drop-down list. Then select a color table with distinct colors. Each secondary feature now has a different color:

To view the attributes for a feature, right-click on its name in the Layer Manager and select View Attributes. The Attribute Viewer lists the vector records for that layer. The "osm_type" attribute corresponds to the primary feature name. The following figure shows an example:

Acknowledgements


All data downloaded from this tool is © OpenStreetMap. Data available under Open Database License, https://www.openstreetmap.org/copyright.

The OverPass API server is used to query OpenStreetMap data. The URL for this server is specified in the OpenStreetMap Overpass API URL preference setting, in the Remote Connectivity category. The default value is overpass-api.de/api/interpreter.

See Also


Vector Layers, Attribute Viewer, Download Web Data