kepler.gl icon indicating copy to clipboard operation
kepler.gl copied to clipboard

[Enhancemen] Export Map (maplegend and locale) as HTML

Open lixun910 opened this issue 3 years ago • 0 comments

This PR is for the issue https://github.com/keplergl/kepler.gl/issues/1585 (display map legend on an exported map). There is a workaround for this issue that requires user to update the exported HTML file. However, this seems like a reasonable feature enhancement request for the “Export Map as HTML” feature:

  1. when exporting a map to a HTML file, uiState of mapLegend and map locale should be saved in config.
  2. when loading config via addDataToMapUpdater(), the uiState of mapLegend and map locale should be loaded and used as default.

What's added and changed in this PR:

  1. Add a new uiStateSchema class in src/schemas/ui-state-schema.js

  2. Add above uiStateSchema in reducerSchema in src/schemas/schema-manager.js, so the meta data of locale and mapControls:mapLegend in uiState can be saved and loaded via Schema Manager

  3. Since the mapLegend and locale in uiState can be added in JSON configuration, the addDataToMap action should be updated (src/reducers/combined-updaters.js) so customized mapLegend (on/off) and locale can be loaded as default.

  4. Test case #uiStateSchema -> v1 -> save load uiState in test/node/schemas/ui-state-schema-test.js

  5. Test case #composerStateReducer - addDataToMapUpdater: mapLegend in test/node/reducers/composer-state-test.js

  6. Test case #composerStateReducer - addDataToMapUpdater: locale in test/node/reducers/composer-state-test.js

Example: an exported map with Legend switched ON and locale with Spanish(ES) Screen Shot 2021-08-31 at 4 08 40 PM

lixun910 avatar Sep 01 '21 04:09 lixun910