Browse Source

layerlist

master
Irul24 1 year ago
parent
commit
0e0e82baa5
  1. 124
      src/component/mapCollectScreen.tsx

124
src/component/mapCollectScreen.tsx

@ -27,8 +27,9 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
const [modalInputLocation, setmodalInputLocation] = useState(false); const [modalInputLocation, setmodalInputLocation] = useState(false);
const [modalBasemap, setmodalBasemap] = useState(false); const [modalBasemap, setmodalBasemap] = useState(false);
const [modalLayerList, setmodalLayerList] = useState(false); const [modalLayerList, setmodalLayerList] = useState(false);
const [isSelectedLayer1, setSelectionLayer1] = useState(false); const [isSelectedLayerPDAM, setSelectionLayerPDAM] = useState(false);
const [layerList,setLayerList] = useState('') const [isSelectedLayerPermit, setSelectionLayerPermit] = useState(false);
const [layerList,setLayerList] = useState(['pdams','permits','pjus'])
const getLocation = () => { const getLocation = () => {
Geolocation.getCurrentPosition( Geolocation.getCurrentPosition(
@ -51,7 +52,7 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
await RNFetchBlob.config({ await RNFetchBlob.config({
trusty : true trusty : true
}) })
.fetch('GET', `https://c557-117-102-73-102.ngrok-free.app/catalog`,{ .fetch('GET', `https://de36-117-102-73-102.ngrok-free.app/catalog`,{
"Accept": 'application/json', "Accept": 'application/json',
"Content-Type": "application/json", "Content-Type": "application/json",
} }
@ -149,58 +150,62 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
mapStyle={styleURL} mapStyle={styleURL}
zoomEnabled={true} zoomEnabled={true}
compassEnabled={false} compassEnabled={false}
> >
<VectorSource
id="pdams" {/* Layer Visibility */}
url="https://c557-117-102-73-102.ngrok-free.app/pdams" {
tileUrlTemplates={["https://c557-117-102-73-102.ngrok-free.app/pdams/{z}/{x}/{y}"]} isSelectedLayerPDAM ?
onPress={(e)=>{ <VectorSource
console.log(e.features[0].properties?.nama);
Alert.alert(e.features[0].properties?.nama)
}}
>
<LineLayer
sourceID="pdams"
sourceLayerID="pdams"
id="pdams" id="pdams"
style={{lineColor:'red',lineWidth:3}} url="https://de36-117-102-73-102.ngrok-free.app/pdams"
/> tileUrlTemplates={["https://de36-117-102-73-102.ngrok-free.app/pdams/{z}/{x}/{y}"]}
{/* {isSelectedLayer1 ? onPress={(e)=>{
console.log(e.features[0].properties?.nama);
: Alert.alert(e.features[0].properties?.nama)
null
} */} }}
</VectorSource> >
<VectorSource <LineLayer
id="permits" sourceID="pdams"
url="https://c557-117-102-73-102.ngrok-free.app/permits" sourceLayerID="pdams"
tileUrlTemplates={["https://c557-117-102-73-102.ngrok-free.app/permits/{z}/{x}/{y}"]} id="pdams"
onPress={(e)=>{ style={{lineColor:'blue',lineWidth:3}}
console.log(e.features[0].properties?.company_name); />
// Alert.alert(e.features[0].properties?.nama) </VectorSource>
:null
}} }
> {
<LineLayer isSelectedLayerPermit ?
sourceID="permits" <VectorSource
sourceLayerID="permits"
id="permits"
style={{lineColor:'red',lineWidth:3}}
/>
{/* <FillLayer
id="permits" id="permits"
style={{ url="https://de36-117-102-73-102.ngrok-free.app/permits"
fillColor: ['interpolate', ['linear'], ['zoom'], 0, '#eeddbb', 2, '#0daa00', 3, '#bbbbee'], tileUrlTemplates={["https://de36-117-102-73-102.ngrok-free.app/permits/{z}/{x}/{y}"]}
fillOpacity:0.5 onPress={(e)=>{
console.log(e.features[0].properties!.company_name);
Alert.alert(e.features[0].properties!.company_name)
}} }}
/> */} >
{/* {isSelectedLayer1 ? <FillLayer
sourceLayerID="permits"
id="some-fill-feature"
style={{
fillColor: ['interpolate', ['linear'], ['zoom'], 0, 'blue', 2, 'black', 3, 'grey'],
fillOpacity:0.5
}}
/>
<LineLayer
sourceLayerID="permits"
id="linelayer1"
style={{lineColor:'red',lineWidth:3}}
/>
</VectorSource>
:null
}
:
null
} */}
</VectorSource>
{!delayRender ? {!delayRender ?
<> <>
<PointAnnotation <PointAnnotation
@ -392,16 +397,25 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
/> />
</Pressable> </Pressable>
</View> </View>
<View style={{flexDirection:'column',marginTop:'10%',padding:20}}> <View style={{flexDirection:'column', marginTop:'10%',paddingStart:'10%',paddingEnd:'10%'}}>
<View style={{flexDirection:"row",alignItems:'center',justifyContent:'space-around'}}> <View style={{flexDirection:"row",alignItems:'center',justifyContent:'flex-start',borderBottomColor:'#A6A6A6',borderBottomWidth:2,padding:5}}>
<Text style={{color:'black',fontWeight:'400',fontSize:16}}>Administrasi Kecamatan Jakut</Text>
<CheckBox <CheckBox
disabled={false} disabled={false}
value={isSelectedLayer1} value={isSelectedLayerPDAM}
onValueChange={(newValue) => setSelectionLayer1(newValue)} onValueChange={(newValue) => setSelectionLayerPDAM(newValue)}
/> />
<Text style={{color:'black',fontWeight:'400',fontSize:16}}>Pipa PDAM</Text>
</View>
<View style={{flexDirection:"row",alignItems:'center',justifyContent:'flex-start',borderBottomColor:'#A6A6A6',borderBottomWidth:2,padding:5}}>
<CheckBox
disabled={false}
value={isSelectedLayerPermit}
onValueChange={(newValue) => setSelectionLayerPermit(newValue)}
/>
<Text style={{color:'black',fontWeight:'400',fontSize:16}}>Land Permit</Text>
</View> </View>
</View> </View>
</View> </View>
</Modal> </Modal>

Loading…
Cancel
Save