Skip to content

Commit

Permalink
fix(geojson): Add properties to isochrone to make them valid GeoJSON
Browse files Browse the repository at this point in the history
BREAKING CHANGE: closes #121
  • Loading branch information
trevorgerhardt committed Dec 5, 2018
1 parent efd9ad5 commit bdebd99
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/selectors/isochrones.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import {createSelector} from 'reselect'
export default createSelector(
state => get(state, 'data.networks'),
state => get(state, 'timeCutoff.selected'),
state => state.map,
(networks = [], timeCutoff, mapData) =>
networks.map((network, index) => {
if (network.showOnMap && network.travelTimeSurface && network.travelTimeSurface.data) {
return getIsochrone(network, index, timeCutoff)
(networks = [], timeCutoff) =>
networks.map((n, i) => {
if (n.showOnMap && n.travelTimeSurface && n.travelTimeSurface.data) {
return getIsochrone(n, i, timeCutoff)
}
})
)
Expand Down Expand Up @@ -42,5 +41,13 @@ const getIsochrone = (network, index, timeCutoff) => {
})

// create the key for react-leaflet/GeoJSON here
return {...isochrone, key: toKey(network, index, timeCutoff)}
return {
...isochrone,
key: toKey(network, index, timeCutoff),
properties: {
name: network.name,
origin: [network.originPoint.x, network.originPoint.y],
timeCutoff
}
}
}

0 comments on commit bdebd99

Please sign in to comment.