Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/content/60/9972860/html/smf/Sources/Load.php(225) : runtime-created function on line 3

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/content/60/9972860/html/smf/Sources/Load.php(225) : runtime-created function on line 3
Place Finder Details - How Well Populated...
The DAM Forum
Welcome, Guest. Please login or register.
July 15, 2020, 11:02:33 AM

Login with username, password and session length
Search:     Advanced search
28033 Posts in 5147 Topics by 2904 Members
Latest Member: kbroch
* Home Help Search Login Register
+  The DAM Forum
|-+  Software Discussions
| |-+  Media Pro & Expression Media
| | |-+  Place Finder Details - How Well Populated...
« previous next »
Pages: [1] Print
Author Topic: Place Finder Details - How Well Populated...  (Read 3167 times)
ianw
Full Member
***
Posts: 162


View Profile
« on: August 31, 2010, 03:07:45 PM »

Ever wondered how well you've populated the Place Finder details in your catalogues?  Adding a 'country' to an image is easy, helped by the fact that it can be done in bulk.  The 'state' is not too bad, unless you're in a border area.  The 'city' is harder still, usually because remote areas aren't in a city!  Finally the 'location', which is the most difficult of the lot, as many images will have unique values.

The script below won't help you work out or fill in the missing values but it will show you how well these details are annotated in your catalogue, both textually and graphically.  It is an XSL script, so works on both iView and Expression Media and on both PCs and Macs.  You need to save the code below into a new file that should have an extension of '.xsl'.  I've saved mine as PlaceFinder.xsl.  Make sure you copy the whole script and not change anything, otherwise it will most likely fail.

Code:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
 <xsl:template match="/">
  <!-- find total number of images in catalog, and then those with country, state, city and location -->
  <xsl:variable name="c.tot" select="count(CatalogType/MediaItemList/MediaItem)"/>
  <xsl:variable name="c.ctr" select="count(CatalogType/MediaItemList/MediaItem/AnnotationFields/Country)"/>
  <xsl:variable name="c.ste" select="count(CatalogType/MediaItemList/MediaItem/AnnotationFields/State)"/>
  <xsl:variable name="c.cty" select="count(CatalogType/MediaItemList/MediaItem/AnnotationFields/City)"/>
  <xsl:variable name="c.loc" select="count(CatalogType/MediaItemList/MediaItem/AnnotationFields/Location)"/>

  <!-- convert count of images in catalogwith country, state, city and location into percentages -->
  <xsl:variable name="p.ctr" select="format-number($c.ctr div $c.tot * 100,'##0.0')"/>
  <xsl:variable name="p.ste" select="format-number($c.ste div $c.tot * 100,'##0.0')"/>
  <xsl:variable name="p.cty" select="format-number($c.cty div $c.tot * 100,'##0.0')"/>
  <xsl:variable name="p.loc" select="format-number($c.loc div $c.tot * 100,'##0.0')"/>

  <!-- static parts of google charts url -->
  <xsl:variable name="url1" select="'http://chart.apis.google.com/chart?cht=gom&amp;chs=250x150&amp;chd=t:'"/>
  <xsl:variable name="url2" select="'&amp;chxt=y&amp;chls=2|10|10&amp;chtt=Placefinder+Details|'"/>

  <!-- build url for google-o-meter for country, state, city and location -->
  <xsl:variable name="i.ctr" select="concat($url1,$p.ctr,$url2,'Country+(',$c.ctr,'%2f',$c.tot,')')"/>
  <xsl:variable name="i.ste" select="concat($url1,$p.ste,$url2,'State+(',$c.ste,'%2f',$c.tot,')')"/>
  <xsl:variable name="i.cty" select="concat($url1,$p.cty,$url2,'City+(',$c.cty,'%2f',$c.tot,')')"/>
  <xsl:variable name="i.loc" select="concat($url1,$p.loc,$url2,'Location+(',$c.loc,'%2f',$c.tot,')')"/>

  <!-- create html page with the above details in a 'boring' table -->
  <html>
   <head>
    <title>Place Finder Details in Catalog &apos;<xsl:value-of select="CatalogType/Catalog"/>&apos;</title>
   </head>
   <body>
    <table border="1" cellspacing="0" cellpadding="2">
     <thead>
      <th>Detail</th>
      <th>Count</th>
      <th>Percentage</th>
      <th>Google-o-meter</th>
     </thead>
     <tr>
      <td>Country</td>
      <td><xsl:value-of select="$c.ctr"/></td>
      <td><xsl:value-of select="$p.ctr"/>%</td>
      <td><img width="250px" height="150px" src="{$i.ctr}"/></td>
     </tr>
     <tr>
      <td>State</td>
      <td><xsl:value-of select="$c.ste"/></td>
      <td><xsl:value-of select="$p.ste"/>%</td>
      <td><img width="250px" height="150px" src="{$i.ste}"/></td>
     </tr>
     <tr>
      <td>City</td>
      <td><xsl:value-of select="$c.cty"/></td>
      <td><xsl:value-of select="$p.cty"/>%</td>
      <td><img width="250px" height="150px" src="{$i.cty}"/></td>
     </tr>
     <tr>
      <td>Location</td>
      <td><xsl:value-of select="$c.loc"/></td>
      <td><xsl:value-of select="$p.loc"/>%</td>
      <td><img width="250px" height="150px" src="{$i.loc}"/></td>
     </tr>
     <tr>
      <td>Total images</td>
      <td><xsl:value-of select="$c.tot"/></td>
      <td>n/a</td>
      <td>n/a</td>
     </tr>
    </table>
   </body>
  </html>
 </xsl:template>
