Page MenuHomePhabricator

[beta cluster] Uncaught TypeError: Cannot read property 'lat' of null - when 'Edit layer' option is used.
Closed, ResolvedPublic

Description

  1. Add a map to a page, e.g.
<mapframe latitude="46.725" longitude="7.668" zoom="8" width="350" height="300" />
  1. In VE open the map for editing. Use options "Draw a polygon" and "Draw a rectangle" to add elements to a map.
  2. When a polygon or a rectangle are added, "Edit layers" option becomes active. Click on it - the error will be displayed:
Uncaught TypeError: Cannot read property 'lat' of null
    at Object.project 
    at Object.latLngToPoint 
    at NewClass.project
    at NewClass._getMiddleLatLng 
    at NewClass._createMiddleMarker 
    at NewClass._initMarkers
    at NewClass.addHooks 
    at NewClass._eachVertexHandler 
    at NewClass.addHooks

Event Timeline

Please provice a bit more information on what you were doing, which wiki in beta you specifically used, what part of the software you're refering to or what the 'edit layer' option is. See also https://www.mediawiki.org/wiki/How_to_report_a_bug

@EddieGP - sorry, I didn't realize that I haven't added the content when I was creating the ticket.

Vvjjkkii renamed this task from [betalabs] Uncaught TypeError: Cannot read property 'lat' of null - when 'Edit layer' option is used. to 75caaaaaaa.Jul 1 2018, 1:11 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from 75caaaaaaa to [betalabs] Uncaught TypeError: Cannot read property 'lat' of null - when 'Edit layer' option is used. .Jul 2 2018, 4:19 PM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.
Mholloway renamed this task from [betalabs] Uncaught TypeError: Cannot read property 'lat' of null - when 'Edit layer' option is used. to [beta cluster] Uncaught TypeError: Cannot read property 'lat' of null - when 'Edit layer' option is used. .Sep 18 2018, 3:40 PM
matmarex subscribed.

I ran into this issue when working on T203473 and debugged it for a bit. Looks like we're using an old version of Leaflet.draw (0.2.5 with some local hacks) meant for Leaflet 0.7, while we're actually using Leaflet 1.0.2. This bug is fixed by https://github.com/Leaflet/Leaflet.draw/commit/48b8297dd2e39509d84cf5efaf4ee9f3d34252b7 upstream in Leaflet.draw 0.4.0.

Change 468504 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/Kartographer@master] Update Leaflet.draw to v1.0.3

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

Change 468504 merged by jenkins-bot:
[mediawiki/extensions/Kartographer@master] Update Leaflet.draw to v1.0.3

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