How can I manually extract latitude and longitude locations from my vector file?
Help Article Update 2
Anonym
If you have a vector file and would like to extract latitude and longitude for specific locations within this vector, it can be a bit tricky to figure out the best way to do this in ENVI. In ENVI, you can select Ground Control Points (GCPs) from vectors and their associated imagery to perform Image to Map Registration. However, users sometimes do not have any associated raster imagery to accompany the vector files and still need to extract the latitude and longitude information from certain locations.
This Help Article outlines a method to manually extract latitude and longitude for locations within a vector file in ENVI and how to export the locations as an ASCII file.
In this method, you can manually click on a vector window to extract the vector locations of interest and then save their latitude and longitude values. You can then open the vector file in a program such as MS Excel to remove the columns of data that do not interest you.
To manually extract latitude and longitude locations from a vector file, please follow these steps:
1. Open any image file (this is a workaround that is required to activate a window that you will need in later steps). Only the main image window needs to be open.
2. In ENVI, Select File > Open Vector File > Shapefile or ENVI vector file.
3. From the Available Vectors List dialog, click to select a vector (the one selected in step 2 here) and then click Load Selected.
4. From the main ENVI menu, select Map > Registration > Select GCPs: Image to Map. You may need to enter the appropriate map information for the vector file.
5. From the Load Vectors dialog, select the option to load in a new vector window and click OK. The selected vector displays in the Vector Window.
6. Click using the left mouse button to locate the x,y, you wish to extract.
7. Right-click in the Vector Window and select Export Map Location from the shortcut menu. The coordinates appear in the GCP dialog box.
8. On the Ground Control Points Selection dialog, click Add Point to enter the selected point into the registration.
9. Repeat steps 6-8 until all the desired locations have been entered.
To save the locations out to an ASCII file, please follow these steps:
1) In the Ground Control Points Selection dialog, select File->Save GCPs with lat/lon
This process will give you a file that looks like this:
; ENVI Image to Map GCP File
; projection info = {Geographic Lat/Lon, WGS-84, units=Degrees}
; warp file: C:\RSI\IDL61\products\envi41\data\bhtmref.img
; Map (x,y), Image (x,y)
;
-106.86543876 40.99845739 201.000000 200.000000
-160.78423718 64.71570256 201.000000 200.000000
-85.29382498 33.42587571 201.000000 200.000000
-85.29382498 33.42587571 201.000000 200.000000
The first two columns are the lon/lat values for all the selected locations from the vector window. You can then open the vector file in a program such as MS Excel to remove the columns of data that do not interest you.