Last modified: 2014-05-13 12:30:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64105, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62105 - globecoordinate serialization fails on some precision values
globecoordinate serialization fails on some precision values
Status: RESOLVED DUPLICATE of bug 64887
Product: MediaWiki extensions
Classification: Unclassified
WikidataRepo (Other open bugs)
unspecified
All All
: High normal with 1 vote (vote)
: ---
Assigned To: Wikidata bugs
u=dev c=frontend p=0
:
Depends on:
Blocks: 55971 62011
  Show dependency treegraph
 
Reported: 2014-03-01 12:13 UTC by Maarten Dammers
Modified: 2014-05-13 12:30 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Maarten Dammers 2014-03-01 12:13:22 UTC
I'm writing a bot to import coordinates to Wikidata and I ran into problems with the "precision" field. For a lot of values it throws 'The value does not comply with the property's definition.
The value's data value type "ununserializable" does not match the property's data type's data value type "globecoordinate".'

Example json:
{'latitude': 41.9689, 'altitude': None, 'globe': 'http://www.wikidata.org/entity
/Q2', 'longitude': 12.4092, 'precision': 0.012082121278963331}

I did some testing on https://www.wikidata.org/wiki/Q3969823
* 0.012039052310050358 fails
* 0.012058 fails (round on 6 decimals)
* 0.00001 works (hard coded)
* 0.00002 fails (hard coded)
Comment 1 Maarten Dammers 2014-03-01 13:08:02 UTC
Ok. Did some digging. The type is defined at https://meta.wikimedia.org/wiki/Wikidata/Data_model#Geographic_locations

a precision (decimal, representing degrees of distance, defaults to 0, 9 digits after the dot and three before, unsigned, used to save the precision of the representation)

After some digging I found http://git.wikimedia.org/blob/mediawiki%2Fextensions%2FDataValues.git/727ccd66b03f42e1f5458ea204ca15b315cf5f04/DataValues%2Fresources%2FglobeCoordinate.js%2Fsrc%2FglobeCoordinate.GlobeCoordinate.js

function isValidPrecision( precision ) {
       var precisions = globeCoordinate.GlobeCoordinate.PRECISIONS;
 
       for( var i in precisions ) {
           if( Math.abs( precision - precisions[i] ) < 0.0000001 ) {
               return true;
           }
       }
 
       return false;
   }
 
   /**
    * Precisions a globe coordinate may feature.
    * @type {number[]}
    */
   GlobeCoordinate.PRECISIONS = [
       10,
       1,
       0.1,
       1 / 60,
       0.01,
       0.001,
       1 / 3600,
       0.0001,
       1 / 36000,
       0.00001,
       1 / 360000,
       0.000001,
       1 / 3600000
   ];


So it looks like only these values (with a minor deviation of 0.0000001) are considered valid. Is this true? Is this intentional? Where the hell is this documented? If this is true, why does the api accept invalid precisions?
Comment 2 Addshore 2014-03-09 20:50:36 UTC
Looks like the JS cant render anything that isn't explicitly defined as okay!?

http://git.wikimedia.org/blob/mediawiki%2Fextensions%2FDataValues.git/727ccd66b03f42e1f5458ea204ca15b315cf5f04/DataValues%2Fresources%2FglobeCoordinate.js%2Fsrc%2FglobeCoordinate.GlobeCoordinate.js#L180

https://www.wikidata.org/w/index.php?title=Q3969823&oldid=113061813
has a precision value of 2.0e-5 but displays as undeserializable
with JS off its okay.
Comment 3 Lydia Pintscher 2014-05-13 12:30:57 UTC

*** This bug has been marked as a duplicate of bug 64887 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links