Skip to content

Commit

Permalink
Working vector layer overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Barron committed Dec 9, 2019
1 parent 1f3d567 commit 27a3ac8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { point, featureCollection } from '@turf/helpers';
export class Map extends React.Component {
state = {
waypoints: null,
nationalParkBoundariesVisible: false,
};

componentDidMount() {
Expand Down Expand Up @@ -83,6 +84,26 @@ export class Map extends React.Component {
/>
</MapboxGL.ShapeSource>
)}

{this.state.nationalParkBoundariesVisible && (
<MapboxGL.VectorSource
id="nationalParkBoundaries"
url="https://tiles.nst.guide/nationalpark/tile.json"
onPress={event =>
console.log(event.nativeEvent.payload.properties)
}
ref={source => {
this._vectorSource = source;
}}
>
<MapboxGL.FillLayer
id="nationalParkFill"
sourceLayerID="nationalpark"
style={layerStyles.nationalParkFill}
visibility="visible"
/>
</MapboxGL.VectorSource>
)}
</MapboxGL.MapView>
</View>
);
Expand All @@ -96,6 +117,9 @@ const layerStyles = {
waypointCircle: {
circleColor: 'rgb(204, 50, 50)',
},
nationalParkFill: {
fillColor: 'rgb(0, 102, 0)',
},
};

const styles = StyleSheet.create({
Expand Down

0 comments on commit 27a3ac8

Please sign in to comment.