{"id":1782,"date":"2011-05-26T18:10:36","date_gmt":"2011-05-26T09:10:36","guid":{"rendered":"https:\/\/regex.info\/blog\/lightroom-goodies\/gps\/personal"},"modified":"2011-05-26T18:17:45","modified_gmt":"2011-05-26T09:17:45","slug":"personal","status":"publish","type":"page","link":"https:\/\/regex.info\/blog\/lightroom-goodies\/gps\/personal","title":{"rendered":"Enhanced Reverse Geocoding With a Custom Map of Locations of Personal Interest"},"content":{"rendered":"\n\n<div class='ic'><img loading=\"lazy\" decoding=\"async\" src=\"\/i\/s\/KyotoStationPolygon.jpg\" width=\"591\" height=\"415\"\nid=\"iKyotoStationPolygon\"\/>\n<br\/><span class='caption'>The Area In Green is &#8220;Kyoto Station&#8221;<\/span>\n<br\/>red is the Hotel Granvia Kyoto, blue is Kyoto Tower\n<\/div>\n\n\n<div style='border: solid 4px red; padding: 30px; margin:30px'>Note: plugin version 20131022.209 (<span class='nobr'>October 22,<\/span> 2013) contains <span class='nobr'>a major<\/span>\nupdate to the personal-location support, but this page does not yet reflect the update.<\/div>\n\n<p>I've recently added a feature to <a\nhref='\/blog\/lightroom-goodies\/gps'>my Geoencoding-Support\nplugin for Adobe Lightroom<\/a> to aid in reverse geocoding (that is, to aid\nin filling in the &#8220;location&#8221;, &#8220;city&#8221;, &#8220;state&#8221;, and &#8220;country&#8221; metadata\nfields, based upon the latitude and longitude associated with the image). <span class='nobr'>In Google<\/span> Earth, you can mark areas with arbitrarily-complex polygons, and\nassign names to them, and save the collection in <span class='nobr'>a KML<\/span> file as your\npersonal location-to-name mapping, and the plugin will use this in\npreference to the generic, often unuseful reverse-geocoding data from\nGoogle Maps.<\/p>\n\n<style type=\"text\/css\">\np.h { font-size: 150%; font-weight: bold }\nspan.ll { font-size: 85% }\ndiv.quote { margin-left:3em }\nol#steps > li { margin-bottom: 40px }\nul#editnotes > li { margin-bottom: 10px }\nul#plans > li { margin-bottom: 30px }\n<\/style>\n<p class='h'>Background<\/p>\n\n<p>&#8220;<a href='http:\/\/en.wikipedia.org\/wiki\/Geocoding'>Geoencoding<\/a>&#8221; is the assignment of appropriate\nlatitude\/longitude coordinates to <span class='nobr'>a photo<\/span> to indicate where on the globe\nthe photo was taken. Some cameras with internal GPS receivers add this\nautomatically, but you can also geoencode photos after the fact in various\nways. <span class='nobr'>My plugin<\/span> allows you to sync to <span class='nobr'>a tracklog<\/span> (created with <span class='nobr'>a smartphone<\/span>\nor GPS unit that you carried while out with the camera), or to pinpoint\nlocations in Google Earth or common online mapping sites, and apply those\nlocations to photos. Other methods include apps with drag-n-drop\nphoto-mapping features.<\/p>\n\n<p>I geoencode almost all the photos <span class='nobr'>I take,<\/span> which allows me to include\n&#8220;map&#8221; and &#8220;nearby photos&#8221; links under most photos on <a\nhref='\/blog\/'>my blog<\/a>.<\/p>\n\n<p>&#8220;<a href='http:\/\/en.wikipedia.org\/wiki\/Reverse_geocoding'>Reverse Geocoding<\/a>&#8221; takes the latitude\/longitude coordinates\n(however they originally got associated with the photo), and tries to turn them\ninto meaningful human-readable &#8220;city&#8221;, &#8220;state&#8221;, &#8220;country&#8221;, and &#8220;location&#8221;\nfields. Having these fields available are not only descriptive, but they\ncan help facilitate image search within Lightroom, and in the larger online world.<\/p>\n\n<p>For example, &#8220;<i>34.985840 North, 135.757639 East<\/i>&#8221; is less readable and\nless searchable than <span class='QO'>&#8220;<\/span><i>Kyoto Station, Kyoto, Kyoto Prefecture,\nJapan<\/i><span class='QC'>&#8221;<\/span>, so it's desirable to fill in those fields.<\/p>\n\n<p class='h'>The Problem<\/p>\n\n<p>It can be arduous to fill in these location-based fields by hand,\nespecially when you're on the go <span class='nobr'>a lot,<\/span> so we look to automated methods for\nthe bulk of the heavy lifting. <span class='nobr'>My plugins<\/span> can do the lookups automatically\nusing Google's free (thank you, Google) reverse-geocoding service.<\/p>\n\n<p>Sometimes the results are good, but they can be very hit and miss.<\/p>\n\n<p>For example, <span class='nobr'>&#8220;<span class='ll'>40.6892439979, -74.044520002023<\/span>&#8221;<\/span>\nreturns &#8220;<i>Statue of Liberty, Brooklyn, NY 11231, USA<\/i>&#8221; (the state is Brooklyn?),\nand <span class='nobr'>&#8220;<span class='ll'>-33.856779332429, 151.21523811895<\/span>&#8221;<\/span> returns\n&#8220;Sydney Harbour Tunnel, Port Jackson NSW, Australia&#8221; when we'd really like to see\n&#8220;Sydney Opera House, Sydney, NSW, Australia&#8221;.<\/p>\n\n<p>For one site within Kyoto Station that <span class='nobr'>I tested,<\/span> <span class='nobr'>I got back<\/span> only <span\nclass='nobr'>&#8220;\u3012600-8711, Japan&#8221;,<\/span> (no city, state, or location, for <span class='nobr'>a place<\/span> that's the central hub of <span class='nobr'>a city<\/span> with 1.5 million people), while\n<span class='nobr'>a location<\/span> at the other end of the station added <span class='nobr'>a street<\/span> name, but still no reference to Kyoto. Yet,\n<span class='nobr'>a location<\/span> <span class='nobr'>a minute's<\/span> walk away returns the fully flushed out <span class='QO'>&#8220;<\/span><i>Japan, Kyoto Prefecture Kyoto Shimogyo Ward <span class='nobr'>\u6771\u5883\u753a<\/span>\uff11\uff17\uff14<\/i><span class='QC'>&#8221;<\/span>.<\/p>\n\n<p>Like I said, automated look-up can be really spotty.<\/p>\n\n<p>Furthermore, sometimes you'd like to impose your personal feelings about how <span class='nobr'>a place<\/span> is labeled,\nsuch as labeling an area &#8220;Grandma and Grandma's house&#8221;, or &#8220;Home&#8221;, or &#8220;Billy's friend Eddy's house&#8221;, etc.,<\/p>\n\n<p class='h'>The Idea<\/p>\n\n<p>While discussing geoencoding with <a href='http:\/\/www.peterkrogh.com\/'>Peter Krogh<\/a> last week, he asked<\/p>\n<div class='quote'>\"<i>Do you think it would be feasible to assign <span class='nobr'>a custom<\/span> place name according to <span class='nobr'>a GPS<\/span> point\/radius\/region?<\/i>\"<\/div>\n<p>to which I replied:<\/p>\n<div class='quote'>\"<i>Sure, just take <span class='nobr'>a collection<\/span> of polygons that intersect the point, sort on total area, and take the smallest.<\/i>\"<\/div>\n\n<p>and suddenly I wondered it never occurred to me to add this to my plugin.<\/p>\n\n<p>So I did.<\/p>\n\n<p class='h'>Current Status<\/p>\n\n<p><span style='color:#FF8888'>This is <span class='nobr'>a work<\/span> in progress. What's described\nbelow is valid as of <a style='color:#FFCCCC'\nhref='\/blog\/lightroom-goodies\/gps\/'>plugin<\/a> version <b>20110526.148<\/b>.<\/span>\n\n<span style='color:#FF0000'>At this early stage, things might change considerably in future versions of the plugin, so be sure to follow the\n<a style='color:#FF6666' href='\/blog\/lightroom-goodies\/gps#history'>version history<\/a> when you update.<\/span><\/p>\n\n<p>The plugins geoencoding dialog (brought up via <span class='nobr'>&#8220;<b>File &gt; Plugin Extras &gt; Geoencode<\/b>&#8221;)<\/span> now includes\na &#8220;Reverse Geo&#8221; tab, as illustrated here:<\/p>\n\n<div class='ic'><img loading=\"lazy\" decoding=\"async\" src=\"\/i\/lr\/gps-kml-dialog-148.png\" width=\"850\" height=\"334\"\nclass=\"raw\"\nid=\"igps_kml_dialog_148\"\/><\/div>\n\n<p>On the right side, you can point to a <a href='http:\/\/en.wikipedia.org\/wiki\/Kml'>KML<\/a> file of personal location data\nthat you've built (likely with <a\nhref='http:\/\/www.google.com\/earth\/index.html'>Google Earth<\/a>), and where\nappropriate, the plugin will use that data in preference to the generic\nGoogle reverse geocoding lookups.<\/p>\n\n<p>Building and maintaining your own data file is easy with Google Earth:<\/p>\n\n<ol id='steps'><li><p>Create a new &#8220;Folder&#8221; in the &#8220;Places&#8221; sidebar, as illustrated here:<\/p>\n\n     <img loading=\"lazy\" decoding=\"async\" src=\"\/i\/lr\/earth-places-right-click.png\" width=\"414\" height=\"301\"\nclass=\"raw\"\nid=\"iearth_places_right_click\"\nstyle=\"margin-left:100px\"\/>\n\n     <p>Name the new folder something like &#8220;<b>My Geo Stuff<\/b>&#8221;.<\/p>\n\n     <\/li>\n\n\n     <li><p>Navigate within Earth to a place you'd like to add, and adjust the zoom so that it's fully visible.<\/p><\/li>\n\n     <li><p>With the folder created in step one selected, click on the &#8220;Add Polygon&#8221; icon above the map:<\/p>\n\n               <img loading=\"lazy\" decoding=\"async\" src=\"\/i\/lr\/earth-new-polygon.png\" width=\"249\" height=\"141\"\nclass=\"raw\"\nid=\"iearth_new_polygon\"\nstyle=\"margin-left:100px\"\/>\n\n          <p>This will bring up a small dialog where you can enter <span class='nobr'>a name,<\/span> and change the cursor into <span class='nobr'>a special<\/span> cross-hairs cursor.<\/p>\n          <\/li>\n\n          <li><p>Enter a name for your location.<\/p><\/li>\n\n               <li><p>In the dialog, click on the &#8220;Style, Color&#8221; tab and change the &#8220;Area&#8221; opacity to &#8220;50%&#8221;.<\/p><\/li>\n\n                    <li><p>Start clicking around the edge of the area you want to define. <span class='nobr'>The shape<\/span> will change with each click,\n                           and you can click and drag on an individual point to move it. <span class='nobr'>The delete<\/span> key removes the most recent point.\n                         Continue until the area is defined as you like.<\/p>\n\n                         <p>Here's an example marking Kobe Airport:<\/p>\n\n                         <div style='text-align:center'>\n                         <img loading=\"lazy\" decoding=\"async\" src=\"\/i\/lr\/earth-kobe-airport-polygon.jpg\" width=\"600\" height=\"370\"\nclass=\"raw\"\nid=\"iearth_kobe_airport_polygon\"\/>\n                         <br\/>Kobe Airport<\/div>\n\n\n                         <p>An area like this in the middle of nowhere need not be complex (I've used seven points), but you\n                         can make them as arbitrarily complex as you like. <span class='nobr'>Use as many<\/span> points as you need, but since more complex polygons\n                         take more CPU to work with in the plugin, use only the points you need. This next screenshot is an example of\n                         what <i>not<\/i> to do: rather than click at points around the edge, <span class='nobr'>I dragged<\/span> the cursor, and it ended up creating\n                         <span class='nobr'>a polygon<\/span> with 88 points:<\/p>\n\n                         <div style='text-align:center'>\n                        <img loading=\"lazy\" decoding=\"async\" src=\"\/i\/lr\/earth-kobe-airport-polygon2.jpg\" width=\"600\" height=\"370\"\nclass=\"raw\"\nid=\"iearth_kobe_airport_polygon2\"\/>\n                         <br\/>needlessly complex<\/div>\n\n                         <\/li>\n\n\n\n\n<li><p>Click the dialog's &#8220;OK&#8221; button to save the new location.<\/p><\/li>\n\n\n     <li><p>You can now repeat steps #2 &ndash; #6 for as many locations that you'd like to add:<\/p>\n          <ul id='editnotes'><li>You won't need to set the opacity each time, though you can adjust the opacity and color as you like.<\/li>\n          <li>You can edit <span class='nobr'>a location<\/span> via the right-click menu &#8220;Get Info&#8221; item.<\/li>\n          <li>You can overlap locations, as <span class='nobr'>I did<\/span> in the example at the top of this post (the red area isolates the on-station hotel). <span class='nobr'>If the plugin<\/span> finds that more than one matches <span class='nobr'>a location,<\/span> the one with the smallest area is considered the most specific and so it's the one used.<\/li>\n          <li>There seems to be <span class='nobr'>a bug<\/span> in Google Earth that causes the name to be lost if you don't tab out of the name input field before clicking &#8220;OK&#8221;,\n          so if you end up with &#8220;Untitled Polygon&#8221;, just edit it to set the name you want.<\/li>\n               <li>You can organize your locations under your <span class='nobr'>&#8220;<b>My Geo Stuff<\/b>&#8221;<\/span> main folder by creating new folders in the same way you made\n<span class='nobr'>&#8220;<b>My Geo Stuff<\/b>&#8221;<\/span> to begin with, but by right clicking on <span class='nobr'>&#8220;<b>My Geo Stuff<\/b>&#8221;<\/span> instead of <span class='nobr'>&#8220;<b>My Places<\/b>&#8221;.<\/span><\/li>\n          <li>If you accidentally create <span class='nobr'>a location<\/span> outside of your <span class='nobr'>&#8220;<b>My Geo Stuff<\/b>&#8221;<\/span> folder tree, just drag it in.<\/li>\n        <\/ul><\/li>\n\n\n<li><p>When you're ready to save the data, right click on <span class='nobr'>&#8220;<b>My Geo Stuff<\/b>&#8221;<\/span> and select\n     <span class='nobr'>&#8220;<b>Save Place As...<\/b>&#8221;<\/span>. Make sure to choose the <b>kml<\/b> format, and <i>not<\/i>\n     the <b>kmz<\/b> format, and save the file somewhere convenient.<\/p><\/li>\n\n<li><p>You can continue working on your set of locations later, but not that <b>Earth will not save the file automatically<\/b>, so if you want updates and additions\n     to be made available to the plugin, you'll have to repeat step #9 each time.<\/p><\/li>\n\n<\/ol>\n\n<p>And that's it. After referring to the file in the plugin dialog, photos\ngeoencoded to locations within the polygons you defined in the KML file\nwill get the name you defined as their &#8220;location&#8221;.<\/p>\n\n<p>As a bonus, the names themselves become available as geoencoding presets\nin the <span class='nobr'>&#8220;Static Location&#8221;<\/span> tab, for when you want\nto assign geo-coordinates to <span class='nobr'>a photo<\/span> that doesn't yet have them: the\nlatitude and longitude of the polygon's centroid (center) is used.<\/p>\n\n<p><b>But what about &#8220;city&#8221;, &#8220;state&#8221;, and &#8220;country&#8221;?<\/b>  Ah, that brings us to...<\/p>\n\n<p class='h'>Plans for the Future<\/p>\n\n<p>As of now, this works only with the &#8220;location&#8221; metadata field, which is\nnice, but in order to be <span class='nobr'>a reverse<\/span>-geocoding solution, it's got to handle\n&#8220;city&#8221; and the like. <span class='nobr'>A KML file<\/span> can hold extended metadata like that, but <span class='nobr'>I\nhaven't<\/span> figured out <span class='nobr'>a way<\/span> to allow it to be edited and maintained\nconveniently. I've got some ideas to pursue, but if you've got ideas on\nother KML editors or solutions, <span class='nobr'>I'd appreciate<\/span> to hear them.<\/p>\n\n<p>But even after we can associate <span class='nobr'>a city<\/span>\/state\/country with the locations we define, interesting issues remain to be considered:<\/p>\n\n<ul id='plans'><li>If we allow multiple KML files to be specified to the plugin, community-specific KML files can be built and shared among\n     members of that community. For example, photographers into R\/C airplanes might maintain <span class='nobr'>a shared<\/span> KML file describing popular\n     fields to fly from. Each member would then use that in the plugin, as well as their own KML file for their personal locations.<\/li>\n\n\n<li>Rather than a &#8220;smallest polygon takes all&#8221; approach, perhaps all matching polygons should be inspected to derive data.\n     For example, if <span class='nobr'>I have<\/span> one big polygon that surrounds Japan and associate &#8220;country is Japan&#8221; with it,\n     and then another polygon that identifies Kyoto Prefecture and associate &#8220;state is Kyoto Prefecture&#8221;, and another\n     polygon for &#8220;city is Kyoto&#8221;, then coordinates at <span class='nobr'>a place<\/span> like Kyoto Station would be within them all, and so\n     the city\/state\/country could be inherited from them, leaving only &#8220;Kyoto Station&#8221; to come from the Kyoto-Station-specific location.\n     This alleviates the need to laboriously enter the city\/state\/country data for every location defined within the city.<\/li>\n\n<li>If data is inherited from more spacious polygons as described above, maybe there should be <span class='nobr'>a way<\/span> to combine data within <span class='nobr'>a particular<\/span> field. <span class='nobr'>In the Kyoto<\/span> Station example, maybe that polygon would have &#8220;location is Kyoto Station&#8221;, while the hotel polygon within it would have\n     &#8220;location is Hotel Granvia&#8221;, and the final derived location for <span class='nobr'>a point<\/span> within the hotel could be &#8220;Kyoto Station Hotel Granvia&#8221;\n     or maybe &#8220;Kyoto Station (Hotel Granvia)&#8221;. <span class='nobr'>How should<\/span> this be handled?<\/li>\n\n<li>If we allow multiple KML files to be specified to the plugin, should we treat their respective polygons equally, or somehow give precedence to\n    one file over another (so that, for example, one's personal KML always overrides <span class='nobr'>a community<\/span> KML you also use)?<\/li>\n\n<\/ul>\n\n<p>I'm sure there are plenty of problems and opportunities that I'm not thinking of, so please let me know what you think and your ideas\/hopes for <span class='nobr'>a feature<\/span> like this.<\/p>\n\n<p>I expect the semantics of reverse geocoding in the plugin to change with new versions as these issues are addressed,\n<span style='color:red'>so be sure to carefully check the version history when updating the plugin.<\/span><\/p>\n\n<p class='h'>What <span class='nobr'>I Really<\/span> Want<\/p>\n\n<p>I'll be happy to get a good reverse-geocoding solution for my plugin,\nbut this is an idea that could\/should go well beyond my own plugins...\n<i>any<\/i> geoencoding solution could benefit from this kind of thing. <span class='nobr'>I can imagine<\/span> that Google would allow registered users to incorporate this\nkind of data in their Google account, incorporating and sharing datasets\nwith member of the various communities the user is <span class='nobr'>a part<\/span> of (allowing\ncommunities to crowdsource data), and then use this user-specific data to\ntailor reverse-geocoding responses to the specific user.<\/p>\n\n<p>Google has a lot out there already, and perhaps something like <a\nhref='http:\/\/www.google.com\/mapmaker'>Google Map Maker<\/a> is already\nmostly there, but <span class='nobr'>I haven't<\/span> found <span class='nobr'>a way<\/span> to make it work for these purposes.\n(I'd love to be proven wrong.)<\/p>\n\n<p>My ultimate goal is everything above, <b>and<\/b> that this is handled\nnatively within Lightroom, so that <span class='nobr'>I can<\/span> dispense with the plugin and pick\nup the camera again.<\/p>\n\n\n\n","protected":false},"excerpt":{"rendered":"<p>I've recently added a feature to my Geoencoding-Support plugin for Adobe Lightroom to aid in reverse geocoding (that is, to aid in filling in the \"location\", \"city\", \"state\", and \"country\" metadata fields, based upon the latitude and longitude associated with the image). In Google Earth, you can mark areas with arbitrarily-complex polygons, and assign names to them, and save the collection in a KML file as your personal location-to-name mapping, and the plugin will use this in preference to the generic, often unuseful reverse-geocoding data from Google Maps.<\/p> <p class='h'>Background<\/p> <p>\"Geoencoding\" is the assignment of appropriate latitude\/longitude coordinates to a [...]","protected":false},"author":1,"featured_media":0,"parent":977,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"footnotes":""},"_links":{"self":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages\/1782"}],"collection":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/comments?post=1782"}],"version-history":[{"count":0,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages\/1782\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/pages\/977"}],"wp:attachment":[{"href":"https:\/\/regex.info\/blog\/wp-json\/wp\/v2\/media?parent=1782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}