Added Context menu for building
This commit is contained in:
@@ -5,11 +5,12 @@ import { Popup, useMap } from "react-leaflet";
|
||||
|
||||
export const ContextMenu = () => {
|
||||
const map = useMap();
|
||||
const { popup, setSearchElements, setPopup } = useMapStore();
|
||||
const { popup, setSearchElements, setPopup, setSearchPopup } = useMapStore();
|
||||
|
||||
useEffect(() => {
|
||||
map.on("contextmenu", (e) => {
|
||||
setPopup({ isOpen: true, lat: e.latlng.lat, lng: e.latlng.lng });
|
||||
setSearchPopup(undefined);
|
||||
});
|
||||
}, [popup]);
|
||||
|
||||
@@ -61,8 +62,8 @@ export const ContextMenu = () => {
|
||||
`https://overpass-api.de/api/interpreter?data=${encodeURIComponent(`
|
||||
[out:json];
|
||||
(
|
||||
way["building"](around:50, ${popup.lat}, ${popup.lng});
|
||||
relation["building"](around:50, ${popup.lat}, ${popup.lng});
|
||||
way["building"](around:100, ${popup.lat}, ${popup.lng});
|
||||
relation["building"](around:100, ${popup.lat}, ${popup.lng});
|
||||
);
|
||||
out body;
|
||||
>;
|
||||
@@ -90,7 +91,6 @@ export const ContextMenu = () => {
|
||||
};
|
||||
}),
|
||||
);
|
||||
console.log(data);
|
||||
}}
|
||||
>
|
||||
<Search size={20} />
|
||||
|
||||
Reference in New Issue
Block a user