generated from RENCI/react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added location marker when obs feature clicked
- Loading branch information
Showing
3 changed files
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import useLayers from '../context/map-context'; | ||
import { StacApiProvider } from "stac-react"; | ||
//import { useLayers } from '@context'; | ||
import locationIcon from '@images/location_searching_FILL0_wght400_GRAD0_opsz24.png'; | ||
|
||
const { | ||
/* const { | ||
defaultModelLayers, | ||
setDefaultModelLayers, | ||
filteredModelLayers, | ||
setFilteredModelLayers | ||
} = useLayers(); | ||
} = useLayers(); */ | ||
|
||
|
||
// Utilities to access the stac catalog items to load on map | ||
const stacCatalog = ({stacUrl}) => { | ||
// function to add a location marker where ever and obs mod layer | ||
// feature is clicked icon downloaded as png from here: | ||
// https://fonts.google.com/icons?selected=Material+Symbols+Outlined:location_searching:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=location | ||
export const markClicked = (map, event) => { | ||
|
||
const targetIcon = L.icon({ | ||
Check warning on line 17 in src/utils/map-utils.js GitHub Actions / eslint
|
||
iconUrl: locationIcon, | ||
iconSize: [38, 38], | ||
iconAnchor: [19, 19], | ||
popupAnchor: [0, 0], | ||
}); | ||
|
||
L.marker([event.latlng.lat, event.latlng.lng], {icon: targetIcon}).addTo(map); | ||
Check warning on line 24 in src/utils/map-utils.js GitHub Actions / eslint
|
||
}; |