Skip to content

pointToLayer missing return in FeatureBuilder.js causes GeoJSON points to be excluded from bounds #863

@JeroenDeDauw

Description

@JeroenDeDauw

Written by Claude Code, Opus 4.6. Result of code review with @JeroenDeDauw. Context: the Maps extension codebase.

Issue

In resources/leaflet/FeatureBuilder.js, the pointToLayer callback in newGeoJsonLayer (lines 152-173) creates a marker and adds it to markerLayer, but never returns it. Leaflet receives undefined, so Point features are excluded from the GeoJSON layer bounds. This causes auto-zoom/fitContent to ignore point-only GeoJSON data.

Steps to reproduce

  1. Create a GeoJSON page with only Point features
  2. Display it on a map with fitContent (the default)
  3. The map does not zoom to fit the points

Expected behavior

The map should auto-zoom to fit all GeoJSON features including Point features.

Root cause

The pointToLayer callback must return the created marker for Leaflet to include it in the layer's bounds calculation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions