Fix: Support des géométries null

This commit is contained in:
EpicKiwi 2026-06-09 10:26:20 +02:00
parent ec01a88adb
commit e9c3322e16
Signed by: epickiwi
GPG key ID: C4B28FD2729941CE

View file

@ -108,6 +108,11 @@ export class PlaceDatabase extends EventTarget {
console.warn(`Warning: a feature with ID "${feature.id}" already exists in database`) console.warn(`Warning: a feature with ID "${feature.id}" already exists in database`)
} }
if(!feature.geometry){
console.warn(`Geometry ${feature.id} does not have a geometry, it will not be included`)
return
}
this.featuresById[feature.id] = feature this.featuresById[feature.id] = feature
let event = new Event("newfeature") let event = new Event("newfeature")
@ -244,9 +249,6 @@ export class MapFeature {
asPoint(){ asPoint(){
if(!this[POINT_FEATURE]){ if(!this[POINT_FEATURE]){
if(!this.geometry){
debugger;
}
if(this.geometry.type != "Point"){ if(this.geometry.type != "Point"){
let point_feature = turf.centerOfMass(this) let point_feature = turf.centerOfMass(this)
point_feature.properties = this.properties point_feature.properties = this.properties