</xsl:stylesheet>

Now in iView or Expression Media open a catalogue.  From the 'Make' menu select the 'XML Data File...' option.  This will show a new window with several tick-box options and a few buttons.  The only tick box that is required for this script is the second one down for 'Annotations'.  Don't tick the last five options, as they will create new files and directories for you that you don't want.  At the bottom is a '+' button next to a prompt called XSL Transform.  You need to hit the '+' button.  It will then display a 'Choose file' window.  You need to select the XSL file that you've just created from the above code.  Select the file then hit the 'open' button (not sure if the same on a Mac?).  This will close this window.  Now hit the 'Make...' button.  This will prompt you for the file name where the output from this script will be saved.  The output will be a web page.  Due to a feature of iView / Expression Media you need to explicitly state the file extension, so enter something like PlaceFinder.htm.  Now hit the 'Save' button.  Depending on the size of your catalogue and the speed of your computer this may take a few seconds.  It's possible that if you have a very large catalogue that this will fail.  That's not a fault of the script, rather iView / Expression Media and how it handles XML files.

Anyway once done you will have a web page saved on your computer.  If you open this in your browser of choice you will see a table showing you the number of images that have been annotated at country, state, city and location level.  If you are connected to the internet you should also see this graphically, as the above script creates links for calls to the Google Charts facility.  For one of my catalogues I get the following image:



As you can see I've got a lot of annotation to do, although in my defence a lot of these images are from the middle of Australia, where locations are hard to work out, plus these were before I carried a GPS everywhere.  My country details are 99.9% populated - I took a few images from planes over the ocean so really don't have a country for these!  My 'state' details are 90% and the 'city' is 85%.

Now if only Phase One were to improve the XSL capabilities to use something that is more up to date, i.e. v2 XSL instead of v1, then it would be possible to have scripts that created bar charts of lens usage or line charts of focal lengths or exposure times.  You could even show maps with different colours for the countries with images.  It can be done if only Phase One do what I asked of Microsoft several years ago...

Anyway have fun!  Any questions etc post here and I'll try answer.

Ian
Logged
peterkrogh
Administrator
Hero Member
*****
Posts: 5682


View Profile Email
« Reply #1 on: October 13, 2010, 08:06:31 AM »

Ian,
I appreciate the nerdery you went through here.  However, I do something much simpler. 

I run a Find on "Country is empty" and all files with no country show up. I then save these as a catalog set.  At this point, I can look through them to see which groups of images are easiest to annotate. If I have a group from the same location, I will add that location tag to the group of image.  Of course, that adds the country, State, and City tags as well.

If the group of images is from one city, but has a lot of sublocations, I'll just do the city part, and work on the locations at a later date.

You can repeat this with State and City as you work through your images.  Once you've started adding Country, State or City, the List view can be very helpful to pick out images that can get further location tags.

Peter
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!