how to view a feature with a photo attached to it from arcgis to google earth

2134
4
07-21-2016 01:11 PM
HashemAbdo1
New Contributor III

I'm trying to add a feature (File Geodatabase) with an attached photo (raster file) from ArcMap to google earth. When i use the tool Layer to KML i get the feature but when i open the google earth file i can't view  the photo attached to Google Earth. I attached a picture below

Reply
0 Kudos
4 Replies
JosephSegretto__GISP
New Contributor III

Geodatabase attachments are not exported to the KMZ.  In order to view the image, you'd need to save the photo to a location that is web enabled and add they hyperlink of the image to a field in your feature class.  Then you would need to modify the html popup xsl template in the layer properties to include a test for field values.

<xsl:when test="FieldValue[starts-with(., 'http://yourimageserver.com/image_directory/')]">

     <a target="_blank">

       <xsl:attribute name="href"><xsl:value-of select="FieldValue"/>

       </xsl:attribute>

       <img>

            <xsl:attribute name="src">

                 <xsl:value-of select="FieldValue"/>

            </xsl:attribute>

            <xsl:attribute name="width">

                 <xsl:value-of select="250"/>

            </xsl:attribute>

       </img>

     </a> 

</xsl:when>

The photo will show up in the html popup in ArcMap in the table provided the url base included in the XML test matches the beginning of the URLs for the photos.  When exported to KMZ, the html popup should look the same in google earth.  It will also hyperlink to the photo for full screen viewing. 

HashemAbdo1
New Contributor III

I never tried this before and i'm a little bit confused could you explain what you mean when you say :

1)"you'd need to save the photo to a location that is web enabled and add they hyperlink of the image to a field in your feature class"

Where do i put that code ?

2) Then you would need to modify the html popup xsl template in the layer properties to include a test for field values.

Thank you in advance

Reply
0 Kudos
JosephSegretto__GISP
New Contributor III
  1. If you have access to a web server, you can place the photos on a webserver and use them there.  If not, you can upload your images to a site like Flickr.  As long as you grant public viewing permissions, the images will appear in the html popup.
  2. There are sample xsl templates installed with ArcGIS Desktop at C:\Program Files (x86)\ArcGIS\Desktop10.x\Styles\HTMLPopup.  You can copy and paste the code from the example .xsl into the HTML Popup tab of the layer properties for your layer.  In the EmbeddVideo.xsl, you will see segments of code that start with <xsl: when.  You can modify one of those sections to match the snippet above, or add the snippet from above as another test.
HashemAbdo1
New Contributor III

Thanks alot

Reply
0 Kudos