diff --git a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts index fdec33c..85accfa 100644 --- a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts @@ -215,6 +215,8 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements } getDisplayTextForFeature(feature: Feature, propertiesToShow: string[], overrule: style.Text = null, zoom: { min: number, current: number } = null): style.Text { + if (!feature) return null; + if (feature.get('itemType') !== 'vnd.farmmaps.itemtype.cropfield') return null; if (!propertiesToShow) return null; if (propertiesToShow.length <= 0) return null; if (zoom && zoom.current > zoom.min) return null; @@ -226,7 +228,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements case "area": value = formatNumber(value, this.locale, '0.1-2') + 'ha'; break; case "centroid": value = feature.getGeometry() ? getCenter(feature.getGeometry().getExtent()) : null; break; } - displayText += value + (i < propertiesToShow.length ? '\n': ''); + if (value) { + displayText += value + (i < propertiesToShow.length ? '\n' : ''); + } } const styleText = new style.Text({