Error while drawing a polygon, edition or deleting.
See original GitHub issueHello, I don’t kow if the problem comes from my code but every time I draw a polygon, edit a form or delete one I’ve got got this error :
leaflet.draw.js:9 Uncaught TypeError: Cannot read property ‘updatePosition’ of null
After that if I zoom in or out, my polygon never updates it’s size.
Here is my code:
angular.module('myApp.view1', ['ngRoute', 'leaflet-directive'])
.controller('View1Ctrl', ["$scope", "leafletData", function ($scope, leafletData) {
var drawnItems = new L.FeatureGroup();
var options = {
edit: {
featureGroup: drawnItems
},
draw: {
polyline: false,
marker: false,
polygon: {
shapeOptions: {
color: 'purple'
}
},
circle: {
shapeOptions: {
stroke: true,
weight: 4,
color: 'blue',
opacity: 0.5,
fill: true,
fillColor: null, //same as color by default
fillOpacity: 0.2,
clickable: true
}
}
},
showRadius: true
}
var drawControl = new L.Control.Draw(options);
angular.extend($scope, {
defaults: {
scrollWheelZoom: false
},
london: {
lat: 51.505,
lng: -0.09,
zoom: 8
},
controls: {
custom: [drawControl]
}
});
leafletData.getMap().then(function (map) {
map.addLayer(drawnItems);
map.on('draw:created', function (e) {
var type = e.layerType,
layer = e.layer;
if (type == "polygon") {
console.log("polygon " + JSON.stringify(layer.toGeoJSON()));
}
if (type === 'circle') {
console.log(JSON.stringify(layer.toGeoJSON()));
}
drawnItems.addLayer(layer);
});
});
}]);
Thank you for the help
Issue Analytics
- State:
- Created 8 years ago
- Comments:20 (5 by maintainers)
Top Results From Across the Web
Polygon lines and attributes disappearing after ed...
Hello, I am having an issue with ARCGIS pro. ... Polygon lines and attributes disappearing after editing or drawing.
Read more >Error while trying to delete/edit shape using leaflet draw - ESRI
I get the following error when trying to edit the shape created. I'm using leaflet 1.0-rc1 and leaflet draw version 0.3.2. enter image ......
Read more >Common errors that may occur during editing—Help
Errors that may occur when you start editing · Projected coordinate systems · Coordinates or measures are out of bounds · The spatial...
Read more >Create Polygon Topology - Set Error Markers dialog box
Use this dialog box to specify how to mark errors in your polygon topology. If you mark errors with blocks, specify the size,...
Read more >Fix Google Earth errors
Select the problem you'd like to fix. Repair problems with Google Earth Pro To more easily do things like clear your cache or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I tried using existing geojson on map and I get cannot get ‘lat’ of undefined: https://jsfiddle.net/Lscupxqp/31/
I have the exact same issue as @themre. Has this been addressed in another thread?
Edit: Upgraded from v0.2.3 to v0.4.10, seems like the bug was addressed and fixed