atlregional / MAHS-Data-Explorer

0 stars 0 forks source link

Map Component #8

Closed spinozist closed 3 years ago

spinozist commented 4 years ago

Get started with...

Get Boundary GeoJSONs using utils.getData(url) within component and set into boundaryGeo state variable like so...

const { boundaryGeos, setBoundaryGeos } = useState();

const boundariesConfigArray = [
{
   name: 'cities',
   visible: true,
   url: 'https://arcgis.atlantaregional.com/arcgis/rest/services/OpenData/FeatureServer/58/query?where=County10%20%3D%20%27YES%27&outFields=OBJECTID,Name,County10,Sq_Miles&outSR=4326&f=geojson'
},
{
   name: 'counties',
   visible: true,
   url: 'https://arcgis.atlantaregional.com/arcgis/rest/services/OpenData/FeatureServer/68/query?where=Reg_Comm%20%3D%20%27ATLANTA%20REGIONAL%20COMMISSION%27&outFields=*&outSR=4326&f=geojson'
}
];

const getBoundaries = boundariesConfigArray => {
  const boundariesObj = {};

  boundariesConfigArray.forEach(boundaryConfig => 
   utils.getData(boundaryConfig.url).then(res =>
      boundariesObj[boundaryConfig.name] = res.data
  );

  setBoundaryGeos(boundaryObj);

}

example DataNexus getGeoJSONs()

: null



Build out with imported components...
- [x] GeoJSON layers (census tracts data, county boundaries, subareas)
- [x] Legend displaying color bins and values for selected indicator when data layer is visible
- [x] GeoJSON Layer selector
- [x] TileLayer Selector

## ADD DATA
- [x] Create styling function to set color for features based on selected indicator
- [x] Use function in style property of GeoJSON
spinozist commented 4 years ago

Was able to setBoundaryGeos by using Promise.all()

JohnSasser commented 3 years ago

Should be ready to be closed.