Fix: Support des géométries null
This commit is contained in:
parent
ec01a88adb
commit
e9c3322e16
1 changed files with 5 additions and 3 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue