Wikipedia talk:WikiProject Geographical coordinates/Archive 16

Add to the to do list {{coord}} edit

Bold assertion. The {{coord}} documentation is a programmer's comment rather than a useful description of the template. All the detail is there but you need to be seriously committed to find it- and have background knowledge gleaned from other templates to interpret it. It is a protected page, so I couldn't do the decent thing- a rewrite. Please can we put that task on the to do list, and ask someone who if further away from the coding to do the task.ClemRutter (talk) 08:11, 26 July 2008 (UTC)Reply

Actually, the documentation is not protected, but it's transcluded on the protected template page from Template:Coord/doc. Anyone can still edit and clarify the documentation. I suggest we organise something to keep all the various pages with instructions for coordinate use in sync and not just the template documentation. Or if it's possible to make the documentation better than it has ever been with any coordinate template, change all those other instructions to link to the template page instead. --Para (talk) 11:36, 30 July 2008 (UTC)Reply

Photos with GPS in the metadata edit

Question about a number of photos I've recently been uploading. All of them are tagged with GPS from my camera, yet none seem to upload with the coordinates. The metadata seems to be there (the page lists the satellites, altitude, etc) but no specific coordinates. Is there any automatic way to get the coordinates to appear? here's a sample: http://en.wikipedia.org/wiki/Image:Chappaquiddick_bridge.jpg If not, are there ways of us entering the data by hand? Arwcheek (talk) 22:44, 25 July 2008 (UTC)Reply

