Page MenuHomePhabricator

Geojson object on -180/180 longitude draws incorrect view
Closed, ResolvedPublic

Description

This geojson was part of the incorrectly generated GeoJSON produced from geoshapes service for Q30 (USA). I don't know if this should be generated differently, or the PostGIS 2.1.4 has this issue, or if geojson->topojson->geojson introduces this bug. The data was originally received from https://maps.wikimedia.org/geoshape?ids=Q30&arg1=0.0001

<mapframe width=500 height=500>
{"type":"FeatureCollection","features":[{"type":"Feature","id":"Q30","properties":{},"geometry":{"type":"MultiPolygon","coordinates":[[[
[179.17191719171916,51.95410615498813],
[179.17191719171916,52.04911690100564],
[179.24392439243928,52.12685296592907],
[179.53195319531955,52.230501052493615],
[179.7839783978398,52.230501052493615],
[-180,52.13549030647611],
[-179.92799279927993,52.06639158209973],
[-179.8919891989199,51.98001817662928],
[-179.92799279927993,51.867732749517664],
[-180,51.78999668459425],
[179.74797479747974,51.70362327912378],
[179.5679567956796,51.68634859802969],
[179.35193519351935,51.74680998185902],
[179.20792079207922,51.84182072787653],
[179.17191719171916,51.95410615498813]
]]]}}]}</mapframe>

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Apparently this is a well known GIS issue, called "crossing the date line", or "antimeridian" . See also https://github.com/Leaflet/Leaflet/pull/1293 - very long Leaflet discussion.

Change 309408 had a related patch set uploaded (by Yurik):
Fix antimeridian wraparound in leaflet for ext data

https://gerrit.wikimedia.org/r/309408

Change 309478 had a related patch set uploaded (by Yurik):
Switch to geojson for geoshapes srv

https://gerrit.wikimedia.org/r/309478

Change 309481 had a related patch set uploaded (by Yurik):
Switch to geojson for geoshapes srv

https://gerrit.wikimedia.org/r/309481

Change 309478 merged by jenkins-bot:
Switch to geojson for geoshapes srv

https://gerrit.wikimedia.org/r/309478

Change 309481 merged by jenkins-bot:
Switch to geojson for geoshapes srv

https://gerrit.wikimedia.org/r/309481

Mentioned in SAL [2016-09-08T23:41:38Z] <dereckson@tin> Synchronized php-1.28.0-wmf.18/extensions/Kartographer/modules/box/Map.js: Switch to geojson for geoshapes srv (T144777) (duration: 00m 48s)

Even though we fixed the immediate problem, this issue highlights the underlying problem with the GeoJSON->TopoJSON->GeoJSON conversion and the lack of the proper leaflet's support

Change 309408 abandoned by Sbisson:
Fix antimeridian wraparound in leaflet for ext data

Reason:
This change doesn't seem to be under active development. Please restore if I'm mistaken.

https://gerrit.wikimedia.org/r/309408

WMDE-Fisch subscribed.

This will need rechecking.

When adding a map using the following code I get a funcitonal static map and can also access the dynamic map where I get a working result. So from that perspective the service endpoint gives valid data. ( Differently as described in the ticket description ). There are still obvious flaws when displaying the shape on the live map due to the shape crossing the anti-meridian but these things are covered somewhere else already. I'll consider the issue described here resolved.

<mapframe width=700 height=350>
{
  "type": "ExternalData",
  "service": "geoshape",
  "ids": "Q30"
}
</mapframe>