Skip to content

Add support for marker-color GeoJSON property#849

Merged
JeroenDeDauw merged 1 commit intomasterfrom
marker-color-support
Apr 2, 2026
Merged

Add support for marker-color GeoJSON property#849
JeroenDeDauw merged 1 commit intomasterfrom
marker-color-support

Conversation

@JeroenDeDauw
Copy link
Copy Markdown
Member

@JeroenDeDauw JeroenDeDauw commented Apr 1, 2026

  • Implements the marker-color property from the simplestyle spec for GeoJSON Point features
  • Markers with a marker-color hex value are rendered as colored SVG pin icons
  • Works in #display_map GeoJSON embeds, GeoJSON page view, and the visual editor

Closes #848

image

also works in the editor:
image

Summary by CodeRabbit

  • New Features

    • Added support for the GeoJSON marker-color property in point features for customized map markers.
  • Documentation

    • Updated compatibility information for Maps 12.1.0 with supported PHP (7.4–8.4) and MediaWiki (1.43–1.44) versions.
    • Added Maps 12.1.0 release notes indicating development status.

@JeroenDeDauw JeroenDeDauw marked this pull request as ready for review April 1, 2026 23:08
@JeroenDeDauw JeroenDeDauw mentioned this pull request Apr 1, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Warning

Rate limit exceeded

@JeroenDeDauw has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 17 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 17 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1fabea71-54c3-4c98-b754-0315f42d9535

📥 Commits

Reviewing files that changed from the base of the PR and between 6987845 and cad30c0.

📒 Files selected for processing (6)
  • INSTALL.md
  • RELEASE-NOTES.md
  • extension.json
  • resources/leaflet/FeatureBuilder.js
  • resources/leaflet/GeoJson.js
  • resources/leaflet/LeafletEditor.js
📝 Walkthrough

Walkthrough

This pull request adds support for the GeoJSON marker-color property per the simplstyle specification. The implementation includes documentation updates, version adjustment, new color icon generation logic in the leaflet resources, and integration of marker color rendering across feature builders.

Changes

Cohort / File(s) Summary
Documentation Updates
INSTALL.md, RELEASE-NOTES.md
Added Maps 12.1.x compatibility table and release notes for marker-color support; removed marker-color from unsupported properties list in Maps 7.12.0 documentation; adjusted formatting in compatibility table.
Version Management
extension.json
Updated manifest version from 13.0.0-alpha to 12.1.0-alpha.
GeoJSON Color Support
resources/leaflet/GeoJson.js
Introduced createColoredIcon(L, color) to validate hex colors and generate SVG-based Leaflet icons via data URLs; added pointToLayer(feature, latlng) to extract marker-color from feature properties and apply colored icons; wired pointToLayer into newGeoJsonLayer options.
Marker Rendering Integration
resources/leaflet/FeatureBuilder.js, resources/leaflet/LeafletEditor.js
Modified point-to-layer handlers to create markers first, read optional marker-color from feature properties, apply colored icons when available via setIcon(), and add to layer; integrated pointToLayer into GeoJSON layer creation options.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding support for the marker-color GeoJSON property to enable colored markers.
Linked Issues check ✅ Passed The PR fully addresses issue #848 by implementing marker-color property support for GeoJSON Point features, enabling the ability to display differently colored markers as previously available.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing marker-color support: documentation updates (INSTALL.md, RELEASE-NOTES.md), version bump (extension.json), and marker color rendering logic across GeoJSON/editor modules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch marker-color-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@resources/leaflet/FeatureBuilder.js`:
- Around line 153-166: The code assumes feature.properties exists when building
point markers (in the createMarker call and when reading
feature.properties['marker-color']), which throws if properties is
null/undefined; update the point rendering in FeatureBuilder.js to guard by
using a safe properties object (e.g., const props = feature.properties || {}) or
optional chaining before passing values to createMarker and to
maps.leaflet.GeoJson.popupContentFromProperties, and use props['marker-color']
when creating the colored icon (ensure title/text defaulting to '' when absent).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b429166-9823-4b99-b6f1-d32b3579d638

