Page MenuHomePhabricator

Is `altitude` in `globe-coordinate` still in use?
Closed, ResolvedPublic

Description

For example, in d:Q513, the coordinate location is set to a longitude and latitude, and there is no altitude to set (in this property). However, when making MW API request, I got the following value for this property

...
                "P625": [
                    {
                        "mainsnak": {
                            "snaktype": "value",
                            "property": "P625",
                            "hash": "72a03bd4ecbba1e7d0e0dfc2779ceccf9b2e0bcb",
                            "datavalue": {
                                "value": {
                                    "latitude": 27.988055555556,
                                    "longitude": 86.925277777778,
                                    "altitude": null,
                                    "precision": 0.00027777777777778,
                                    "globe": "http://www.wikidata.org/entity/Q2"
                                },
                                "type": "globecoordinate"
                            },
                            "datatype": "globe-coordinate"
                        },
...

Apparently there is an altitude field in the JSON response. I looked up source code in pywikibot, and got

class Coordinate(_WbRepresentation):

    """
    Class for handling and storing Coordinates.

    For now its just being used for DataSite, but
    in the future we can use it for the GeoData extension.
    """

    _items = ('lat', 'lon', 'entity')

    @_deprecate_arg('entity', 'globe_item')
    def __init__(self, lat, lon, alt=None, precision=None, globe=None,
                 typ='', name='', dim=None, site=None, globe_item=None):
        """
        Represent a geo coordinate.

        @param lat: Latitude
        @type lat: float
        @param lon: Longitude
        @type lon: float
        @param alt: Altitude? TODO FIXME    <----
        @param precision: precision
        @type precision: float

I'm not sure what to do with this field in JSON. Can I just ignore this field in any case? Thanks.

p.s.

I'm not quite sure where I should go if I were to have some general Wikibase (API) questions. Could you please give me some guidance? Thanks :-)

Event Timeline

CXuesong created this task.Oct 3 2017, 4:23 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 3 2017, 4:23 AM

I'm not quite sure where I should go if I were to have some general Wikibase (API) questions. Could you please give me some guidance? Thanks :-)

Please see the "Contact" section on https://www.wikidata.org/wiki/Wikidata:Main_Page

I'm not quite sure where I should go if I were to have some general Wikibase (API) questions. Could you please give me some guidance? Thanks :-)

Please see the "Contact" section on https://www.wikidata.org/wiki/Wikidata:Main_Page

Oops. Haven't even thought of that before. Thanks Aklapper.

Jeroen De Dauw replied in the mailing list:
It is not in use and never really was. (Code indicating it is not in use:
https://github.com/DataValues/Geo/blob/2d8e852d04318b13bd0db39b24afe7c56c61dc3e/src/Values/GlobeCoordinateValue.php#L193-L195
)
I'm not entirely sure why it is still in the API output and what the plans
with it are, but my guess is that it is still there for compatibility
reasons and that there is no intention of using this key in the future. If
I where creating an API client I'd just ignore this key.

Okay so I guess I will just ignore this field.

CXuesong closed this task as Resolved.Oct 15 2017, 6:17 AM
CXuesong claimed this task.