Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] Save custom reducer initialState, add custom-reducer example (#159)
Shan He25e18b054c93
diff --git a/examples/custom-reducer/.babelrc b/examples/custom-reducer/.babelrcnew file mode 100644index 000000000..12903c39b--- /dev/null+++ b/examples/custom-reducer/.babelrc@@ -0,0 +1,7 @@+{+ "presets": [+ "babel-preset-es2015",+ "babel-preset-react",+ "babel-preset-stage-0"+ ]+}diff --git a/examples/custom-reducer/README.md b/examples/custom-reducer/README.mdnew file mode 100644index 000000000..8388e7aab--- /dev/null+++ b/examples/custom-reducer/README.md@@ -0,0 +1,24 @@+# Cusomize kepler.gl Reducer++This example demos how to customize kepler.gl reducer+ 1. Customize reducer initialState by `keplerGlReducer.initialState`+ 2. Adding custom actions by `keplerGlReducer.plugins`++### Local dev+```+npm install+```+or+```+yarn --ignore-engines+```++add mapbox access token to node env+```+export MapboxAccessToken=<your_mapbox_token>+```++then+```+npm start+```diff --git a/examples/custom-reducer/index.html b/examples/custom-reducer/index.htmlnew file mode 100644index 000000000..f3daab553--- /dev/null+++ b/examples/custom-reducer/index.html@@ -0,0 +1,15 @@+<!doctype html>+<html>+ <head>+ <meta charset='UTF-8' />+ <title>kepler.gl demo</title>+ <link href="//d1a3f4spazzrp4.cloudfront.net/uber-fonts/4.0.0/superfine.css" rel="stylesheet">+ <link href="//api.tiles.mapbox.com/mapbox-gl-js/v0.42.0/mapbox-gl.css" rel="stylesheet">+ <style type="text/css">+ body {margin: 0; padding: 0; overflow: hidden;}+ </style>+ </head>+ <body>+ <script src='bundle.js'></script>+ </body>+</html>diff --git a/examples/custom-reducer/package.json b/examples/custom-reducer/package.jsonnew file mode 100644index 000000000..3985d4c4f--- /dev/null+++ b/examples/custom-reducer/package.json@@ -0,0 +1,26 @@+{+ "scripts": {+ "start": "webpack-dev-server --progress --hot --open",+ "start-local": "webpack-dev-server --env.es6 --progress --hot --open",+ "start-local-es5": "webpack-dev-server --env.local --progress --hot --open"+ },+ "dependencies": {+ "global": "^4.3.0",+ "kepler.gl": "^0.0.24",+ "react": "^15.3.1",+ "react-dom": "^15.6.1",+ "react-palm": "^0.8.1",+ "react-redux": "^4.0.0",+ "react-virtualized": "^9.18.5",+ "redux-actions": "^2.2.1"+ },+ "devDependencies": {+ "babel-core": "^6.7.7",+ "babel-loader": "^6.2.10",+ "babel-preset-es2015": "^6.3.13",+ "babel-preset-react": "^6.3.13",+ "babel-preset-stage-0": "^6.24.1",+ "webpack": "^2.4.0",+ "webpack-dev-server": "^2.4.0"+ }+}diff --git a/examples/custom-reducer/src/app-reducer.js b/examples/custom-reducer/src/app-reducer.jsnew file mode 100644index 000000000..d96be1abb--- /dev/null+++ b/examples/custom-reducer/src/app-reducer.js@@ -0,0 +1,43 @@+// Copyright (c) 2018 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import {createAction, handleActions} from 'redux-actions';++// CONSTANTS+export const INIT = 'INIT';++// ACTIONS+export const appInit = createAction(INIT);++// INITIAL_STATE+const initialState = {+ appName: 'example',+ loaded: false+};++// REDUCER+const appReducer = handleActions({+ [INIT]: (state, action) => ({+ ...state,+ loaded: true+ })+}, initialState);++export default appReducer;diff --git a/examples/custom-reducer/src/app.js b/examples/custom-reducer/src/app.jsnew file mode 100644index 000000000..04a414d2c--- /dev/null+++ b/examples/custom-reducer/src/app.js@@ -0,0 +1,76 @@+// Copyright (c) 2018 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React, {Component} from 'react';+import {connect} from 'react-redux';+import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer'+import KeplerGl from 'kepler.gl';+import {createAction} from 'redux-actions';++import {addDataToMap, wrapTo} from 'kepler.gl/actions';+import sampleData from './data/sample-data';+import config from './configurations/config.json';++const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line++// extra actions plugged into kepler.gl reducer (store.js)+const hideAndShowSidePanel = createAction('HIDE_AND_SHOW_SIDE_PANEL');++class App extends Component {+ componentDidMount() {+ this.props.dispatch(+ wrapTo('map1', addDataToMap(+ {+ datasets: sampleData,+ config+ })+ )+ );+ }++ _toggleSidePanelVisibility = () => {+ this.props.dispatch(+ wrapTo('map1', hideAndShowSidePanel())+ );+ };++ render() {+ return (+ <div style={{position: 'absolute', width: '100%', height: '100%'}}>+ <button onClick={this._toggleSidePanelVisibility}> Hide / Show Side Panel</button>+ <AutoSizer>+ {({height, width}) => (+ <KeplerGl+ mapboxApiAccessToken={MAPBOX_TOKEN}+ id="map1"+ width={width}+ height={height}+ />+ )}+ </AutoSizer>+ </div>+ );+ }+}++const mapStateToProps = state => state;+const dispatchToProps = dispatch => ({dispatch});++export default connect(mapStateToProps, dispatchToProps)(App);diff --git a/examples/custom-reducer/src/configurations/config.json b/examples/custom-reducer/src/configurations/config.jsonnew file mode 100644index 000000000..dcb911c69--- /dev/null+++ b/examples/custom-reducer/src/configurations/config.json@@ -0,0 +1,171 @@+{+ "version": "v1",+ "config": {+ "visState": {+ "filters": [],+ "layers": [+ {+ "id": "1s8r5md",+ "type": "point",+ "config": {+ "dataId": "tree_data",+ "label": "location",+ "color": [+ 18,+ 147,+ 154+ ],+ "columns": {+ "lat": "Location_latitude",+ "lng": "Location_longitude",+ "altitude": null+ },+ "isVisible": true,+ "visConfig": {+ "radius": 10,+ "fixedRadius": false,+ "opacity": 0.8,+ "outline": false,+ "thickness": 2,+ "colorRange": {+ "name": "Ice And Fire",+ "type": "diverging",+ "category": "Uber",+ "colors": [+ "#D50255",+ "#FEAD54",+ "#FEEDB1",+ "#E8FEB5",+ "#49E3CE",+ "#0198BD"+ ],+ "reversed": true+ },+ "radiusRange": [+ 33.6,+ 96.2+ ],+ "hi-precision": false+ }+ },+ "visualChannels": {+ "colorField": {+ "name": "Species",+ "type": "string"+ },+ "colorScale": "ordinal",+ "sizeField": {+ "name": "Age",+ "type": "integer"+ },+ "sizeScale": "sqrt"+ }+ },+ {+ "id": "7otjdz",+ "type": "hexagon",+ "config": {+ "dataId": "tree_data",+ "label": "Density",+ "color": [+ 23,+ 184,+ 190+ ],+ "columns": {+ "lat": "Location_latitude",+ "lng": "Location_longitude"+ },+ "isVisible": true,+ "visConfig": {+ "opacity": 0.2,+ "worldUnitSize": 0.8,+ "resolution": 8,+ "colorRange": {+ "name": "ColorBrewer GnBu-6",+ "type": "sequential",+ "category": "ColorBrewer",+ "colors": [+ "#f0f9e8",+ "#ccebc5",+ "#a8ddb5",+ "#7bccc4",+ "#43a2ca",+ "#0868ac"+ ],+ "reversed": false+ },+ "coverage": 1,+ "sizeRange": [+ 0,+ 500+ ],+ "percentile": [+ 0,+ 100+ ],+ "elevationPercentile": [+ 0,+ 100+ ],+ "elevationScale": 5,+ "hi-precision": false,+ "colorAggregation": "average",+ "sizeAggregation": "average",+ "enable3d": false+ }+ },+ "visualChannels": {+ "colorField": null,+ "colorScale": "quantile",+ "sizeField": null,+ "sizeScale": "linear"+ }+ }+ ],+ "interactionConfig": {+ "tooltip": {+ "fieldsToShow": {+ "tree_data": [+ "TreeID",+ "Species",+ "Address",+ "Has_Species",+ "SiteInfo"+ ]+ },+ "enabled": true+ },+ "brush": {+ "size": 0.5,+ "enabled": false+ }+ },+ "layerBlending": "normal",+ "splitMaps": []+ },+ "mapState": {+ "bearing": 0,+ "dragRotate": false,+ "latitude": 37.76544453921235,+ "longitude": -122.46289885132524,+ "pitch": 0,+ "zoom": 12.032736770460689,+ "isSplit": false+ },+ "mapStyle": {+ "styleType": "light",+ "topLayerGroups": {+ "label": true+ },+ "visibleLayerGroups": {+ "label": true,+ "road": true,+ "border": false,+ "building": true,+ "water": true,+ "land": true+ }+ }+ }+}\ No newline at end of filediff --git a/examples/custom-reducer/src/data/sample-data.js b/examples/custom-reducer/src/data/sample-data.jsnew file mode 100644index 000000000..63f0b0e00--- /dev/null+++ b/examples/custom-reducer/src/data/sample-data.js@@ -0,0 +1,2616 @@+// Copyright (c) 2018 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++export default {+ info: {+ label: 'San Francisco Trees',+ id: "tree_data"+ },+ data: {+ fields: [+ {+ name: 'TreeID'+ },+ {+ name: 'Species'+ },+ {+ name: 'Address'+ },+ {+ name: 'Has_Species'+ },+ {+ name: 'SiteInfo'+ },+ {+ name: 'PlantType'+ },+ {+ name: 'PlantDate'+ },+ {+ name: 'Plan'+ },+ {+ name: 'Age'+ },+ {+ name: 'DBH'+ },+ {+ name: 'Location_latitude'+ },+ {+ name: 'Location_longitude'+ }+ ],+ rows: [+ [+ 141565,+ 'Myoporum laetum :: Myoporum',+ '501X Baker St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '7/21/88 0:00',+ 1988,+ 29,+ 21,+ 37.77596769,+ -122.4413967+ ],+ [+ 232565,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '940 Elizabeth St',+ false,+ 'Sidewalk: Curb side : Yard',+ 'Tree',+ '3/20/17 0:00',+ 2017,+ 0,+ 3,+ 37.75171022,+ -122.441498+ ],+ [+ 119263,+ 'Pinus radiata :: Monterey Pine',+ '495X Lakeshore Dr',+ false,+ 'Median : Yard',+ 'Tree',+ null,+ null,+ null,+ null,+ null,+ null+ ],+ [+ 207368,+ 'Ligustrum japonicum :: Japanese Privet',+ '920 Kirkham St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 6,+ 37.76021031,+ -122.4707394+ ],+ [+ 188702,+ 'Acacia melanoxylon :: Blackwood Acacia',+ '1501 Evans Ave',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 17,+ 37.74220867,+ -122.3872932+ ],+ [+ 141566,+ 'Myoporum laetum :: Myoporum',+ '501X Baker St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 14,+ 37.77570453,+ -122.4414629+ ],+ [+ 188697,+ 'Acacia melanoxylon :: Blackwood Acacia',+ '1301 Evans Ave',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 15,+ 37.73973386,+ -122.3829339+ ],+ [+ 122650,+ 'Acer rubrum :: Red Maple',+ '300x Hickory St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/10/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 203507,+ 'Agonis flexuosa :: Peppermint Willow',+ '920 Kirkham St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 23,+ 37.76018051,+ -122.4708661+ ],+ [+ 122670,+ 'Lyonothamnus floribundus subsp. asplenifolius :: Santa Cruz Ironwood',+ '301x Hickory St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/10/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 122658,+ 'Acer rubrum :: Red Maple',+ '300x Hickory St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/10/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 122660,+ 'Acer rubrum :: Red Maple',+ '300x Hickory St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/10/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 122648,+ 'Acer rubrum :: Red Maple',+ '300x Hickory St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/10/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 196590,+ 'Pyrus calleryana :: Ornamental Pear',+ '43 Lafayette St',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 10,+ 37.77303718,+ -122.4172458+ ],+ [+ 196591,+ 'Pyrus calleryana :: Ornamental Pear',+ '43 Lafayette St',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 13,+ 37.77305251,+ -122.4172809+ ],+ [+ 122649,+ 'Acer rubrum :: Red Maple',+ '300x Hickory St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/10/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 145278,+ 'Fraxinus uhdei :: Shamel Ash: Evergreen Ash',+ '730 11th Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/20/17 0:00',+ 2017,+ 0,+ 0,+ 37.77448101,+ -122.4691091+ ],+ [+ 96369,+ 'Lophostemon confertus :: Brisbane Box',+ '168 Cervantes Blvd',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '8/9/11 0:00',+ 2011,+ 6,+ 24,+ 37.80468521,+ -122.4402315+ ],+ [+ 182260,+ "Arbutus 'Marina' :: Hybrid Strawberry Tree",+ '1471 28th Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 5,+ 37.75995923,+ -122.4866885+ ],+ [+ 251179,+ 'Podocarpus gracilor :: Fern Pine',+ '1043 Minna St',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.77353367,+ -122.4169045+ ],+ [+ 251178,+ 'Podocarpus gracilor :: Fern Pine',+ '1043 Minna St',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.77353367,+ -122.4169045+ ],+ [+ 203506,+ 'Agonis flexuosa :: Peppermint Willow',+ '910 Kirkham St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 15,+ 37.76026555,+ -122.4705695+ ],+ [+ 52566,+ 'Hakea suaveolens :: Sweet Hakea Tree',+ '1555 40th Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '1/12/16 0:00',+ 2016,+ 1,+ 2,+ 37.75778273,+ -122.4993677+ ],+ [+ 22346,+ 'Lophostemon confertus :: Brisbane Box',+ '5280 03rd St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '6/27/14 0:00',+ 2014,+ 3,+ 3,+ 37.72954822,+ -122.3926894+ ],+ [+ 23567,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '2975 Van Ness Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '5/27/92 0:00',+ 1992,+ 25,+ 3,+ 37.80304673,+ -122.4250636+ ],+ [+ 237469,+ 'Prunus cerasifera :: Cherry Plum',+ '4200 23rd St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '7/17/00 0:00',+ 2000,+ 17,+ 0,+ 37.7528239,+ -122.4366208+ ],+ [+ 244214,+ 'Tree(s) ::',+ '342 Scott St',+ false,+ 'Sidewalk: Curb side : Yard',+ 'Tree',+ '3/20/17 0:00',+ 2017,+ 0,+ 3,+ 37.77300994,+ -122.4355982+ ],+ [+ 21823,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '2741 Taylor St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '8/19/06 0:00',+ 2006,+ 11,+ 3,+ 37.80797069,+ -122.4158502+ ],+ [+ 188686,+ 'Acacia melanoxylon :: Blackwood Acacia',+ '1300 Evans Ave',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 12,+ 37.73901484,+ -122.381104+ ],+ [+ 196592,+ 'Pyrus calleryana :: Ornamental Pear',+ '43 Lafayette St',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 8,+ 37.77310137,+ -122.4173585+ ],+ [+ 22614,+ 'Acacia melanoxylon :: Blackwood Acacia',+ '1001 Turk St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 24,+ 37.78136501,+ -122.4248636+ ],+ [+ 10933,+ 'Lophostemon confertus :: Brisbane Box',+ '1359 Hudson Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 12,+ 37.73743182,+ -122.3840631+ ],+ [+ 2889,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '1545 California St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 65,+ 37.79059396,+ -122.4198251+ ],+ [+ 240126,+ "Prunus serrulata 'Kwanzan' :: Kwanzan Flowering Cherry",+ '20 Lily St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 4,+ 37.77473647,+ -122.4213262+ ],+ [+ 183515,+ 'Myoporum laetum :: Myoporum',+ '2562 26th Ave',+ false,+ 'Sidewalk: Curb side : Yard',+ 'Tree',+ '3/21/17 0:00',+ 2017,+ 0,+ 3,+ 37.73970633,+ -122.4828998+ ],+ [+ 13434,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '2X Market St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 6,+ 37.79448363,+ -122.3950546+ ],+ [+ 226924,+ 'Juniperus chinensis :: Juniper',+ '1 Newburg St',+ false,+ 'Sidewalk: Property side : Pot',+ 'Tree',+ null,+ null,+ null,+ 11,+ 37.74625595,+ -122.4338758+ ],+ [+ 192589,+ 'Lophostemon confertus :: Brisbane Box',+ '1390 Mission St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 4,+ 37.7755405,+ -122.4157935+ ],+ [+ 3558,+ 'Lophostemon confertus :: Brisbane Box',+ '101 Cargo Way',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/21/17 17:52',+ 2017,+ 0,+ 6,+ 37.74050235,+ -122.3776366+ ],+ [+ 222540,+ 'Callistemon viminalis :: Weeping Bottlebrush',+ '1 Newburg St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 6,+ 37.74632546,+ -122.4338277+ ],+ [+ 192590,+ 'Lophostemon confertus :: Brisbane Box',+ '1390 Mission St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 4,+ 37.7755405,+ -122.4157935+ ],+ [+ 28375,+ 'Magnolia grandiflora :: Southern Magnolia',+ '3014 Sacramento St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '10/9/03 0:00',+ 2003,+ 14,+ 3,+ 37.78875791,+ -122.4429785+ ],+ [+ 222539,+ 'Callistemon viminalis :: Weeping Bottlebrush',+ '1 Newburg St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 6,+ 37.74630146,+ -122.4338571+ ],+ [+ 226925,+ 'Juniperus chinensis :: Juniper',+ '1 Newburg St',+ false,+ 'Sidewalk: Property side : Pot',+ 'Tree',+ null,+ null,+ null,+ 19,+ 37.74628109,+ -122.4338516+ ],+ [+ 27522,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '3201 California St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 8,+ 37.78709954,+ -122.4473685+ ],+ [+ 18228,+ 'Maytenus boaria :: Mayten',+ '1737-1795 Post St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '4/9/04 0:00',+ 2004,+ 13,+ 12,+ 37.78534132,+ -122.431005+ ],+ [+ 17325,+ 'Fraxinus americana :: American Ash',+ '150 Otis St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '8/31/16 0:00',+ 2016,+ 1,+ 3,+ 37.77095437,+ -122.4203558+ ],+ [+ 3528,+ 'Lophostemon confertus :: Brisbane Box',+ '201X Cargo Way',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/21/17 16:23',+ 2017,+ 0,+ 3,+ 37.74144532,+ -122.3793046+ ],+ [+ 251186,+ 'Juniperus chinensis :: Juniper',+ '3042 Steiner St',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.79753285,+ -122.4371106+ ],+ [+ 138938,+ 'Tree(s) ::',+ '632 HAYES ST',+ false,+ 'Sidewalk: Curb side : Yard',+ 'Tree',+ '3/21/17 0:00',+ 2017,+ 0,+ 3,+ 37.77646121,+ -122.4269126+ ],+ [+ 60867,+ 'Tree(s) ::',+ null,+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '4/25/83 0:00',+ 1983,+ 34,+ null,+ null,+ null+ ],+ [+ 233897,+ 'Araucaria heterophylla :: Norfolk Island Pine',+ '1021 Noe St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 9,+ 37.75266993,+ -122.4318862+ ],+ [+ 251187,+ 'Schinus terebinthifolius :: Brazilian Pepper',+ '1 Baker St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.77112958,+ -122.4406092+ ],+ [+ 121137,+ 'Pittosporum undulatum :: Victorian Box',+ '1388x Minna St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '9/8/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 2909,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '1700 California St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 30,+ 37.79038763,+ -122.4229834+ ],+ [+ 27602,+ 'Pittosporum undulatum :: Victorian Box',+ '988 Fulton St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 20,+ 37.77766599,+ -122.4324106+ ],+ [+ 44642,+ 'Tree(s) ::',+ null,+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '4/29/01 0:00',+ 2001,+ 16,+ null,+ null,+ null+ ],+ [+ 4749,+ 'Acacia melanoxylon :: Blackwood Acacia',+ '1255 Columbus Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '8/3/15 0:00',+ 2015,+ 2,+ 8,+ 37.80577303,+ -122.4182612+ ],+ [+ 44994,+ 'Tree(s) ::',+ null,+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '4/25/01 0:00',+ 2001,+ 16,+ null,+ null,+ null+ ],+ [+ 121139,+ 'Pittosporum undulatum :: Victorian Box',+ '1388x Minna St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '9/8/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 226596,+ 'Leptospermum scoparium :: New Zealand Tea Tree',+ '1 Newburg St',+ false,+ 'Sidewalk: Property side : Pot',+ 'Tree',+ null,+ null,+ null,+ 4,+ 37.74632473,+ -122.4337918+ ],+ [+ 239043,+ 'Pyrus calleryana :: Ornamental Pear',+ '10 12th St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 13,+ 37.77381038,+ -122.4194082+ ],+ [+ 222541,+ 'Callistemon citrinus :: Lemon Bottlebrush',+ '1 Newburg St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 5,+ 37.7463451,+ -122.433801+ ],+ [+ 138748,+ 'Lophostemon confertus :: Brisbane Box',+ '1614 Broderick St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 0,+ 37.7853077,+ -122.4415226+ ],+ [+ 226926,+ 'Juniperus chinensis :: Juniper',+ '1 Newburg St',+ false,+ 'Sidewalk: Property side : Pot',+ 'Tree',+ null,+ null,+ null,+ 15,+ 37.74630146,+ -122.4338212+ ],+ [+ 222538,+ 'Callistemon viminalis :: Weeping Bottlebrush',+ '1 Newburg St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 6,+ 37.74627164,+ -122.4338847+ ],+ [+ 166623,+ 'Potential Site :: Potential Site',+ '520 Jersey St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/21/17 0:00',+ 2017,+ 0,+ 3,+ 37.75036438,+ -122.4371358+ ],+ [+ 251188,+ 'Schinus terebinthifolius :: Brazilian Pepper',+ '1 Baker St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.77112958,+ -122.4406092+ ],+ [+ 19206,+ 'Laurus nobilis :: Sweet Bay: Grecian Laurel',+ '630 Sansome St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 12,+ 37.79625001,+ -122.4016986+ ],+ [+ 121138,+ 'Pittosporum undulatum :: Victorian Box',+ '1388x Minna St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '9/8/16 0:00',+ 2016,+ 1,+ 3,+ null,+ null+ ],+ [+ 251206,+ "Prunus serrulata 'Kwanzan' :: Kwanzan Flowering Cherry",+ '270 Trumbull St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.73083203,+ -122.4245292+ ],+ [+ 25725,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '729 Grove St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 12,+ 37.77705272,+ -122.4286972+ ],+ [+ 251249,+ 'Private shrub :: Private Shrub',+ '161 Lundys Ln',+ false,+ 'Front Yard : Yard',+ 'Landscaping',+ null,+ null,+ null,+ null,+ 37.7429691,+ -122.4194092+ ],+ [+ 251293,+ '::',+ '3789 Market St',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Landscaping',+ null,+ null,+ null,+ null,+ 37.75373446,+ -122.442203+ ],+ [+ 221749,+ 'Pittosporum undulatum :: Victorian Box',+ '275 Grattan St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ null,+ null,+ null,+ 24,+ 37.76366261,+ -122.4520649+ ],+ [+ 221750,+ 'Pittosporum undulatum :: Victorian Box',+ '275 Grattan St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ null,+ null,+ null,+ 11,+ 37.76366331,+ -122.4521462+ ],+ [+ 245474,+ 'Pittosporum undulatum :: Victorian Box',+ '275 Grattan St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ null,+ null,+ null,+ 19,+ 37.76363745,+ -122.4522558+ ],+ [+ 251419,+ 'Melaleuca quinquenervia :: Cajeput',+ '39 Jones St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '4/14/15 0:00',+ 2015,+ 2,+ null,+ 37.78164643,+ -122.4122686+ ],+ [+ 251418,+ 'Melaleuca quinquenervia :: Cajeput',+ '39 Jones St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '4/14/15 0:00',+ 2015,+ 2,+ null,+ 37.78164643,+ -122.4122686+ ],+ [+ 16698,+ 'Pittosporum undulatum :: Victorian Box',+ '950X Noriega St',+ false,+ 'Median : Cutout',+ 'Landscaping',+ null,+ null,+ null,+ 12,+ 37.75434951,+ -122.4740143+ ],+ [+ 251532,+ '::',+ '2100X 20th St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '5/15/17 0:00',+ 2017,+ 0,+ 3,+ null,+ null+ ],+ [+ 251531,+ '::',+ '2100X 20th St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '5/15/17 0:00',+ 2017,+ 0,+ 3,+ null,+ null+ ],+ [+ 251642,+ 'Shrub :: Shrub',+ '2253 Broderick St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ null,+ null,+ null,+ null,+ 37.79122797,+ -122.4428704+ ],+ [+ 251700,+ '::',+ '1560 Sanchez St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '6/5/17 0:00',+ 2017,+ 0,+ 3,+ 37.74408823,+ -122.4290963+ ],+ [+ 253008,+ '::',+ '1201 Tennessee St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '7/10/17 0:00',+ 2017,+ 0,+ 3,+ 37.7563302,+ -122.3890342+ ],+ [+ 208471,+ 'Cordyline australis :: Dracena Palm',+ '1175 Kirkham St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '8/23/17 0:00',+ 2017,+ 0,+ 3,+ 37.75989512,+ -122.4735278+ ],+ [+ 253411,+ 'Lophostemon confertus :: Brisbane Box',+ '1321 Mission St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '8/30/17 0:00',+ 2017,+ 0,+ 3,+ 37.77599135,+ -122.4149312+ ],+ [+ 253409,+ 'Lophostemon confertus :: Brisbane Box',+ '1321 Mission St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '8/30/17 0:00',+ 2017,+ 0,+ 3,+ 37.77599135,+ -122.4149312+ ],+ [+ 253410,+ 'Lophostemon confertus :: Brisbane Box',+ '1321 Mission St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '8/30/17 0:00',+ 2017,+ 0,+ 3,+ 37.77599135,+ -122.4149312+ ],+ [+ 253412,+ 'Lophostemon confertus :: Brisbane Box',+ '1321 Mission St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '8/30/17 0:00',+ 2017,+ 0,+ 3,+ 37.77599135,+ -122.4149312+ ],+ [+ 225282,+ 'Pittosporum crassifolium :: Karo Tree',+ '101 Rivoli St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ null,+ null,+ null,+ 6,+ 37.76244046,+ -122.4496446+ ],+ [+ 173852,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 173849,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 173850,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 173851,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 173848,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 173846,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 173847,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 173853,+ '::',+ '450 Toland St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '1/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.74445161,+ -122.3985096+ ],+ [+ 107717,+ 'Tree(s) ::',+ '2400X 25th Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Landscaping',+ '10/16/14 0:00',+ 2014,+ 3,+ 3,+ 37.74238326,+ -122.4917845+ ],+ [+ 110194,+ 'Ginkgo biloba :: Maidenhair Tree',+ '2123 Pierce St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/26/15 0:00',+ 2015,+ 2,+ 3,+ 37.78980712,+ -122.4374813+ ],+ [+ 59839,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '1201 Palou Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '10/10/81 0:00',+ 1981,+ 36,+ 3,+ 37.72976741,+ -122.3836854+ ],+ [+ 183689,+ 'Rhamnus alaternus :: Italian Buckthorn',+ '1341 42nd Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 6,+ 37.76162779,+ -122.5017998+ ],+ [+ 18916,+ 'Olea europaea :: Olive Tree',+ '2621 Sacramento St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 14,+ 37.78950262,+ -122.4361188+ ],+ [+ 20281,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '20X Sunset Blvd',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 12,+ null,+ null+ ],+ [+ 119758,+ 'Maytenus boaria :: Mayten',+ '151X Octavia St Frontage West',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ null,+ null+ ],+ [+ 228560,+ 'Lophostemon confertus :: Brisbane Box',+ '700 Valencia St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 7,+ 37.76151469,+ -122.4216727+ ],+ [+ 18052,+ 'Ulmus parvifolia :: Chinese Elm',+ '2840 Pine St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 18,+ 37.78687837,+ -122.4426898+ ],+ [+ 212622,+ 'Prunus cerasifera :: Cherry Plum',+ '115 Beverly St',+ false,+ 'Sidewalk: Property side : Yard',+ 'Tree',+ null,+ null,+ null,+ 4,+ 37.71819234,+ -122.4717606+ ],+ [+ 20398,+ 'Cupressus macrocarpa :: Monterey Cypress',+ '262X Sunset Blvd',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 24,+ null,+ null+ ],+ [+ 66855,+ 'Maytenus boaria :: Mayten',+ '2041 Hayes St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/15/91 0:00',+ 1991,+ 26,+ 8,+ 37.77336241,+ -122.4501107+ ],+ [+ 237033,+ "Prunus serrulata 'Kwanzan' :: Kwanzan Flowering Cherry",+ '100 Octavia St',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 6,+ 37.77334931,+ -122.4236445+ ],+ [+ 116641,+ 'Ginkgo biloba :: Maidenhair Tree',+ '270 Brannan St',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 1,+ 37.78270018,+ -122.3912181+ ],+ [+ 218972,+ 'Fraxinus americana :: American Ash',+ '742 Myra Way',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 10,+ 37.74058076,+ -122.4513096+ ],+ [+ 47510,+ "Arbutus 'Marina' :: Hybrid Strawberry Tree",+ '54X Cayuga Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.73158339,+ -122.4295272+ ],+ [+ 237030,+ "Prunus serrulata 'Kwanzan' :: Kwanzan Flowering Cherry",+ '100 Octavia St',+ false,+ ':',+ 'Tree',+ null,+ null,+ null,+ 5,+ 37.77325086,+ -122.4236179+ ],+ [+ 213016,+ 'Tree(s) ::',+ '120 Ortega St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/27/17 0:00',+ 2017,+ 0,+ 3,+ 37.75295695,+ -122.4649514+ ],+ [+ 228561,+ 'Lophostemon confertus :: Brisbane Box',+ '700 Valencia St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 7,+ 37.76156532,+ -122.4216758+ ],+ [+ 72565,+ 'Ginkgo biloba :: Maidenhair Tree',+ '270 Brannan St',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Tree',+ '11/16/96 0:00',+ 1996,+ 21,+ 3,+ 37.78270018,+ -122.3912181+ ],+ [+ 116640,+ 'Ginkgo biloba :: Maidenhair Tree',+ '270 Brannan St',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 1,+ 37.78270018,+ -122.3912181+ ],+ [+ 6337,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '1916 Ellis St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 18,+ 37.78175831,+ -122.4377689+ ],+ [+ 832,+ 'Lagunaria patersonii :: Primrose Tree',+ '1396 47th Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:18',+ 2017,+ 0,+ 3,+ 37.76054428,+ -122.5069327+ ],+ [+ 251241,+ 'Cupressocyparis leylandii :: Leyland Cypress',+ '2305 Golden Gate Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.77731326,+ -122.448748+ ],+ [+ 18836,+ "Ficus microcarpa nitida 'Green Gem' :: Indian Laurel Fig Tree 'Green Gem'",+ '2055 Sacramento St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 12,+ 37.79068779,+ -122.4267446+ ],+ [+ 11598,+ 'Lagunaria patersonii :: Primrose Tree',+ '4134 Judah St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 11:51',+ 2017,+ 0,+ 3,+ 37.76048345,+ -122.5065435+ ],+ [+ 111561,+ 'Eriobotrya deflexa :: Bronze Loquat',+ '1498x Kansas St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 0:00',+ 2017,+ 0,+ 3,+ 37.75089751,+ -122.402317+ ],+ [+ 97319,+ 'Lagunaria patersonii :: Primrose Tree',+ '1038 Taraval St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:52',+ 2017,+ 0,+ 3,+ 37.74306751,+ -122.4774242+ ],+ [+ 58021,+ 'Lagunaria patersonii :: Primrose Tree',+ '4026 Irving St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:07',+ 2017,+ 0,+ 3,+ 37.76257173,+ -122.5012197+ ],+ [+ 175046,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '80X Junipero Serra Blvd',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 4,+ 37.71164354,+ -122.4709833+ ],+ [+ 26071,+ 'Melaleuca quinquenervia :: Cajeput',+ '247 Orizaba Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 13:41',+ 2017,+ 0,+ 3,+ 37.71342972,+ -122.4626502+ ],+ [+ 11606,+ 'Lagunaria patersonii :: Primrose Tree',+ '4200x Judah St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 11:54',+ 2017,+ 0,+ 3,+ 37.76045095,+ -122.5071358+ ],+ [+ 36617,+ 'Robinia x ambigua :: Locust',+ null,+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '5/20/98 0:00',+ 1998,+ 19,+ null,+ null,+ null+ ],+ [+ 24532,+ 'Lagunaria patersonii :: Primrose Tree',+ '1395 47th Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:21',+ 2017,+ 0,+ 3,+ 37.76072337,+ -122.5070915+ ],+ [+ 5972,+ 'Pittosporum undulatum :: Victorian Box',+ '1550 Eddy St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '2/2/90 0:00',+ 1990,+ 27,+ 8,+ 37.78138444,+ -122.4331105+ ],+ [+ 830,+ "Tristaniopsis laurina 'Elegant' :: Small-leaf Tristania 'Elegant'",+ '1384 47th Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:15',+ 2017,+ 0,+ 3,+ 37.76071635,+ -122.5069447+ ],+ [+ 251225,+ 'Jacaranda mimosifolia :: Jacaranda',+ '1 Yukon St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.75927435,+ -122.4422441+ ],+ [+ 54712,+ 'Lagunaria patersonii :: Primrose Tree',+ '4508 Irving St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 11:58',+ 2017,+ 0,+ 3,+ 37.76234527,+ -122.5063635+ ],+ [+ 3193,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '3698 California St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 16,+ 37.78640011,+ -122.454267+ ],+ [+ 21682,+ 'Prunus serrulata :: Ornamental Cherry',+ '1830 Sutter St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 0:00',+ 2017,+ 0,+ 3,+ 37.78651577,+ -122.4305403+ ],+ [+ 97322,+ 'Lagunaria patersonii :: Primrose Tree',+ '1055 Taraval St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:42',+ 2017,+ 0,+ 3,+ 37.74287614,+ -122.4775411+ ],+ [+ 175377,+ 'Ulmus pumila :: Siberian Elm',+ '80X Junipero Serra Blvd',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 2,+ 37.71516198,+ -122.4717512+ ],+ [+ 142720,+ '::',+ '1170 COLUMBUS AVE',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.80483123,+ -122.416565+ ],+ [+ 251231,+ 'Pinus radiata :: Monterey Pine',+ '164 Serrano Dr',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.72047169,+ -122.4780251+ ],+ [+ 29943,+ "Tristaniopsis laurina 'Elegant' :: Small-leaf Tristania 'Elegant'",+ '242 Broad St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:23',+ 2017,+ 0,+ 3,+ 37.71323398,+ -122.4605594+ ],+ [+ 97323,+ 'Lagunaria patersonii :: Primrose Tree',+ '1011 Taraval St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:25',+ 2017,+ 0,+ 3,+ 37.74289372,+ -122.4772138+ ],+ [+ 11582,+ 'Lagunaria patersonii :: Primrose Tree',+ '4000 Judah St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 11:49',+ 2017,+ 0,+ 3,+ 37.76055019,+ -122.5050036+ ],+ [+ 251230,+ 'Ligustrum lucidum :: Glossy Privet',+ '99x Ogden Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.73605476,+ -122.4163909+ ],+ [+ 251232,+ 'Ligustrum lucidum :: Glossy Privet',+ '99x Ogden Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.73605476,+ -122.4163909+ ],+ [+ 179480,+ 'Schinus terebinthifolius :: Brazilian Pepper',+ '100 Serrano Dr',+ false,+ 'Sidewalk: Curb side : Yard',+ 'Tree',+ null,+ null,+ null,+ 11,+ 37.72024935,+ -122.4780157+ ],+ [+ 251221,+ 'Tree(s) ::',+ '2401X Washington St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 0:00',+ 2017,+ 0,+ 3,+ null,+ null+ ],+ [+ 48827,+ 'Lophostemon confertus :: Brisbane Box',+ '435 Pacific Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '11/7/02 0:00',+ 2002,+ 15,+ 5,+ 37.79736024,+ -122.4027685+ ],+ [+ 251242,+ 'Cupressocyparis leylandii :: Leyland Cypress',+ '2449 Golden Gate Ave',+ false,+ 'Sidewalk: Property side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.7770353,+ -122.4514366+ ],+ [+ 48332,+ 'Tree(s) ::',+ null,+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '7/17/02 0:00',+ 2002,+ 15,+ null,+ null,+ null+ ],+ [+ 175044,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '80x Junipero Serra Blvd',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 19,+ 37.71158043,+ -122.4709734+ ],+ [+ 251226,+ 'Koelreuteria paniculata :: Golden Rain Tree',+ '1 Yukon St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.75950087,+ -122.4421669+ ],+ [+ 17881,+ 'Olea europaea :: Olive Tree',+ '2205 Pine St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 12,+ 37.78806671,+ -122.4322373+ ],+ [+ 24515,+ 'Lophostemon confertus :: Brisbane Box',+ '2030 Fell St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '4/7/16 7:40',+ 2016,+ 1,+ 3,+ 37.77238102,+ -122.4513341+ ],+ [+ 97317,+ 'Lagunaria patersonii :: Primrose Tree',+ '1000 Taraval St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:59',+ 2017,+ 0,+ 3,+ 37.74308434,+ -122.4769891+ ],+ [+ 2985,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '2253 California St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 65,+ 37.78912498,+ -122.4314293+ ],+ [+ 182083,+ 'Lagunaria patersonii :: Primrose Tree',+ '1101 Taraval St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 12:33',+ 2017,+ 0,+ 3,+ 37.74285808,+ -122.4780077+ ],+ [+ 18700,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '100X Richardson Ave',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 18,+ 37.79975916,+ -122.4460044+ ],+ [+ 9914,+ "Ficus microcarpa nitida 'Green Gem' :: Indian Laurel Fig Tree 'Green Gem'",+ '1900 Gough St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 126,+ 37.79116413,+ -122.4257789+ ],+ [+ 93463,+ "Prunus x 'Amanogawa' :: Flowering Cherry",+ '1739 Taraval St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '3/28/17 13:05',+ 2017,+ 0,+ 3,+ 37.74255391,+ -122.4849289+ ],+ [+ 15429,+ "Ficus microcarpa nitida 'Green Gem' :: Indian Laurel Fig Tree 'Green Gem'",+ '2125 Mission St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '4/9/15 0:00',+ 2015,+ 2,+ 15,+ 37.76296062,+ -122.419386+ ],+ [+ 138801,+ 'Maytenus boaria :: Mayten',+ '2375 PINE ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '5/9/97 0:00',+ 1997,+ 20,+ 2,+ 37.78770158,+ -122.4350685+ ],+ [+ 251243,+ "Ceanothus 'Ray Hartman' :: California Lilac 'Ray Hartman'",+ '299x Chapman St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.7417247,+ -122.411639+ ],+ [+ 138359,+ 'Ficus retusa nitida :: Banyan Fig',+ '2060 SUTTER ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 15,+ 37.78607841,+ -122.4338643+ ],+ [+ 251248,+ 'Corymbia ficifolia :: Red Flowering Gum',+ '829 Chenery St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.73477716,+ -122.4360662+ ],+ [+ 138368,+ 'Ficus retusa nitida :: Banyan Fig',+ '2060 SUTTER ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 13,+ 37.78600955,+ -122.4344937+ ],+ [+ 138807,+ 'Ulmus parvifolia :: Chinese Elm',+ '2355 PINE ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 13,+ 37.78777373,+ -122.4346006+ ],+ [+ 57209,+ 'Magnolia grandiflora :: Southern Magnolia',+ '2898 Clay St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '12/15/14 0:00',+ 2014,+ 3,+ 3,+ 37.78998742,+ -122.4404101+ ],+ [+ 210495,+ 'Myoporum laetum :: Myoporum',+ '365 San Leandro Way',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 21,+ 37.73051136,+ -122.4689316+ ],+ [+ 138369,+ 'Ficus retusa nitida :: Banyan Fig',+ '2060 SUTTER ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 16,+ 37.78599791,+ -122.4345397+ ],+ [+ 6069,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '1930 Eddy St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '5/26/15 0:00',+ 2015,+ 2,+ 3,+ 37.78057618,+ -122.439557+ ],+ [+ 138802,+ 'Ulmus parvifolia :: Chinese Elm',+ '2375 PINE ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 12,+ 37.78771109,+ -122.4350205+ ],+ [+ 138365,+ 'Ficus retusa nitida :: Banyan Fig',+ '2060 SUTTER ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 19,+ 37.78603526,+ -122.4342542+ ],+ [+ 251246,+ 'Metrosideros excelsa :: New Zealand Xmas Tree',+ '722X Mendell St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ null,+ 37.73887284,+ -122.3866046+ ],+ [+ 251245,+ 'Corymbia ficifolia :: Red Flowering Gum',+ '701 Chenery St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '6/4/92 0:00',+ 1992,+ 25,+ null,+ 37.73445362,+ -122.4338962+ ],+ [+ 103786,+ 'Magnolia grandiflora :: Southern Magnolia',+ '1221 Polk St',+ false,+ 'Sidewalk: Curb side : Pot',+ 'Tree',+ '11/1/09 0:00',+ 2009,+ 8,+ 3,+ 37.78810145,+ -122.4202677+ ],+ [+ 138362,+ 'Ficus retusa nitida :: Banyan Fig',+ '2060 SUTTER ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 15,+ 37.78605488,+ -122.4340541+ ],+ [+ 134567,+ 'Platanus x hispanica :: Sycamore: London Plane',+ '99 Grove St',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ '7/6/11 0:00',+ 2011,+ 6,+ 4,+ 37.77846618,+ -122.4173997+ ],+ [+ 138367,+ 'Ficus retusa nitida :: Banyan Fig',+ '2060 SUTTER ST',+ false,+ 'Sidewalk: Curb side : Cutout',+ 'Tree',+ null,+ null,+ null,+ 15,+ 37.78601298,+ -122.4344509+ ]+ ]+ }+};diff --git a/examples/custom-reducer/src/main.js b/examples/custom-reducer/src/main.jsnew file mode 100644index 000000000..f90ba7289--- /dev/null+++ b/examples/custom-reducer/src/main.js@@ -0,0 +1,34 @@+// Copyright (c) 2018 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React from 'react';+import document from 'global/document';+import {Provider} from 'react-redux';+import {render} from 'react-dom';+import store from './store';+import App from './app';++const Root = () => (+ <Provider store={store}>+ <App/>+ </Provider>+);++render(<Root />, document.body.appendChild(document.createElement('div')));diff --git a/examples/custom-reducer/src/store.js b/examples/custom-reducer/src/store.jsnew file mode 100644index 000000000..ffcb1dd71--- /dev/null+++ b/examples/custom-reducer/src/store.js@@ -0,0 +1,79 @@+// Copyright (c) 2018 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import {createStore, combineReducers, applyMiddleware, compose} from 'redux';+import keplerGlReducer from 'kepler.gl/reducers';+import appReducer from './app-reducer';+import {taskMiddleware} from 'react-palm';+import window from 'global/window';++const customizedKeplerGlReducer = keplerGlReducer+ .initialState({+ uiState: {+ // hide side panel to disallower user customize the map+ readOnly: true,++ // customize which map control button to show+ mapControls: {+ visibleLayers: {+ show: false+ },+ mapLegend: {+ show: true,+ active: true+ },+ toggle3d: {+ show: false+ },+ splitMap: {+ show: false+ }+ }+ }+ })+ // handle additional actions+ .plugin({+ HIDE_AND_SHOW_SIDE_PANEL: (state, action) => ({+ ...state,+ uiState: {+ ...state.uiState,+ readOnly: !state.uiState.readOnly+ }+ })+ });++const reducers = combineReducers({+ keplerGl: customizedKeplerGlReducer,+ app: appReducer+});++const middlewares = [taskMiddleware];+const enhancers = [applyMiddleware(...middlewares)];++const initialState = {};++// add redux devtools+const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;++export default createStore(+ reducers,+ initialState,+ composeEnhancers(...enhancers)+);diff --git a/examples/custom-reducer/webpack.config.js b/examples/custom-reducer/webpack.config.jsnew file mode 100644index 000000000..1461b1b1f--- /dev/null+++ b/examples/custom-reducer/webpack.config.js@@ -0,0 +1,72 @@+// Copyright (c) 2018 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++// NOTE: To use this example standalone (e.g. outside of deck.gl repo)+// delete the local development overrides at the bottom of this file++// avoid destructuring for older Node version support+const resolve = require('path').resolve;+const join = require('path').join;+const webpack = require('webpack');++const CONFIG = {+ // bundle app.js and everything it imports, recursively.+ entry: {+ app: resolve('./src/main.js')+ },++ devtool: 'source-map',++ resolve: {+ // Make src files outside of this dir resolve modules in our node_modules folder+ modules: [resolve(__dirname, '.'), resolve(__dirname, 'node_modules'), 'node_modules']+ },++ module: {+ rules: [+ {+ test: /\.js$/,+ loader: 'babel-loader',+ include: join(__dirname, 'src'),+ exclude: [/node_modules/]+ },+ {+ // The example has some JSON data+ test: /\.json$/,+ loader: 'json-loader',+ exclude: [/node_modules/]+ }+ ]+ },++ node: {+ fs: 'empty'+ },++ // Optional: Enables reading mapbox token from environment variable+ plugins: [+ new webpack.EnvironmentPlugin(['MapboxAccessToken'])+ ]+};++// This line enables bundling against src in this repo rather than installed deck.gl module+module.exports = env => {+ return env ? require('../webpack.config.local')(CONFIG, __dirname)(env) : CONFIG;+};diff --git a/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js b/examples/demo-app/src/components/load-data-modal/sample-data-viewer.jsindex 7371d6b18..60e953df1 100644--- a/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js+++ b/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js@@ -55,7 +55,7 @@ const StyledSampleMap = styled.div`transition: opacity 0.4s ease;position: relative;line-height: 0;-+img {max-width: 100%;}@@ -86,7 +86,7 @@ const BackLink = styled.div`color: ${props => props.theme.titleColorLT};cursor: pointer;margin-bottom: 40px;-+:hover {font-weight: 500;}diff --git a/examples/open-modal/index.html b/examples/open-modal/index.htmlindex e3473055d..f3daab553 100644--- a/examples/open-modal/index.html+++ b/examples/open-modal/index.html@@ -3,8 +3,8 @@<head><meta charset='UTF-8' /><title>kepler.gl demo</title>- <link href="https://d1a3f4spazzrp4.cloudfront.net/uber-fonts/4.0.0/superfine.css" rel="stylesheet">- <link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.42.0/mapbox-gl.css" rel="stylesheet">+ <link href="//d1a3f4spazzrp4.cloudfront.net/uber-fonts/4.0.0/superfine.css" rel="stylesheet">+ <link href="//api.tiles.mapbox.com/mapbox-gl-js/v0.42.0/mapbox-gl.css" rel="stylesheet"><style type="text/css">body {margin: 0; padding: 0; overflow: hidden;}</style>diff --git a/package.json b/package.jsonindex 9f1ec37c7..f30cea7c3 100644--- a/package.json+++ b/package.json@@ -32,6 +32,8 @@"start": "cd examples/demo-app && (path-exists node_modules || npm i) && npm run start-local","start:custom-layer": "(cd examples/custom-layer && (path-exists node_modules || npm i) && npm run start-local)","start:open-modal": "(cd examples/open-modal && (path-exists node_modules || npm i) && npm run start-local)",+ "start:custom-reducer": "(cd examples/custom-reducer && (path-exists node_modules || npm i) && npm run start-local)",+ "start:": "(cd examples/open-modal && (path-exists node_modules || npm i) && npm run start-local)","build": "rm -fr dist && uber-licence && babel src --out-dir dist --plugins=transform-es2015-modules-commonjs --source-maps inline","lint": "eslint src examples/**/src website/src","check-licence": "uber-licence --dry",diff --git a/src/reducers/composers.js b/src/reducers/composers.jsindex d048bea50..7c48d505c 100644--- a/src/reducers/composers.js+++ b/src/reducers/composers.js@@ -46,10 +46,9 @@ export const updateVisDataComposed = (state, action) => {const visState = updateVisDataUpdater(state.visState, action);const defaultOptions = {- centerMap: true,- // this will hide the left panel completely- readOnly: false+ centerMap: true};+const options = {...defaultOptions,...action.options@@ -72,7 +71,7 @@ export const updateVisDataComposed = (state, action) => {: state.mapState,uiState: {...toggleModalUpdater(state.uiState, {payload: null}),- readOnly: options.readOnly+ ...(options.hasOwnProperty('readOnly') ? {readOnly: options.readOnly} : {})}};};diff --git a/src/reducers/map-style-updaters.js b/src/reducers/map-style-updaters.jsindex 65a366dff..0b410e870 100644--- a/src/reducers/map-style-updaters.js+++ b/src/reducers/map-style-updaters.js@@ -30,11 +30,32 @@ import {editTopMapStyle,editBottomMapStyle} from 'utils/map-style-utils/mapbox-gl-style-editor';-import {DEFAULT_LAYER_GROUPS} from 'constants/default-settings';+import {DEFAULT_MAP_STYLES, DEFAULT_LAYER_GROUPS} from 'constants/default-settings';import {generateHashId} from 'utils/utils';import {LOAD_MAP_STYLE_TASK} from 'tasks/tasks';import {loadMapStyles, loadMapStyleErr} from 'actions/map-style-actions';+const getDefaultState = () => {+ const visibleLayerGroups = {};+ const styleType = 'dark';+ const topLayerGroups = {};++ return {+ styleType,+ visibleLayerGroups,+ topLayerGroups,+ mapStyles: DEFAULT_MAP_STYLES.reduce((accu, curr) => ({+ ...accu,+ [curr.id]: curr+ }), {}),+ // save mapbox access token+ mapboxApiAccessToken: null,+ inputStyle: getInitialInputStyle()+ };+};++export const INITIAL_MAP_STYLE = getDefaultState();+/*** Create two map styles from preset map style, one for top map one for bottom*@@ -112,6 +133,10 @@ export const mapConfigChangeUpdater = (state, action) => ({});export const mapStyleChangeUpdater = (state, {payload: styleType}) => {+ if (!state.mapStyles[styleType]) {+ // we might not have received the style yet+ return state;+ }const defaultLGVisibility = getDefaultLayerGroupVisibility(state.mapStyles[styleType]);@@ -189,6 +214,18 @@ export const receiveMapConfigUpdater = (state, {payload: {mapStyle}}) => {) : newState;};+export const resetMapConfigMapStyleUpdater = (state) => {+ const emptyConfig = {+ ...INITIAL_MAP_STYLE,+ mapboxApiAccessToken: state.mapboxApiAccessToken,+ ...state.initialState,+ mapStyles: state.mapStyles,+ initialState: state.initialState+ };++ return mapStyleChangeUpdater(emptyConfig, {payload: emptyConfig.styleType});+};+export const loadCustomMapStyleUpdater = (state, {payload: {icon, style, error}}) => ({...state,inputStyle: {diff --git a/src/reducers/map-style.js b/src/reducers/map-style.jsindex 287fb13a2..092785c79 100644--- a/src/reducers/map-style.js+++ b/src/reducers/map-style.js@@ -22,10 +22,9 @@ import {handleActions} from 'redux-actions';// Actionsimport ActionTypes from 'constants/action-types';-import {DEFAULT_MAP_STYLES} from 'constants/default-settings';import {- getInitialInputStyle,+ INITIAL_MAP_STYLE,inputMapStyleUpdater,initMapStyleUpdater,mapConfigChangeUpdater,@@ -33,33 +32,11 @@ import {loadMapStylesUpdater,loadMapStyleErrUpdater,receiveMapConfigUpdater,+ resetMapConfigMapStyleUpdater,loadCustomMapStyleUpdater,addCustomMapStyleUpdater} from './map-style-updaters';-// bedrock browserInit flattens our immutable object into a plain object-// we have to recreate the state after the app is loaded-const getDefaultState = () => {- const visibleLayerGroups = {};- const styleType = 'dark';- const topLayerGroups = {};-- return {- styleType,- visibleLayerGroups,- topLayerGroups,- mapStyles: DEFAULT_MAP_STYLES.reduce((accu, curr) => ({- ...accu,- [curr.id]: curr- }), {}),- // save mapbox access token- mapboxApiAccessToken: null,- inputStyle: getInitialInputStyle()- };-};--export const INITIAL_MAP_STYLE = getDefaultState();-const actionHandler = {[ActionTypes.INIT]: initMapStyleUpdater,[ActionTypes.INPUT_MAP_STYLE]: inputMapStyleUpdater,@@ -69,7 +46,8 @@ const actionHandler = {[ActionTypes.LOAD_MAP_STYLE_ERR]: loadMapStyleErrUpdater,[ActionTypes.RECEIVE_MAP_CONFIG]: receiveMapConfigUpdater,[ActionTypes.LOAD_CUSTOM_MAP_STYLE]: loadCustomMapStyleUpdater,- [ActionTypes.ADD_CUSTOM_MAP_STYLE]: addCustomMapStyleUpdater+ [ActionTypes.ADD_CUSTOM_MAP_STYLE]: addCustomMapStyleUpdater,+ [ActionTypes.RESET_MAP_CONFIG]: resetMapConfigMapStyleUpdater};export const mapStyleReducerFactory = (initialState = {}) =>diff --git a/src/reducers/root.js b/src/reducers/root.jsindex 95f70759f..39cb28681 100644--- a/src/reducers/root.js+++ b/src/reducers/root.js@@ -90,9 +90,28 @@ export function provideInitialState(initialState) {const keplerGlReducer = provideInitialState();-function decorate(target) {+function mergeInitialState(saved = {}, provided = {}) {+ const keys = ['mapState', 'mapStyle', 'visState', 'uiState'];++ // shallow merge each reducer+ return keys.reduce((accu, key) => ({+ ...accu,+ ...(saved[key] && provided[key] ?+ {[key]: {...saved[key], ...provided[key]}} :+ {[key]: saved[key] || provided[key] || {}})+ }), {});+}++function decorate(target, savedInitialState = {}) {+ const targetInitialState = savedInitialState;+// plugin to core reducertarget.plugin = function plugin(customReducer) {+ if (typeof customReducer === 'object') {+ // if only provided a reducerMap, wrap it in a reducer+ customReducer = handleActions(customReducer, {});+ }+// use 'function' keyword to enable 'this'return decorate((state = {}, action = {}) => {let nextState = this(state, action);@@ -113,8 +132,12 @@ function decorate(target) {// pass in initialState for reducer slices// e.g. initialState = {uiState: {currentModal : null}}- target.initialState = initialState =>- decorate(provideInitialState(initialState));+ target.initialState = function initialState(iniSt) {+ const merged = mergeInitialState(targetInitialState, iniSt);+ const targetReducer = provideInitialState(merged);++ return decorate(targetReducer, merged);+ }return target;}diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.jsindex aaa841bc1..19eeff5e2 100644--- a/src/reducers/vis-state-updaters.js+++ b/src/reducers/vis-state-updaters.js@@ -543,7 +543,7 @@ export const showDatasetTableUpdater = (state, action) => {};};-export const resetMapConfigUpdater = (state, action) => ({+export const resetMapConfigVisStateUpdater = (state, action) => ({...INITIAL_VIS_STATE,...state.initialState,initialState: state.initialState@@ -569,7 +569,7 @@ export const receiveMapConfigUpdater = (state, action) => {} = action.payload.visState;// always reset config when receive a new config- const resetState = resetMapConfigUpdater(state);+ const resetState = resetMapConfigVisStateUpdater(state);let mergedState = {...resetState,splitMaps: splitMaps || [] // maps doesn't require any logicdiff --git a/src/reducers/vis-state.js b/src/reducers/vis-state.jsindex 8be2eff55..c30496aa2 100644--- a/src/reducers/vis-state.js+++ b/src/reducers/vis-state.js@@ -33,7 +33,7 @@ import {toggleFilterAnimationUpdater,updateAnimationSpeedUpdater,receiveMapConfigUpdater,- resetMapConfigUpdater,+ resetMapConfigVisStateUpdater,loadFilesUpdater,loadFilesErrUpdater,updateVisDataUpdater,@@ -92,7 +92,7 @@ const actionHandler = {[ActionTypes.REORDER_LAYER]: reorderLayerUpdater,- [ActionTypes.RESET_MAP_CONFIG]: resetMapConfigUpdater,+ [ActionTypes.RESET_MAP_CONFIG]: resetMapConfigVisStateUpdater,[ActionTypes.SET_FILTER]: setFilterUpdater,diff --git a/test/node/index.js b/test/node/index.jsindex 3b6021898..bae32724b 100644--- a/test/node/index.js+++ b/test/node/index.js@@ -33,6 +33,7 @@ import './reducers/map-style-test';import './reducers/vis-state-test';import './reducers/ui-state-test';import './reducers/composer-state-test';+import './reducers/root-test';// test schemasimport './schemas/vis-state-schema-test';diff --git a/test/node/reducers/map-style-test.js b/test/node/reducers/map-style-test.jsindex e0778dd1d..255f440b1 100644--- a/test/node/reducers/map-style-test.js+++ b/test/node/reducers/map-style-test.js@@ -20,7 +20,8 @@import test from 'tape';-import reducer, {INITIAL_MAP_STYLE} from 'reducers/map-style';+import reducer from 'reducers/map-style';+import {INITIAL_MAP_STYLE} from 'reducers/map-style-updaters';import {keplerGlInit, receiveMapConfig} from 'actions/actions';import SchemaManager from 'schemas';import {diff --git a/test/node/reducers/root-test.js b/test/node/reducers/root-test.jsnew file mode 100644index 000000000..aaa3401ba--- /dev/null+++ b/test/node/reducers/root-test.js@@ -0,0 +1,174 @@+// Copyright (c) 2018 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import test from 'tape';+import keplerGlReducer from 'reducers';+import {registerEntry, resetMapConfig, receiveMapConfig} from 'actions';+import {createAction, handleActions} from 'redux-actions';++test('keplerGlReducer.initialState', t => {++ const test1Reducer = keplerGlReducer+ .initialState({+ visState: {+ layerClasses: []+ },+ mapStyle: {+ styleType: 'light'+ }+ });++ const test1ReducerInitialState = test1Reducer(undefined, registerEntry({id: 'test'}));+ t.deepEqual(test1ReducerInitialState.test.visState.layerClasses, [], 'should overide initialState');+ t.equal(test1ReducerInitialState.test.mapStyle.styleType, 'light', 'should overide initialState');+ t.deepEqual(test1ReducerInitialState.test.visState.initialState, {layerClasses: []}, 'should save initialState');+ t.deepEqual(test1ReducerInitialState.test.mapStyle.initialState, {styleType: 'light'}, 'should save initialState');++ // change it+ const newConfig = {+ visState: {layerBlending: 'additive'},+ mapStyle: {styleType: 'beautiful'}+ };++ const modifiedReducer = test1Reducer(test1ReducerInitialState, receiveMapConfig(newConfig));+ t.deepEqual(modifiedReducer.test.visState.layerBlending, 'additive', 'should apply config');+ t.equal(modifiedReducer.test.mapStyle.styleType, 'beautiful', 'should apply config');+ t.deepEqual(modifiedReducer.test.visState.initialState, {layerClasses: []}, 'should save initialState');++ // reset reducer+ const restTestReducer = test1Reducer(modifiedReducer, resetMapConfig());+ t.deepEqual(restTestReducer.test.visState.layerClasses, [], 'should overide initialState');+ t.equal(restTestReducer.test.mapStyle.styleType, 'light', 'should overide initialState');+ t.deepEqual(restTestReducer.test.visState.initialState, {layerClasses: []}, 'should save initialState');+ t.deepEqual(restTestReducer.test.mapStyle.initialState, {styleType: 'light'}, 'should save initialState');++ t.end();+});++test('keplerGlReducer.initialState.2', t => {+ const test1Reducer = keplerGlReducer+ .initialState({+ visState: {+ layerClasses: []+ },+ mapStyle: {+ styleType: 'light'+ }+ });++ // call initialState one more time+ const test2Reducer = test1Reducer.initialState({+ mapStyle: {+ styleType: 'smoothie',+ hello: 'kitty'+ },+ mapState: {+ dragRotate: true+ }+ });++ const test2InitialState = test2Reducer(undefined, registerEntry({id: 'test2'}));++ t.deepEqual(test2InitialState.test2.visState.layerClasses, [], 'should keep previous initialState');+ t.equal(test2InitialState.test2.mapStyle.styleType, 'smoothie', 'should overide initialState');+ t.equal(test2InitialState.test2.mapStyle.hello, 'kitty', 'should provide initialState');+ t.equal(test2InitialState.test2.mapState.dragRotate, true, 'should provide initialState');++ // change it+ const newConfig2 = {+ visState: {layerBlending: 'subtractive'},+ mapStyle: {styleType: 'earth'}+ };++ const modifiedReducer2 = test2Reducer(test2InitialState, receiveMapConfig(newConfig2));++ t.deepEqual(modifiedReducer2.test2.visState.layerBlending, 'subtractive', 'should apply config');+ t.equal(modifiedReducer2.test2.mapStyle.styleType, 'earth', 'should apply config');+ t.deepEqual(modifiedReducer2.test2.visState.initialState, {layerClasses: []}, 'should save initialState');++ // reset reducer+ const restTestReducer2 = test2Reducer(modifiedReducer2, resetMapConfig());+ t.deepEqual(restTestReducer2.test2.visState.layerClasses, [], 'should reset initialState');+ t.equal(restTestReducer2.test2.mapStyle.styleType, 'smoothie', 'should reset initialState');+ t.equal(restTestReducer2.test2.mapState.dragRotate, true, 'should reset initialState');+ t.deepEqual(restTestReducer2.test2.visState.initialState, {layerClasses: []}, 'should save initialState');+ t.deepEqual(restTestReducer2.test2.mapStyle.initialState, {styleType: 'smoothie', hello: 'kitty'}, 'should save initialState');++ t.end();+});++test('keplerGlReducer.plugin', t => {+ // custom actions+ const hideAndShowSidePanel = createAction('HIDE_AND_SHOW_SIDE_PANEL');+ const hideMapControls = createAction('HIDE_MAP_CONTROLS');++ const hiddenMapControl = {+ visibleLayers: {+ show: false,+ active: false+ },+ mapLegend: {+ show: false,+ active: false+ },+ toggle3d: {+ show: false+ },+ splitMap: {+ show: false+ }+ };++ // plugin 2 actions+ const testReducer = keplerGlReducer+ // 1. as reducer map+ .plugin({+ 'HIDE_AND_SHOW_SIDE_PANEL': (state, action) => ({+ ...state,+ uiState: {+ ...state.uiState,+ readOnly: !state.uiState.readOnly+ }+ }),+ })+ .plugin(handleActions({+ // 2. as reducer+ 'HIDE_MAP_CONTROLS': (state, action) => ({+ ...state,+ uiState: {+ ...state.uiState,+ mapControls: hiddenMapControl+ }+ })+ }, {}));++ const testInitialState = testReducer(undefined, registerEntry({id: 'test3'}));+ const previousValue = testInitialState.test3.uiState.readOnly;++ // dispatch action+ const updatedState = testReducer(testInitialState, hideAndShowSidePanel());+ t.equal(updatedState.test3.uiState.readOnly, !previousValue, 'should call hideAndShowSidePanel');++ // dispatch action 2+ const updatedState2 = testReducer(testInitialState, hideMapControls());+ t.equal(updatedState2.test3.uiState.mapControls, hiddenMapControl, 'should call hideMapControls');++ t.end();+});