-0 Issue

From Geohashing
Revision as of 01:50, 27 May 2008 by 67.233.132.178 (talk) (oops, missed that line)

This issue is closed as the official tool has been updated and most "algebric notation" pages look to be updated to use "-0 notation." Page kept as history and explanation of the notations.


Graticule longitudes and latitudes are indexes that look like relative integers. They are the minimal value of all the points in the graticule if the values are positive, and they are the maximal value of all the points in the graticule if the values are negative.


So (-23.452365°,16.415222°) is located in the Graticule -23,16.

And (23.452365°,-16.415222°) is located in the Graticule 23,-16.


With this notation, 0 and -0 are different values (this rule will be called "-0 notation").

Issue with the official tool

UPDATE - the official tool now does accept -0. -- Zig.

The official tool doesn't accept -0 as an input, which make it difficult to make automatic templates for graticules x -0 or -0 x.

The official tool can use "abs" to work this around. If given abs=1 on the url, the official tool will consider the values as being south/west coordinate of the graticule (while this is only true for positive latitude and longitude). (This rule will be called "algebric notation")

But this workaround doesn't work for the <map.../> element, because the map element doesn't take the abs.

The xkcd.js of the official tool can be changed to take -0 as input.

Current code :

 if (qsParm['abs'] != 1) {
   if (qsParm['long'] < 0) qsParm['long']--;
   if (qsParm['lat'] < 0) qsParm['lat']--;
 }

New code :

 if (qsParm['abs'] != 1) {
   if (qsParm['long'] == "-0") { 
     qsParm['long']=-1; 
   } else if (qsParm['long'] < 0) { 
     qsParm['long']--; 
   }
   if (qsParm['lat'] == "-0") { 
     qsParm['lat']=-1; 
   } else if (qsParm['lat'] < 0) { 
     qsParm['lat']--; 
   }
 }

This has been applied Zigdon 16:32, 25 May 2008 (UTC)

Another workaround, involving -360 instead of -0 is described in Template_talk:Graticule/-0_long_workaround_in_action

Issue with the Active Graticules's page

The "abs workaround" leads the Active Graticules's page into chaos. While most of the graticules use the "-0 notation" (example: Boston is refered as 42 -71), the United Kingdom mostly uses the "algebric notation" (example: Swindon is refered as 51 -2).

This inconsistency leads to wrong labels in the official tool.

Edited for grammar, spelling, and punctuation by James. 01:50, 27 May 2008 (UTC)