Skip to content

Commit

Permalink
Fixes #1260: validate shapefile geometries bbox before zoom (#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarto authored Nov 9, 2016
1 parent 006cf4e commit 9ec1c06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/client/components/shapefile/ShapefileUploadAndStyle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ const ShapeFileUploadAndStyle = React.createClass({

// calculates the bbox that contains all shapefiles added
const bbox = this.props.layers[0].features.reduce((bboxtotal, feature) => {
return [
return (feature.geometry.bbox[0] && feature.geometry.bbox[1] && feature.geometry.bbox[2] && feature.geometry.bbox[3] ) && [
Math.min(bboxtotal[0], feature.geometry.bbox[0]),
Math.min(bboxtotal[1], feature.geometry.bbox[1]),
Math.max(bboxtotal[2], feature.geometry.bbox[2]),
Math.max(bboxtotal[3], feature.geometry.bbox[3])
];
] || bboxtotal;
}, this.props.bbox);
if (this.state.zoomOnShapefiles) {
this.props.updateShapeBBox(bbox);
Expand Down

0 comments on commit 9ec1c06

Please sign in to comment.