📥 Commits

Reviewing files that changed from the base of the PR and between 77a0d7a and 6987845.

📒 Files selected for processing (6)
  • INSTALL.md
  • RELEASE-NOTES.md
  • extension.json
  • resources/leaflet/FeatureBuilder.js
  • resources/leaflet/GeoJson.js
  • resources/leaflet/LeafletEditor.js

Comment on lines +153 to +166
let marker = createMarker(
{
lat: latlng.lat,
lon: latlng.lng,
title: feature.properties.title || '',
text: maps.leaflet.GeoJson.popupContentFromProperties(feature.properties),
icon: ''
},
options
);

let color = feature.properties && feature.properties['marker-color'];
if (color) {
let icon = maps.leaflet.GeoJson.createColoredIcon(L, color);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Guard against null/absent feature.properties in point rendering.

Line 157 and Line 158 can throw when a Point feature has properties: null (or missing), which can break marker rendering for the layer.

💡 Suggested fix
 				pointToLayer: function(feature, latlng) {
+					let properties = feature.properties || {};
 					let marker = createMarker(
 						{
 							lat: latlng.lat,
 							lon: latlng.lng,
-							title: feature.properties.title || '',
-							text: maps.leaflet.GeoJson.popupContentFromProperties(feature.properties),
+							title: properties.title || '',
+							text: maps.leaflet.GeoJson.popupContentFromProperties(properties),
 							icon: ''
 						},
 						options
 					);
 
-					let color = feature.properties && feature.properties['marker-color'];
+					let color = properties['marker-color'];
 					if (color) {
 						let icon = maps.leaflet.GeoJson.createColoredIcon(L, color);
 						if (icon) {
 							marker.setIcon(icon);
 						}
 					}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let marker = createMarker(
{
lat: latlng.lat,
lon: latlng.lng,
title: feature.properties.title || '',
text: maps.leaflet.GeoJson.popupContentFromProperties(feature.properties),
icon: ''
},
options
);
let color = feature.properties && feature.properties['marker-color'];
if (color) {
let icon = maps.leaflet.GeoJson.createColoredIcon(L, color);
pointToLayer: function(feature, latlng) {
let properties = feature.properties || {};
let marker = createMarker(
{
lat: latlng.lat,
lon: latlng.lng,
title: properties.title || '',
text: maps.leaflet.GeoJson.popupContentFromProperties(properties),
icon: ''
},
options
);
let color = properties['marker-color'];
if (color) {
let icon = maps.leaflet.GeoJson.createColoredIcon(L, color);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@resources/leaflet/FeatureBuilder.js` around lines 153 - 166, The code assumes
feature.properties exists when building point markers (in the createMarker call
and when reading feature.properties['marker-color']), which throws if properties
is null/undefined; update the point rendering in FeatureBuilder.js to guard by
using a safe properties object (e.g., const props = feature.properties || {}) or
optional chaining before passing values to createMarker and to
maps.leaflet.GeoJson.popupContentFromProperties, and use props['marker-color']
when creating the colored icon (ensure title/text defaulting to '' when absent).

Implements the marker-color property from the simplestyle spec for
GeoJSON Point features. Markers with a marker-color property are
rendered as colored SVG pin icons. The color value is validated as
a hex color to prevent SVG injection.

Closes #848
@JeroenDeDauw JeroenDeDauw force-pushed the marker-color-support branch from 6987845 to cad30c0 Compare April 2, 2026 17:02
@JeroenDeDauw JeroenDeDauw merged commit df56b47 into master Apr 2, 2026
10 checks passed
@JeroenDeDauw JeroenDeDauw deleted the marker-color-support branch April 2, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different icons

1 participant