digidem / react-mapfilter

Visualizing, exploring, filtering and printing geographic data and geotagged photos and video
https://lab.digital-democracy.org/mapfilter
29 stars 11 forks source link

Printable reports (and other miscellany) #56

Closed mojodna closed 4 years ago

mojodna commented 7 years ago

This implements the "report" page along with print CSS for it, re-using the existing MapView and FeatureModal components (with some necessary modifications).

When 62 or fewer ([A-z0-9]) features are displayed, their markers are labeled on the map and associated with the marker icon on their individual page.

Filters are also persisted in the URL and are retained when switching tabs.

This also throws in a .nvmrc (for node-6.x) and an ESLint config (I use it with Atom).

gmaclennan commented 7 years ago

@mojodna this is looking great! thanks for the work on this. Some comments:

mojodna commented 7 years ago

For some reason some icons are not appearing on the map.

I was noticing that. Making them all the same color seems to resolve that (so it may be the result of "missing" markers, which could be causing other data to be missing elsewhere).

Thoughts on how to force them to all be the same color / why it's not filtering on happening (which should achieve the same thing)?

https://github.com/digidem/mapfilter/pull/56/files#diff-83418c5c1bc6a57e2dad4fbf90122b1fR69

mojodna commented 7 years ago

starting in Map view and switching to report view causes chrome to lock up

It's not the map, fortunately. Something is triggering aggressive re-rendering that I need to track down.

gmaclennan commented 7 years ago

I’ll have a look at the icons / coloring a bit later this afternoon (have some calls first). The coloring was always a little fragile. Mapbox-gl-js wants icons as PNGs, and rendering them as SVG would be a performance hit. We're waiting on https://github.com/mapbox/mapbox-gl-js/issues/2059 to land to be able to dynamically add icons and not have a dependency on a specific mapbox style that needs to be kept in sync with the color list. Anyway, I'll investigate because I remember some of the hackiness to make this work.

mojodna commented 7 years ago

I'm spinning my wheels pretty hard on reintroducing labeling. The fundamental problem is that MapView expects geojson (which is unfiltered, augmented with __mf_id and __mf_color) and the list of FeatureModals expects individual features. Since I only want to display filtered features, I'm working from the features array (which is filtered, but not augmented).

Passing features (after being munged into a GeoJSON FeatureCollection) that have had labels applied to them into the MapView works, but the coloring disappears. This is what was happening prior to fcd64e2e66a461f499c27c8a06d8f37407cdd337, but that had memoization issues and labels that should have all been the same color weren't.

At one point I was adding labels to both features and geojson (split by colored field), but the ordering ends up varying (it shouldn't, but it seems to) between the 2 lists.

okdistribute commented 4 years ago

This seems to be stale!