I am building a website using mapbox to render about 24mb of geojson data. I stored these data in backend server, the API request takes about 2300ms, and front-end map displaying those data would take over 10 seconds.
The GeoJson are river stream data which contains many MultiLineString
. Data is cleaned up.
Here are the steps:
Here is the data format: https://eflow.nyc3.digitaloceanspaces.com/class_geo_data/classGeo.json
My questions:
I am using react-map-gl
, not sure which version of mapbox gl is actually using.
Thanks Leo
Dependencies:
"babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-0": "^6.24.1", "copy-webpack-plugin": "4.3.1", "webpack-dotenv-plugin": "^2.0.2", "animate.css": "3.6.1", "axios": "0.18.0", "d3": "4.13.0", "flexboxgrid": "6.3.1", "get-json": "1.0.0", "immutable": "3.8.2", "material-ui": "0.19.4", "object-assign": "4.1.0", "react": "16.2.0", "react-dom": "16.2.0", "react-map-gl": "3.2.0", "react-redux": "5.0.5", "react-router-dom": "4.2.2", "react-router-redux": "5.0.0-alpha.6", "redux": "3.6.0", "redux-thunk": "2.1.0", "superagent": "3.8.1", "topojson": "3.0.2"
I am not sure why this is so much faster, but the correct way to do this is:
This is a complete different approach than my original one, which was to get data from my own API then have Mapbox render it. But it reduces the load speed down to 1-2 seconds from 10+ seconds