HandsOnDataViz/leaflet-storymaps-with-google-sheets

should we standardize our list of GeoJSON feature properties?

Closed this issue · 2 comments

Hi @ilyankou -- As I'm finishing Chapter 13, I'm looking back at our Aug 14th emails and am trying to recall if it's feasible or advisable to standardize our list of feature.properties for displaying overlays based on the original GeoJSON file.

feature.properties.weight
color
opacity
fillColor
fillOpacity

Based on the emails below, I recall we agreed this was not a broad, urgent need. But if it's just a matter of standardizing our list, it would be a great way to show in the soon-to-be updated demo storymap and chapter text how users can set the properties inside their GeoJSON files when creating them, which is great for displaying complex ones such as choropleth maps.

Let me know what you think. Here's the relevant emails from August (with some updated links):

I tried inserting “props.fill” and could not make it work. But then I inserted “feature.properties.fillColor” at the front of the list, and it worked perfectly.
See https://github.com/HandsOnDemo/storymap4/blob/main/scripts/storymap.js#L341

Jack

On Aug 14, 2020, at 11:55 AM, Ilya Ilyankou ilyankou@gmail.com wrote:

The property needs to be called COLOR or fillColor (see https://github.com/HandsOnDataViz/leaflet-storymaps-with-google-sheets/blob/master/scripts/storymap.js#L328 ), but now when I think about it, "fill" makes more sense, just like "stroke".

This:
fillColor: feature.properties.COLOR || props.fillColor || 'white',

means the tool will first try COLOR, if value is not found, it will move to fillColor, and if that's not found, then defaults to 'white'. You should be able to add another value (props.fill) in the chain.

@JackDougherty

Thanks for getting back to this. See my commit. The priority in styling is now given to the features of polygons (both regular overlays which can be GeoJSON, and GeoJSON overlays), which is spelled exactly as Leaflet's styling options.