mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
support for GeoJSON attached to map
This commit is contained in:
parent
d1638aea31
commit
201d6f881c
@ -1,4 +1,4 @@
|
||||
import { TileLayer, MapContainer, useMapEvents } from "react-leaflet";
|
||||
import { TileLayer, MapContainer, useMapEvents, GeoJSON } from "react-leaflet";
|
||||
import "leaflet/dist/leaflet.css";
|
||||
import * as React from "react";
|
||||
import { Geometry, Item, LayerProps, UtopiaMapProps } from "../../types"
|
||||
@ -20,6 +20,7 @@ import { toast } from "react-toastify";
|
||||
import { useClusterRef, useSetClusterRef } from "./hooks/useClusterRef";
|
||||
|
||||
|
||||
|
||||
export interface MapEventListenerProps {
|
||||
selectNewItemPosition: LayerProps | Item | null,
|
||||
setSelectNewItemPosition: React.Dispatch<any>,
|
||||
@ -35,7 +36,8 @@ function UtopiaMap({
|
||||
width = "100%",
|
||||
center = [50.6, 9.5],
|
||||
zoom = 10,
|
||||
children }
|
||||
children,
|
||||
geo}
|
||||
: UtopiaMapProps) {
|
||||
|
||||
function MapEventListener(props: MapEventListenerProps) {
|
||||
@ -123,6 +125,7 @@ function UtopiaMap({
|
||||
)
|
||||
}
|
||||
</MarkerClusterGroup>
|
||||
{geo && <GeoJSON data={geo} />}
|
||||
<MapEventListener setSelectNewItemPosition={setSelectNewItemPosition} selectNewItemPosition={selectNewItemPosition} setItemFormPopup={setItemFormPopup} />
|
||||
</MapContainer>
|
||||
<AddButton triggerAction={setSelectNewItemPosition}></AddButton>
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { LatLng, LatLngTuple, latLng } from "leaflet";
|
||||
import { ItemFormPopupProps } from "./Components/Map/Subcomponents/ItemFormPopup";
|
||||
|
||||
export interface UtopiaMapProps {
|
||||
@ -8,6 +7,7 @@ export interface UtopiaMapProps {
|
||||
zoom?: number,
|
||||
tags?: Tag[],
|
||||
children?: React.ReactNode,
|
||||
geo?: any
|
||||
}
|
||||
|
||||
export interface LayerProps {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user