Okay I’m probably blind but I’ve been trying to find a way of placing already geotagged images in ArcGIS in batches.  My hope was to either add natively my geotagged image into ArcGIS or to export these from say Google Earth to ArcGIS.

Well I found a way but I’m not sure its the quickest or easiest so perhaps if I post this here someone will see it and make suggestions.  Or more than likely point me to a free script/addin/extension that has done this from day one!.

Okay pleased be patient, this is more of a principles rather than detailed description and assumes knowledge of the software involved.

Required: Google Picasa and Earth, ArcGIS Explorer (plus Geotag Add In), ArcGIS (in my case ArcMAP) and MS Excel (I’m using 2007)

  1. Use Picasa and Google Earth to Geotag your photos, you can get help here.
  2. Install Geotag Add in for ArcExplorer find it here.
  3. Use the Geotag Add In, to add your now geotagged photos.
  4. Save your geotagged map in ArcExplorer as a *.nmf file
  5. Open this nmf file in Excel as a XML file, I suggest you save this immediatley as a CSV once completed (as Excel seemed to be buggy with me).
  6. In Excel remove all the columns and strip the data (if you had extra layers) until you are left with the XY values and the html code (content) which contains the location of your geotagged image.
  7. The tricky bit here is turning the html code in the content column into something useable I used the following 3 stage formula proces to get something that the HTML popup in ArcGIS would like:
  8. =MID(C2, FIND(“=”,C2)+10, 77)
  9. =SUBSTITUTE(H2,CHAR(34),” “)
  10. =CONCATENATE(‘img tag’!$B$2,I2,’img tag’!$D$2)
  11. Basically the first one takes file location with some extra characters from the Content column, then the second one replaces removes a “, these two create a clean location of the image (c:\images\photo1.jpg)
  12. The third one takes two cells (placed on a seperate tab) that I have put some HTML code into:
    <img border =1 src=”
    and
    ” width=”307.2″ height =”230.4″ />
    wraps it up so you get this: <img border =1 src=”c:\images\photo1.jpg” width=”307.2″ height =”230.4″ /> .
  13. Okay once this is done and your table looks something like this
     
  14. Open ArcGIS and Add your XY Data, you should have dots where your photos were geolocated!
  15. Next export your added data as a shapefile or geodatabase.
  16. You should then using ArcToolbox in ArcCatalog ensure that this new file has a coordinate system of WGS 1984 (just check in ArcExplorer what system is used, in fact back in Excel you might have seen that column).
  17. Now back in ArcGIS add your new layer, voila!  Right click and select properties on your new layer and under the field tab switch on and off the fields you want display in your html popup.
  18. Now select the HTML popup tab, check “Show content for this layer using the HTML Popup tool”, and click Verify (it should give you an example of what it will look like!  
  19. Now you can stop there, but if you want to do some formatting of this HTML popup you can check  “As formatted page based on an XSL template” and copy in the popup.xsl code (open in notepad) located here :”driveletter:\Program Files (x86)\ArcGIS\Styles\HTMLPopup”.  I know very little about this file but I know its okay to edit the HTML code highlighted in orange:

<?xml version=”1.0″ encoding=”UTF-8″?>
<xsl:stylesheet version=”1.0″ xmlns:xsl=”http://www.w3.org/1999/XSL/Transform” xmlns:fo=”http://www.w3.org/1999/XSL/Format”>
    <xsl:template match=”/”>
        <html>
        <body leftmargin=”0″ topmargin=”0″ bottommargin=”0″ rightmargin=”0″>
          <font face=”Calibri”>
            <xsl:variable name=”nameCol” select=”FieldsDoc/Fields/Field/FieldName”/>
            <table border=”5″ width=”300″ cellpadding=”5″ cellspacing=”0″>
                <tr bgcolor=”#9CBCE2″>
                    <xsl:if test=”$nameCol”>
                        <th width=”50%” align=”left”>Name</th>
                    </xsl:if>
                    <th width=”50%” align=”left”>Information</th>
                </tr>
                <xsl:for-each select=”FieldsDoc/Fields/Field”>
                <tr>
                    <xsl:if test=”(position() +1) mod 2″><xsl:attribute name=”bgcolor”>#D4E4F3</xsl:attribute></xsl:if>
                    <xsl:if test=”$nameCol”>
                    <td><xsl:value-of select=”FieldName”/></td>
                    </xsl:if>
                    <td>
                        <xsl:choose>
                            <xsl:when test=”FieldValue[starts-with(., ‘www.’)]”>
                                <a target=”_blank”><xsl:attribute name=”href”>http://<xsl:value-of select=”FieldValue”/>
                                </xsl:attribute><xsl:value-of select=”FieldValue”/>
                                </a>
                            </xsl:when>
                            <xsl:when test=”FieldValue[starts-with(., ‘http:’)]”>
                                <a target=”_blank”><xsl:attribute name=”href”><xsl:value-of select=”FieldValue”/>
                                </xsl:attribute><xsl:value-of select=”FieldValue”/>
                                </a>
                            </xsl:when>
                            <xsl:when test=”FieldValue[starts-with(., ‘https:’)]”>
                                <a target=”_blank”><xsl:attribute name=”href”><xsl:value-of select=”FieldValue”/>
                                </xsl:attribute><xsl:value-of select=”FieldValue”/>
                                </a>
                            </xsl:when>
                            <xsl:when test=”FieldValue[starts-with(., ‘\\’)]”>
                                <a target=”_blank”><xsl:attribute name=”href”><xsl:value-of select=”FieldValue”/>
                                </xsl:attribute><xsl:value-of select=”FieldValue”/>
                                </a>
                            </xsl:when>
                            <xsl:when test=”FieldValue[starts-with(., ‘<img ‘)]”>
                                <xsl:value-of select=”FieldValue” disable-output-escaping=”yes” />
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select=”FieldValue”/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </td>
                </tr>
                </xsl:for-each>
            </table>
            </font>
        </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

Well that’s it apologies for such a long post I hope it helps someone, and at the very least it will help me when I am look at doing something similar again!

NB: thanks to the following blogposts/threads Blogger Tutor, nmf to shp (on ESRI support)

1 COMMENT

  1. Very cool! I’ve put together a project for creating KMZ files with CDATA popups sourced from directories containing geo-tagged JPEGS. I’ve been thinking about adding in the HTML popup functionality for ArcMap. Right now it just generates a .tab file that can be loaded as an XY data table. I’d be curious to know if there is anything else you’d suggest I do with this project to make it even more useful for ArcGIS users. The full project description is here:

    http://www.kickstarter.com/projects/phs/geophoto-tracker

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.