Page MenuHomePhabricator

White screen with red dot shown instead of map when using geoline/geoshape with specified coordinates
Open, Needs TriagePublic

Description

Steps to reproduce
  1. Create a mapframe map using a geoline or geoshape, specifiying latitude and longitude (but not zoom) in the tag attributes, e.g.
<mapframe frameless="1" align="center" longitude="16.524127" latitude="49.170653" height="200" width="290">{"properties":{"stroke-width":6,"stroke":"#ff0000","title":"ExpandTemplates"},"type":"ExternalData","service":"geoline","ids":"Q515443"}</mapframe>
  1. Save the page
  2. Click on the static thumbnail to open the fullscreen map

Or try the examples at https://en.wikipedia.org/wiki/User:Evad37/Sandbox/Mapframe_test

Actual results

The fullscreen map starts to open as normal, but the neither the background map nor the geoline/geoshape are actually displayed. Instead, a white screen is displayed with a small red dot in the center.

Expected results

The map should load and be visible to the user, along with the geoline/geoshape feature. Some default level should be used for the zoom (i.e. somewhere in the middle, not completely zoomed in nor completely zoomed out).

Notes
  • If latitude, longitude and zoom attributes are provided, everything works as expected
  • If latitude, longitude and zoom attributes are all omitted, everything works as expected, (with automatically determined appropriate values)
  • Separately, there is the issue how English Wikipedia's Module:Mapframe handles coordinates not being provided, and in what circumstances it retrieves values from Wikidata items, (since that was part of the cause of the initially report) -- but that can be resolved on-wiki.
  • At the very least, there should be an explicit error message, rather than this white-screen-of-death.

Event Timeline

Kozuch created this task.Jul 7 2019, 10:57 AM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptJul 7 2019, 10:57 AM
Kozuch renamed this task from Wikimedia maps does not display wikidata item (using Template:Maplink) to Wikimedia map does not display wikidata item (using Template:Maplink).Jul 7 2019, 10:57 AM
Kozuch updated the task description. (Show Details)
Kozuch updated the task description. (Show Details)Jul 7 2019, 11:01 AM
This comment was removed by Aklapper.
This comment was removed by Aklapper.
Pikne added a subscriber: Pikne.EditedJul 11 2019, 7:25 AM

That seems to be due to the way template/module is implemented on Wikipedia. The template apparently expects frame-lat, frame-long and zoom parameters to work properly. Template documentation suggests that without these parameters it tries to do something with coordinates from Wikidata, but it seems to fail for this specific use case.

There is an auto-positioning feature which the template apparently doesn't implement (or it doesn't when Wikidata item has coordinates). It was enabled in last November and doesn't seem to be documented on mediawiki.org either yet. Using this the following syntax should also result in the desired result:

<mapframe width="290" height="200" frameless="1" align="center">{"type":"ExternalData","service":"geoline","ids":"Q515443"}</mapframe>

