react-leaflet#FeatureGroup JavaScript Examples
The following examples show how to use
react-leaflet#FeatureGroup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LandlordsMap.js From landlord with MIT License | 6 votes |
function LandlordsMap({parcels, source, zipCodeFeatures}) {
const classes = useStyles();
return <>
{zipCodeFeatures &&
<FeatureGroup>
{zipCodeFeatures.map(zipCodeFeature => <ZipCodeGeoJson key={zipCodeFeature.properties.ZIP} feature={zipCodeFeature}/>)}
</FeatureGroup>
}
<MarkerClusterGroup>
{parcels.map(parcel => {
return (
<Marker position={[parcel.LAT_LONG.lat, parcel.LAT_LONG.long]} key={parcel.PIN}>
<Popup>
<div className={classes.popupTitle}>{parcel.OWNER_NAME}</div>
<div className={classes.popupContent}>{parcel.ADDRESS_LA}</div>
<div className={classes.popupContent}>{parcel.PROP_CITY}, NE {parcel.PROP_ZIP}</div>
<div className={classes.popupContent}><a href={`/landlord/${source}/${parcel.PIN}`} target="_blank" rel="noreferrer">Property Detail</a></div>
</Popup>
</Marker>
)
})}
</MarkerClusterGroup>
</>;
}
Example #2
Source File: OtherLayer.js From react-sample-projects with MIT License | 6 votes |
OtherLayer = () => {
return (
<Map center={defaultCenter} zoom={13}>
<TileLayer
attribution='&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<LayerGroup>
<Circle color="yellow" radius={400} center={whiteHouse} />
<Circle color="green" radius={200} center={eisenhowerOffice} />
</LayerGroup>
<FeatureGroup opacity={1} color="tomato">
<Circle color="red" radius={200} center={washingtonMountain} />
<Circle color="blue" radius={200} center={lincolnMemorial} />
<Circle color="magenta" radius={200} center={worlwarTwoMemorial} />
<Circle color="purple" radius={200} center={jeffersonMemorial} />
</FeatureGroup>
</Map>
);
}
Example #3
Source File: GeoWikipediaLayerFunc.jsx From Zulu with MIT License | 5 votes |
export default function GeoWikipediaLayer({lat, lng, maxDist, cluster}) {
const [data, setData] = useState([]);
useEffect(() => {
if (lat && lng && maxDist) {
const abortController = new AbortController();
fetchData(lat,lng, maxDist, {signal: abortController.signal}).then(data => {
setData(data);
});
// cancel fetch on component unmount
return () => {
abortController.abort();
};
}
}, [lat, lng, maxDist]);
var GroupComponent = cluster ? MarkerClusterGroup : FeatureGroup;
return (
<GroupComponent>
{data.map(f => (
<Marker
key={JSON.stringify(f)}
position={[f.coordinates[0].lat, f.coordinates[0].lon]}
icon={iconWiki}
>
<Popup minWidth={300} closeButton={true} closeOnClick={false} autoClose={false}>
<Card background='#2980B9' height="200" >
<div style={{marginLeft:"auto" ,marginRight:"auto", height: "200px", overflowY: "scroll"} }>
<a href={"https://en.wikipedia.org/?curid="+f.pageid} style={{color:"black",textDecoration:"none"}}>
<h3>{f.title}</h3>
</a>
{ f.hasOwnProperty('thumbnail') ?
<img display="inline-block" src={parseImagePath(f.thumbnail.source)} style={{maxHeight: "200px", maxWidth: "200px"}}></img>
:
<p ></p>
}
<p id="desc" style={{float:"left",dir:"rtl",color: "black",fontWeight: "bold" ,lineHeight: "18px"}}>
{f.extract}
</p>
</div>
</Card>
</Popup>
</Marker>
))}
</GroupComponent>
);
}
Example #4
Source File: GeojsonLayerFunc.jsx From Zulu with MIT License | 5 votes |
export default function GeojsonLayer({lat, lng, maxDist, cluster}) {
const [data, setData] = useState([]);
useEffect(() => {
if (lat && lng && maxDist) {
const abortController = new AbortController();
StoryService.getUserStories(lng, lat, maxDist).then(response => setData(response.data));
// cancel fetch on component unmount
return () => {
abortController.abort();
};
}
}, [lat, lng, maxDist]);
var GroupComponent = cluster ? MarkerClusterGroup : FeatureGroup;
return (
<GroupComponent>
{data.map(f => (
<Marker
key={JSON.stringify(f)}
position={f.geometry.coordinates.reverse()}
>
<Popup minWidth={400} closeButton={true} closeOnClick={false} autoClose={false}>
<Card background='#2980B9' height="400">
<h3>{f.story.title}</h3>
<h5>Added by {f.user_id} </h5>
{ f.story.hasOwnProperty('image_id') && f.story.image_id != null ?
<img src={parseImagePath(f.story.image_id)} style={{maxHeight: "430px", maxWidth: "430px"}}></img>
:
<p></p>
}
<p style={{'font-size': "12px"}}>{f.story.content}
</p>
</Card>
</Popup>
</Marker>
))}
</GroupComponent>
);
}