name: geojson-and-data
description: "Render GeoJSON, TopoJSON, and choropleths in Folium with stable
identifiers, correct coordinate order, and validated data bindings."
disable-model-invocation: true
metadata:
disco-role: operating
license: NOASSERTION
GeoJSON and data
Use this sub-skill when you need Folium's geospatial data surfaces: GeoJson, TopoJson, Choropleth, GeoJsonTooltip, GeoJsonPopup, ClickForMarker, ClickForLatLng, or JsCode callbacks tied to GeoJson.
Use when
- the input is GeoJSON, TopoJSON, a
__geo_interface__ object, or a GeoPandas GeoDataFrame
- tabular values must be joined to shapes for a choropleth
- feature-level styling, highlighting, tooltips, popups, or JavaScript callbacks are needed
- point geometries need
marker=... customization inside GeoJson
- coordinate-order issues or missing identifiers need render-time diagnosis
Route elsewhere
- base maps, tile selection, layer composition, and non-GeoJSON overlays ->
../map-and-layers/SKILL.md
- Search, Timeline, TimestampedGeoJson, Realtime, VectorGrid, and similar plugin workflows ->
../plugins/SKILL.md
- upstream GIS cleaning, topology repair, or CRS surgery beyond Folium's render contract -> keep that upstream
Working order
- Normalize the input form and confirm the geometry surface.
- Check coordinate order: Folium map and marker inputs are
[lat, lon]; GeoJSON coordinates are [lon, lat].
- Choose
GeoJson, TopoJson, or Choropleth.
- Decide the join key (
id, properties.*, or key_on) before styling.
- Attach
GeoJsonTooltip and GeoJsonPopup only after confirming the property fields exist.
- Use
JsCode for on_each_feature when Python callbacks are not enough.
- Validate missing values, bins, and legend behavior before handoff.
Bundled references
Bundled script
Quick reminders
GeoJson accepts dicts, JSON strings, file paths, URLs, and objects with __geo_interface__; if to_crs exists, Folium reprojects to EPSG:4326 before rendering.
TopoJson needs an object path such as objects.counties.
Choropleth expects table keys to match key_on; bins can be an integer or an explicit edge list.
ClickForMarker and ClickForLatLng are map helpers, not GeoJson.marker types.
- For loop-built
style_functions, bind loop variables early (style=style) to avoid late-binding closure bugs.
- If
embed=False, keep the source as a URL or file path and provide data that can already behave as a FeatureCollection for styling.
ClickForLatLng is useful when diagnosing swapped coordinate order because it reports clicked map coordinates in Folium's [lat, lon] order.