@Pikne Thanks for your comment. The <mapframe> code you suggest works for me. I am looking at the enwiki:Template:Maplink - it calls {{#invoke:Mapframe|main}} which passes all parameters to Mapframe's main function. I will not be able to fix this template and it is also locked for me. I will try to create my own template bypassing this Maplink's "bug" using your code.

And yes, I found out that when wikidata item has "coordinate location" property (P625) then the bug exists. There is a nice example of the bug here:

This works properly (no P625 on wd):
https://en.wikipedia.org/w/index.php?title=Interstate_40_in_New_Mexico&oldid=908083047

These 2 have P625:

  1. Here the thumbnail works properly, but after clicking the big map is blank:

https://en.wikipedia.org/w/index.php?title=Interstate_40_in_Arizona&oldid=908082859

  1. Here the thumbnail is half wrong (probably due to coordinate position???):

https://en.wikipedia.org/w/index.php?title=Interstate_40_in_California&oldid=908082850

And yes, I just identified a problem with the "zoom" parameter. When I leave it out for example in the map in https://en.wikipedia.org/wiki/Alabama, there is same problem (blank map with dot). I suspect again P625 is the problem.

The same problem (after removing zoom): https://en.wikipedia.org/wiki/Pinelands_National_Reserve

I want to leave zoom out because after clicking I dont want the same zoom in the big map. Without zoom parameter specified the big map zooms to the object.

Evad37 added a subscriber: Evad37.Tue, Jul 30, 3:12 PM

While the module could be updated to use the new auto positioning feature, this is definitely a bug in Kartographer per the following examples (which just use <mapframe> tag directly, not the module):

https://en.wikipedia.org/wiki/User:Evad37/Sandbox/Mapframe_test

For the big maps available after clicking the thumbnails, specifying a latitude and longitude only works if a zoom is also specified, otherwise the white background with the red dot is shown.

Pikne added a comment.EditedTue, Jul 30, 6:46 PM

https://en.wikipedia.org/wiki/User:Evad37/Sandbox/Mapframe_test
For the big maps available after clicking the thumbnails, specifying a latitude and longitude only works if a zoom is also specified, otherwise the white background with the red dot is shown.

Auto-positioning to my understanding is designed to be calculated based on GeoJSON overlay objects. It probably isn't intended to work with latitude/longitude specified. Note here suggests that with latitude/longitude specified zoom was required earlier as well. If zoom isn't optional in this case then displaying an explicit error message would be nice, of course.

Evad37 added a comment.EditedTue, Jul 30, 11:18 PM

Previously not specifying latitude/longitude/zoom used default values, which in most cases weren't appropriate, but at least showed a map that could be interacted with. In any case, the current behaviour is not desirable - either a default zoom should be used if latitude and longitude are provided without a specified zoom, or there should be an error message provided.

Kozuch added a comment.Fri, Aug 2, 8:54 PM

@Evad37 Thanks for your examples - they show the issue nicely. I agree that this should be solved in Kartographer. However as I am not willing to wait for such solution, I created a clone of your Module:Mapframe to work around this bug. The new module and template for its use are here:

https://en.wikipedia.org/wiki/Module:MapframeForObjects
https://en.wikipedia.org/wiki/Template:MapframeForObjects

I created simple docs for both explaining the problem and linking to this bug.

In the module code I simply commented out the lines where coords are being fetched from wikidata when no lat/lon is supplied. The comment begins with this line:

if not attribs.latitude and not attribs.longitude then

I hope there will be no problems with using the new module/template. After Kartographer is fixed this new template can be redirected to Template:Maplink (given the new template will remain compatible with Maplink's parameters).
Thank you both for your help.

Pikne added a comment.Fri, Aug 2, 9:26 PM

After Kartographer is fixed this new template can be redirected to Template:Maplink (given the new template will remain compatible with Maplink's parameters).

I doubt if there is a viable Kartographer/Kartotherian fix to your use case. If centre coordinates are entered (or retrieved from Wikidata) then these coordinates should probably still be respected as centre coordinates and map shouldn't be expected to centre differently.

Evad37 added a comment.Sat, Aug 3, 2:45 AM

I doubt if there is a viable Kartographer/Kartotherian fix to your use case. If centre coordinates are entered (or retrieved from Wikidata) then these coordinates should probably still be respected as centre coordinates and map shouldn't be expected to centre differently.

It would be nice if that could happen rather than the single red dot in the center of a white screen. The templates/modules should be able to take care of the rest (deciding when to set or not set coords in the tag attributes).

Evad37 renamed this task from Wikimedia map does not display wikidata item (using Template:Maplink) to White screen with red dot shown instead of map when using geoline/geoshape with specified coordinates.Sat, Aug 3, 7:33 AM
Evad37 updated the task description. (Show Details)

@Evad37 Thanks for editing the ticket description for the one specific case that I reported. However I found one more different issue when Wikidata object is not shown (but looks differently than blank map with red dot) - please see this page https://en.wikipedia.org/w/index.php?title=Module_talk:Mapframe&oldid=909143520 in section

Bug - does not ignore wd coordinates for type=line

for details. There are 2 more issues:

  1. No object is drawn when the linked OSM relation contains only sub-relations. Example: Interstate 5
  2. Minor issue is that type=line does not work for all type=shape objects (I do not want the infill on shape)