Please refer to commons:Commons:Geocoding (might have to check the archive). I operate a bot that extrats EXIF geodata and inserts the propper geocoding templates. Oh, yeah, and don't upload PD images to en.wp, use commons. --Dschwen 22:50, 25 July 2008 (UTC)Reply
Arwcheek, I believe images uploaded to/via Commons:Upload (instead of directly the English Wikipedia) are processed by Commons:User:DschwenBot once or twice a day? Commons:Special:Contributions/DschwenBot indicates it last added Locations on July 15th. See Commons:Bots/Requests for flags/DschwenBot, the source code for what it does is Commons:User:DschwenBot/source. On Commons, it would create something "similar" to: {{Location|41|22|24.0|N|70|27|13.3|W|alt:10_source:exif_heading:?}} (I did not read your image's extended EXIF GPS tags, Wikipedia does not display the GPS coordinates, those coordinates are from Chappaquiddick incident) I am not sure if "alt:" is in the same units (feet or meters)? I believe Meters is the preferred unit when a unit is not specified, and "heading:?" is a "hint" that you need to manually replace the '?' question mark with a W:Boxing the compass heading (i.e. 0 to 360 or N,S,E,W NE,SE,SW,NW NNE,ENE,ESE,SSE,SSW,WSW,WNW,NNW NbE,NEbN,NEbE,EbN,EbS,SEbE,SEbS,SbE,SbW,SWbS,SWbW,WbS,WbN,NWbW,NWbN,NbW).
"type:" can be specified, it defaults to "landmark" (on Commons), "scale:" can be specified, it defaults to 5000 (on Commons). mapsources.php has the defined types: country,state,adm1st,adm2nd,city,mountain,isle,airport,landmark and their corresponding default scales (see Wikipedia talk:WikiProject Geographical coordinates#Scaling above).
Commons is a site where images or some other "common" files can be shared between the various Wikis. An image uploaded to Commons is retrieved as if it were uploaded directly to the English Wikipedia, but can also be retrieved by the other language Wikis and sites as well. The "disadvantage" to Commons is that anything uploaded there needs to be Public Domain or some variation of Creative Commons licensing with few exceptions, i.e. minimal "Copyrighted-Fair Use" content, whereas some "Fair Use" content can be uploaded to the English Wikipedia when certain guidelines are followed.
Arwcheek, I believe images uploaded (directly) to the English Wikipedia (instead of Commons) are not processed by DschwenBot. So your options are either to move your images from the English Wikipedia to Commons, or to manually geocode them: Chappaquiddick incident has {{coor title dms|41|22|24.0|N|70|27|13.3|W|region:US-MA_type:landmark}}, if those coordinates are accurate, then {{Location|41|22|24.0|N|70|27|13.3|W|region:US-MA_type:landmark|display=inline,title}} would be an appropriate Commons geocoding. The Commons:Template:Location works similar to the Wikipedia En:Template:Coord which would be {{Coord|41|22|24.0|N|70|27|13.3|W|region:US-MA_type:landmark|display=title}} The Coord and Location templates are a functionality merging of the family of Coor templates (Coor d, Coor dm, Coor dms, Coor at d, Coor at dm, Coor at dms, Coor title d, Coor title dm, and Coor title dms) into one template.
Several "undocumented" and "unimplemented" optional parameters are appearing without the underlying source code (mapsources.php) and templates being updated to properly handle them. In particular: altitude "alt:" or elevation, several new "type:" parameters without "scale:" being properly defaulted or set, a few new "source:" parameters. I agree that these new "features" add value and should be implemented, but some proper process needs to be followed so that all the pieces get updated appropriately and do not break. I would like to see: 3-D coordinates (altitude/elevation), the new types seem reasonable, and I would like to see a standard list of defined sources: besides "GNIS" (like: "EXIF"; GPS with some optional indication of 2D, 3D, differential 2D, differential 3D, military/surveying "L1+L2" high-precision ...; manually plotted with Google Earth, Google maps; ... I do not disagree with the additions, just that an appropriate "process" is needed. LeheckaG (talk) 07:02, 26 July 2008 (UTC)Reply

Category:Coord template needing repair edit

I recently updated template {{Infobox Protected area}} to optionally accept a coords parameter instead of the 8 lat_degrees, lat_minutes, ... long_seconds, long_direction values. (Yes, it still accepts the 8 parameters for backward compatibility. If coords= is used, it trumps the old parameters.)

I was updating the documentation and decided to enhance the examples showing the full power of {{coord}} as many wikiproject members have asked for various aspects of its functionality provided by the infobox template. Part the motivation for the new infobox parameter is avoiding the need for an infobox parameter for every possible display/scale/name/region/world/etc. In adding scale:N, I noticed it has no effect on the generated URL. That is {{coord|45|12|34|N|123|45|56|W|type:landmark_region:US|scale:300000}} gives {{coord|45|12|34|N|123|45|56|W|type:landmark_region:US|scale:300000}} while {{coord|45|12|34|N|123|45|56|W|type:landmark_region:US|scale:10000}} gives {{coord|45|12|34|N|123|45|56|W|type:landmark_region:US|scale:10000}}. Same URLs, right? Am I doing something wrong? —EncMstr (talk) 06:55, 26 July 2008 (UTC)Reply

[Misformed examples of coord nowiki-ed to get this page out of Category:Coord template needing repair.
—WWoods (talk) 15:20, 11 September 2009 (UTC)]Reply

Decimal coord and scale? edit

While writing the last section, I originally used decimal—rather than DMS—format, but got grief from {{coord}} with the addition of a scale parameter. That is {{coord|45.123|-123.123|type:landmark_region:US|scale:300000}} gives Coordinates: Unknown argument format
Removal of the scale parameter gives 45°07′23″N 123°07′23″W / 45.123°N 123.123°W / 45.123; -123.123. Huh? —EncMstr (talk) 06:55, 26 July 2008 (UTC)Reply

Coordinate parameters versus Template parameters edit

Try: {{|Coord|45|12|34|N|123|45|56|W|region:US-OR_type:mountain_scale:300000|name=South Point (Mount Hebo)}} which produces: 45°12′34″N 123°45′56″W / 45.20944°N 123.76556°W / 45.20944; -123.76556 (South Point (Mount Hebo))

The '|' pipe or vertical bar character you placed before "scale:" ends the "Coordinate" parameters and begins the "Template" parameters. The later "Template" parameters are either: "display=" with "inline" "inline,title" or "title" choices and "format=" either "dec" or "dms".

Would people find it useful if I or someone else wrote up a Extended Backus–Naur Form or Augmented Backus–Naur Form summary of the template syntax? Like:

"{{" "Coord" '|' latitude-degrees [ [ '|' latitude-minutes [ '|' latitude-seconds ] ] '|' latitude-direction ] '|' longitude-degrees [ [ '|' longitude-minutes [ '|' longitude-seconds ] ] '|' longitude-direction ] [ '|' coordinate-parameters ] [ '|' template-parameters ] "}}"

Where latitude-direction is either 'N' or 'S', longitude-direction is either 'E' or 'W', ...

The above is "unofficial" from my everyday usage of the template, if it would be useful, I can reverse-engineer {{Coord}} (I did not write it, I just use it a lot) and write-up a formal ABNF or EBNF for the template and post it on the documentation?

While not "formally" correct, a "Wiki-simplified" version of the above might look like:

{{Coord | latitude-degrees [ [ | latitude-minutes [ | latitude-seconds ] ] | latitude-direction ] | longitude-degrees [ [ | longitude-minutes [ | longitude-seconds ] ] | longitude-direction ] [ | coordinate-parameters ] [ | template-parameters ] }}

"Takers", Comments, Preferences: for "Wiki-simplified", EBNF, ABNF, BNF, or some other form? LeheckaG (talk) 07:30, 26 July 2008 (UTC)Reply

The most useful to me is 2 or 3 well-chosen examples. One basic, but useful. One using every feature properly and usefully. And maybe something in between. If that were the focus of the documentation, reading the rest wouldn't be necessary, except for the most esoteric or ambiguous cases. Even then, a little experimentation goes a long way. —EncMstr (talk) 07:36, 26 July 2008 (UTC)Reply
I think I get it! My problem was that I was parsing type:landmark_region:US as one syntactic item—in my mind, a magic cookie saying that the coordinate is a "landmark region" in the US. I now see that the underscore is a delimiter! (I now see that fact in the documentation too!) That—you have to admit—goes against all previous experience. Underscores_are_syntactic_fluff_which_most_readers_regard_much_like_a_space_not_a_delimiter. In most programming contexts, they are allowed as part of identifiers. But I felt I had to delimit scale:. It was simply bad luck that {{coord}} ignores all parameters after number nine.
So the critical documentation issue is:
 {{coord | latitude | longitude | underscore_delimited_qualifiers |
           display=title,inline | name=name_to_use_if_not_the_pagename | format = dms or dec }}
where qualifiers include
type:{country|state|adm1st|adm2nd|city|mountain|isle|waterbody|landmark|forest|river|glacier|edu|pass}
scale:N
region:XX
globe:XXXX (if not earth)
source:xxxx (wickedly complicated)
Assuming I am now on track, that's the emphasis the documentation should have. (It doesn't help that the information is in divided into several places.) —EncMstr (talk) 16:09, 26 July 2008 (UTC)Reply
  • The Coordinate parameters (region:, scale:, type:, source:, ... separated by underscores) are "one" template parameter from the Coor and Coord templates point of view, they are passed on "as is" to GeoHack on the ToolServer as part of a URL, which then parses them into individual parameters (using the underscore to delimit them).
  • The "name to use if not the pagename" is NOT accurate, if no "name=" is specified, then no "&title=" parameter is generated nor passed to GeoHack.

LeheckaG (talk) 16:56, 26 July 2008 (UTC)Reply

Have a look at the first example at Template:Infobox Protected area#Examples. (Note that "display=title,inline" is shown in the formatted example text for cut-and-paste use, but is omitted in the active wikicode to not mess up the page from all the examples.)
The generated coord URL is http://stable.toolserver.org/geohack/geohack.php?pagename=Template:Infobox_Protected_area&params=37_50_0_N_119_30_0_W_type:landmark_region:US_scale:300000. The pagename parameter shows up on the GeoHack page as the title Template:Infobox Protected area. Compare that with the fourth (and last) example which uses a name parameter. That gives the URL http://stable.toolserver.org/geohack/geohack.php?pagename=Template:Infobox_Protected_area&params=51_56_10_N_112_57_41_W_type:landmark_region:CA_scale:100000&title=Dry+Island+Buffalo+Jump+Provincial+Park. It still has pagename, but added title which appears to override pagename on the GeoHack page. That's what I intended to convey above. The URLs on the GeoHack page incorporate the title for the point name. (Why doesn't it for Google, Yahoo, and a few other maps?) —EncMstr (talk) 17:24, 26 July 2008 (UTC)Reply
Yes, "PAGENAME" and "title=" are two different parameters in the generated URL which Geohack can use. The current GeoHack Template implementation (see: Template:GeoTemplate and Template:GeoTemplate/doc) if a "title=" is not supplied, then uses "PAGENAME" for Title (this occurs on ToolServer in the GeoTemplate, and not on Wiki in the Coor or Coord templates). It is a "bug" in what the GeoHack template/ToolServer then does (sometimes passing it and sometimes not depending on which action/service is chosen). The {{GeoGroupTemplate}} "Map all coordinates" does label each Google Map point with their "name=" parameters. LeheckaG (talk) 17:57, 26 July 2008 (UTC)Reply
I'm having trouble telling right from wrong in your answers. You say that name=name_to_use_if_not_the_pagename is wrong, but you just said that name= overrides pagename in the generated title. What's the distinction? —EncMstr (talk) 18:30, 26 July 2008 (UTC)Reply
I am in the process of reverse engineering the GeoHack/ToolServer GeoTemplate to better answer your post. PAGENAME and title= are (2) distinct parameters in Template:GeoTemplate, the "quick" answer is that while "PAGENAME" might display in the "title" heading in the the top left portion of the page IF a title= parameter is not supplied; if title= is not supplied, the GeoTemplate does NOT actually replace "title=" with PAGENAME. So when a link is clicked on from the ToolServer.Org GeoHack page, it still uses the title= parameter (and NOT the PAGENAME) parameter - but all of that is dependent on the GeoTemplate code ... which I am going through...
The "quick" answer to the comment about (title=name) not being passed on to maps: they are for some (MapQuest, Microsoft Live, ...) and not for others (Google, Yahoo, ...) it is a matter of how GeoTemplate is coded. I will be working on a table indicating which links do and which do not. LeheckaG (talk) 18:44, 26 July 2008 (UTC)Reply
I don't think name= really overrides, but that it is used for different things than the article name. In Arlington National Cemetery there are coordinates for the cemetery. Down in Arlington National Cemetery#External links is a {{GeoGroupTemplate}} which offers this Google Maps display of more coordinates in the article]. The name= parameter is used to label the coordinates, as the article name is not appropriate for all the coordinates. Some tools use the article name if name= is not provided, but the article name is used by some tools despite the name= usage (such as a map being labeled with the article name even if all coordinates have differing name= contents). -- SEWilco (talk) 14:22, 27 July 2008 (UTC)Reply
See the table I posted below, there are only (2) links on ToolServer/GeoHack (GeoTemplate) which actually use the article's PAGENAME:
  • "All coordinates"
  • OpenStreetMap
which is why if name= is not supplied, then the coordinates do not get labeled with a name on a map.
There are several which do pass on the name= parameter (which is passed on in the URL as title=),
but there are also notable ones like Google and Yahoo for which the parameter is not passed.
GeoTemplate can be updated to "fix" things better, since it is high-use/high-profile, I am not sure what the release control process is? LeheckaG (talk) 15:25, 27 July 2008 (UTC)Reply
The pagename is always provided to GeoHack, and the services that use it may expect to find the source article with it. Some services use a name for the coordinates, possibly displaying it on the map. These are two different purposes. When the coordinates haven't been named explicitly, GeoHack assumes the coordinates are for the object of the article, and since it knows the name of the page, it fills the title with that information. All this is done to get a meaningful name for the coordinates.
The reason some services don't show a name is that they don't support displaying a name at all or they don't support some common characters in Wikipedia article names, and GeoHack doesn't yet have functionality for selective character replacement. This was discussed on Template talk:GeoTemplate#Named coordinates. Any fixes should probably be discussed on wiki before dumping suggestions on the developer(s?). --Para (talk) 12:07, 30 July 2008 (UTC)Reply
If you view the Template:GeoTemplate source code, you can see that PAGENAME is only used by the (2) GeoHack selections I documented above, it is never actually copied to "title=", which is what the many of the GeoHack links are set-up to use. Given that many articles either have PAGENAMEs which might not be "best" displayed on a map or they contain more than one set of coordinates, it is probably best to always set "name=" to something which makes sense so that "title=" is always filled in. While some services have no provision for a name, for those which do, either "title=" could be used if they support it, or it can be copied to whatever format/parameter name that service uses. The issue is that it requires research to figure out what each service accepts and uses, which the GeoHack developers may not have had the resources to do. The services which use "PAGENAME" usually backlink to the Wikipedia page, and then extract information from that article (from instance Map All Coordinates extracting all article coordinates). LeheckaG (talk) 13:25, 30 July 2008 (UTC)Reply
See Template:GeoTemplate/doc#Miscellaneous and GeoHack source code if you're in doubt: {pagename} is copied to {title} when no title is provided, so most services have no reason to use pagename specifically, unless indeed they support a more complex description with hyperlinks. Researching what all the services support and don't support doesn't need to be left for developers, since we're in an environment with lots of volunteers. Some guidance might be necessary though. --Para (talk) 13:47, 30 July 2008 (UTC)Reply
I do not see {pagename} copied to {title} in Template:GeoTemplate, here are the only (2) {pagename} references which I see:
  • This displays {pagename} after {title}, but does NOT copy {pagename} to {title}:
! id="title"                 | Title
| headers="title" colspan="3"| {title} <span  style="display:none{pagename};">
([http://maps.google.com/maps?q=http%3A//toolserver.org/~para/cgi-bin/kmlexport?project=en%26article%3D{pagename} All coordinates])
</span>
  • This passes {pagename} and not {title} to OpenStreetMap via ToolServer:
Check Openstreetmap [http://toolserver.org/~kolossos/osm/osmhack.php?lat={latdegdec}&lon={londegdec}&name={pagename} Map Features] of this area

Those are the only (2) references to {pagename} I see on Template:GeoTemplate. If you are aware of the place and source code link where it is copied, then I would like to see it (it may well, but I have not seen it). LeheckaG (talk) 14:37, 30 July 2008 (UTC)Reply

GeoTemplate is not filled by MediaWiki, so there is very little the template itself can do. The tool that fills in the template is called GeoHack, and it's its source code you need to look at. In this case the relevant line is in mapsources.php, where the default value for the title is the pagename. --Para (talk) 21:41, 30 July 2008 (UTC)Reply
I see {{Coord}} transcludes {{Coord/link}} transcludes {{Coor URL}} which loads geohack.php.
I am not sure if this is the "production" version; How does one tell which geohack and mapsources versions are?
https://fisheye.toolserver.org/browse/geohack/www/geohack.php?r=2 has:
13   	 include "geo_param.php" ;
14 	include "mapsources.php" ;
...
50   	 # Read template
51 	$pagename = "Template:GeoTemplate" ;
52 	#$pagename = get_request ( "altpage" , "Template:GeoTemplate" ) ;
53 	$page = @file_get_contents ( "http://{$lang}.wikipedia.org/wiki/$pagename" ) ;
...
103   	 # Build the page
104 	$md->thetext = $page ;
105 	$page = $md->build_output () ;
"build_output" calls a class/function in https://fisheye.toolserver.org/browse/geohack/www/mapsources.php?r=3#l287 (revised link from above - which is "production"?) which has:
287   	                 $r_pagename = get_request( 'pagename', '' ) ;
288 	                $r_pagename = str_replace ( '&' , "&" , $r_pagename ) ;
289 	                $r_pagename = str_replace ( '"' , """ , $r_pagename ) ;
290 	                $r_title = get_request( 'title', $r_pagename ) ;
291 	                $r_title = str_replace ( '&' , "&" , $r_title ) ;
292 	                $r_title = str_replace ( '"' , """ , $r_title ) ;
looking at what "get_request" does: http://phpldapadmin.sourceforge.net/function-ref/phpLDAPadmin/_lib---functions.php.html says:
get_request [line 450]
void get_request( $attr, [ $type = null], [ $die = false], [ $default = null])

Return the result of a form variable, with optional default

Parameters
   	$attr   	
   	$type   	
   	$die   	
   	$default  
  • so geohack reads GeoTemplate, but then mapsources replaces title if it is blank.
If you click on the coordinates to the right of the Globe under the sub-section heading above: Wikipedia talk:WikiProject Geographical coordinates#Coordinate parameters versus Template parameters, the URL generated by {{Coord}} and {{Coord/link}} {{Coor URL}} has:
If you hover over "All Coordinates" after "Title South Point (Mount Hebo) in the Upper-Left corner, the generated URL is:
Similarly for "Map Features" in "Check Openstreetmap Map Features of this area" (about 1/8th to 1/10 of the way down the page):
If you hover over the "Map" "Satellite" or "Hybrid" after "MapQuest" under "Global Systems" in the Upper-Left corner, the generated URLs are:
Similarly, if you hover over "Live Search Maps", "Ask.Com", "ACME Mapper", "GeaBios", "GPS Visualizer", ...
If I follow one of those links, I get "South Point (Mount Hebo)" and not "Wikipedia_talk:WikiProject Geographical coordinates" as the label.
I am not sure where the "disconnect" is between mapsources.php and {{GeoTemplate}}
When you click on the original coordinate example on this section Wikipedia talk:WikiProject Geographical coordinates#Does coord scale:N work?
http://stable.toolserver.org/geohack/geohack.php?pagename=Wikipedia_talk:WikiProject_Geographical_coordinates&params=45_12_34_N_123_45_56_W_type:landmark_region:US
Yes, since "title" is blank, mapsources.php does replace it with "pagename" in the links when you hover or click on the links.
So the general "issue" would be getting the various GeoTemplate links updated with "title" or whichever name they expect a label, name, title, ... on.
Meta:WikiMiniAtlas MediaWiki:Wikiminiatlas.js works by reading through elements of the article's generated Geo microformat. The "glue" which enables the Wikiminiatlas.js is apparently either in Common.js or Wikipedia:Skin, but I have not found the exact links. LeheckaG (talk) 11:11, 31 July 2008 (UTC)Reply
Yes, everything is working as intended: if coordinates have been named, the name is preferred over the name of their container (the article) when labeling the point. The issue as you found has all along been to find which external services don't support certain characters, come up with variables to be used in the links on GeoTemplate to avoid those characters, and implement their substitution in GeoHack. Template talk:GeoTemplate#Named coordinates is the latest I remember about this. --Para (talk) 12:44, 31 July 2008 (UTC)Reply

GeoTemplate edit

ToolServer / GeoHack

ToolServer GeoHack GeoTemplate pagename/title usage:
Uses: Service:
pagename "All coordinates" and Openstreetmap
title=name MapQuest, Microsoft Live, Ask.Com, ACME Mapper, GeaBios, GPS Visualizer, Google Earth, GlobalGuide.org, Mappington, Wiki.WorldFlicks.org, Espoo, eKarjala, Hämeenlinna, Jyväskylä, Kokkola, Kotka, Kouvola, Kuopio, Lahti, Lappeenranta, Oulu, Pohjois-Karjala, Pori, Rauma, Rovaniemi, Tampere, Turku, Vaasa, Mapa Polski Targeo, ViaMichelin
Ignored Google, Yahoo, ...

The above is from the source code, I did not actually test each one. LeheckaG (talk) 18:57, 26 July 2008 (UTC)Reply