TOP

Geotagging Data Points onto Maps

Introduction

This article explains how to integrate road inspection points/images with the GIS map-view interface. The point-map snapping is a critical step, in order to match inspection records with street segments; whereas the image-map integration is optional. The following instructions are customized for Esri ArcMap (10.x version) combining with Cartegraph asset management software.


1. Set up the map

2. Clean and import the score data

3. Import and view the images

 Below is a list of data required and system prerequisites:

score points file with GPS information (txt file)

python 2.7 with opencv library

city street centerline map (shapefile file)

enough geodatabase memory




Set up the Map


You need to set up geodatabases and coordinate systems in ArcMap before importing the scores. All 5 steps are done in ArcMap (version 10.0+). You should finish with a basemap in the main work frame, and a geodatabase in the catalog panel on the right.

Step 1. ) Create a file geodatabase to store the data. 

Open ArcMap 10.x. Go to the Catelog panel on the right. (Go to Menu > Windows > Catelog, to turn it on, if you cannot see it). Choose an appropriate project folder for your geodatabase; and click on it to connect. 
  If you cannot find the folder you want in the directory, connect to the folder by clicking on .
  Right click on the home folder, go to New > File Geodatabase. Single click on it TWICE to rename the geodatabase.

Note: Do not use Personal Geodatabase, which is limited to 2BG size. 

Step 2. ) Set coordinate system. 

Set the coordinate system of the workplace in ArcMap. This ensures that any data layer we add later will be projected in a consistant coordinate system. If you are not sure which coordinate system to use, it is recommended to set the coordinate system same as your GPS devices'. Most GPS devices use 'WGS 1984' as their coordinate system.
  In Menu bar, go to View > Data frame properties. Under 'Coordinate System' tab, expand 'Geographic Coordinate Systems' > 'World' > 'WGS 1984'. Click OK. Now you have set the coordinate system.

Step 3. ) Import base map. 

In ArcMap, on the Tool bar, Click to Add Data. Import the Street Centerline map. You can find the Street Centerline map in the data inventory of your city or county. A GIS-ready map is usually in shapefile format.

Step 4. ) (Optional) Import water shapefile.
We recommend to use TIGER/Line shapefiles, destributed by US Census Bureau. Go to US census website to download TIGER/Line shapefile. http://www.census.gov/geo/maps-data/data/tiger-line.html
  Under the tab ‘2013’ (or whichever is latest), click download from the web interface. In select a layer type section, scroll down to Feature > water, submit. Under Area Hydrography, scroll down to select <State>, submit. Select <County>, and download the data.
  Unzip the package after downloaded.
  Edit the water polygons based on City Boundary to clip off the water areas outside the city. (See Arcgis help for clip tool)

Step 5. ) (Optional) Lable the streets by name. 

In Arcmap, double-click on the streetcenterline name in Tables Of Contents (the panel on the left) to open the properties. Go to 'Labels' tab. Check the box to 'label features in this layer'. Click on scale Range… Check the second option. Select 1:10,000 for ‘Out beyond’, in order to hide the labels when zoomed out beyond 1:10,000 scale. Click OK. Click OK.




Import the score points


Take the score points (text file) generated by the previous algorithms. Format the data into a csv file ready to be imported into the map. In this example, Excel is used. Many other tools can do the same.

Step 1. ) Open the text file in MS Excel.

In Excel, go to File (or Microsoft Office Button)> Open. Choose the txt file. Change the separator character by checking the box for space. Follow the steps and open the file. At this point, check whether there's any information missing. It should have columns of:

 

Ø  Image file name (It looks like: 20121003_160151_470_514.jpg)

Ø  Longitude

Ø  Latitude

Ø  Score

 You can delete any other columns to make the data look clean. You can rescale the scores (for example, multiply 100 to adjust the scores into a scale of 1 to 100). Keep the first row as headers. Remember the column names for the longitude/latitude fields. (You can name them as lon and lat respectively, or x/y. These column names are refered later when importing into ArcMap.) After finishing editing, go to File (or Microsoft Office Button) > Save as. Be careful to choose the type as CSV (Comma delimited).



Step 2. ) Import the file into ArcMap.

  In the Tool bar, go to File > Add Data > Add XY Data... 
  Select your csv file.
  Identify the columns that hold the x- and y-coordinates, respectively.
  Click OK.

  You should see the csv file listed as a point layer in the 'Table Of Contents' panel. You should also see the gps points created on top of the street centerline map. You cannot edit this layer until after Step 3. 

Step 3. ) Export the table as a feature class.

  In the table of contents, right-click on table layer (which you imported in Step 2).  Go to data > export data… Choose 'File and Personal Geodatabase feature classes' in 'Save as type'. Browse to the geodatabase you have created when setting up the map.

Click Yes to add the exported data to the map as a layer.

Delete the previous layer (the imported csv Events) from Table Of Contents. Right click and Remove. 

Now you have successfully saved your score data as a feature class in the geodatabase you assigned.

Step 4. ) Snap the points to the map.

  Go to ArcToolBox > Analysis Tools > Overlay > Spatial Join. For the Target Features, select the score layer. For the Join Features, select the street segment layer. The Output Feature Class should be named and browsed to the right location (i.e. the geodatabase you have created earlier). The Join Operation should be Join_One_To_One. Select the fields we would like to delete, and click the button on the right. For the Match Option, select WITHIN_A_DISTANCE. Set Search Radius as 30, unit as Feet. Click OK. Wait for it to process.


  A new layer would be created, as you can see in Table Of Contents (Most times the first one in the list). Right click on the layer, go to Attribute Table to check the result. It should have scores joined with street information.



Import and View the Image Data


 

This step allows you to verify scores intuitively by clicking the score points in ArcMap. By clicking on the points, you can see both the score and the image, as well as the street segment information.

 

Step 1. ) Run the program here to generate a folder containing all the images, as well as a csv file listing names and other information of all the image.


Step 2. ) Geotag the images
In ArcMap, Open ArcToolbox, go to Data Management > Photos > GeoTagged Photos to Points. For the input folder, browse to the folder you generated in step 1. Select a path (to your file geodatabase) and name the output feature class. Uncheck the first box. Click OK. This process may take over twenty minutes.

 

Step 3. ) Join score layer to Photos
In ArcMap, left penal, right click on Photo layer > Joins and Relates > Join… Select join attribute from a table. Select name as the field of the photo layer, select the score layer, select the tag field of the score layer. Choose keep all records option. Click OK.