react-leaflet

How do I clear a leaflet map in react so I can map fresh data?

这一生的挚爱 提交于 2021-01-07 04:09:55
问题 I am attempting to clear a leaflet map in react when fetching new data to map, and i am unsure how to approach this. I saw this post but not sure how exactly to apply it. Right now I have a function that fetches 1 of 2 geojsons I have loaded. App.js //SWAP FILES AS EXAMPLE fetchData = () => { //MAP SHOULD CLEAR EVERYTIME NEW DATA IS FETCHED if(this.state.loaded === 1) { fetch( "https://raw.githack.com/datafaust/raw/main/cruise-prototype/hh_2020112300_2020120623_Saturday_02.geojson" ) .then(

React-Leaflet: Scale markers after zooming

此生再无相见时 提交于 2021-01-01 09:13:09
问题 I'm trying to achieve having markers on a CRS map (specifically a circular avatar with initials) that scale with the map's zoom (they would appear larger or smaller depending on the zoom, not remain the same size), and have been having considerable difficulty achieving performance. I've tried two different components for the avatars, (still not sure which is right solution): Circle component with a simple, permanent tooltip inside (this component is convenient because it automatically scales)

React-Leaflet: Scale markers after zooming

℡╲_俬逩灬. 提交于 2021-01-01 09:08:32
问题 I'm trying to achieve having markers on a CRS map (specifically a circular avatar with initials) that scale with the map's zoom (they would appear larger or smaller depending on the zoom, not remain the same size), and have been having considerable difficulty achieving performance. I've tried two different components for the avatars, (still not sure which is right solution): Circle component with a simple, permanent tooltip inside (this component is convenient because it automatically scales)

React-Leaflet: Scale markers after zooming

非 Y 不嫁゛ 提交于 2021-01-01 09:08:29
问题 I'm trying to achieve having markers on a CRS map (specifically a circular avatar with initials) that scale with the map's zoom (they would appear larger or smaller depending on the zoom, not remain the same size), and have been having considerable difficulty achieving performance. I've tried two different components for the avatars, (still not sure which is right solution): Circle component with a simple, permanent tooltip inside (this component is convenient because it automatically scales)

react-leaflet get current latlng onClick

故事扮演 提交于 2020-12-30 07:29:58
问题 I would be realy happy if some one could help me... I've installed react-leaflet on my react project and the map component is loaded successfully, i need to get current latlng and show it in the Popup when i click on map but I don't know how to :( please... please... help me... this is my code import React from 'react' import { Map as LeafletMap, TileLayer, Marker, Popup } from 'react-leaflet'; class Mapp extends React.Component { componentDidMount() { } render() { return ( <LeafletMap center

cannot configure example-events for react-leaflet v3 to play

為{幸葍}努か 提交于 2020-12-15 06:48:32
问题 I am trying to set up a react app for the following example https://react-leaflet.js.org/docs/example-events but cannot make it work due to compile errors. The same example in v2 works for me. import React, {Component,useState} from 'react' import { MapContainer, TileLayer, Marker,useMapEvents } from 'react-leaflet' import Popup from 'react-leaflet-editable-popup' function LocationMarker() { const [position, setPosition] = useState(null) const map = useMapEvents({ click() { map.locate() },

Rendering GeoJSON with react-leaflet

ⅰ亾dé卋堺 提交于 2020-11-30 06:49:29
问题 I've got simple component to pick point on map and then display some GeoJSON data related to this point: import React, { Component } from 'react'; import { Map, Marker, TileLayer, GeoJSON } from 'react-leaflet'; import 'leaflet/dist/leaflet.css'; import { connect } from 'react-redux'; import './style.css'; import { setPoint, fetchData } from '../../actions/map'; @connect(store => { return { map: store.map } }) class MyMap extends Component { mapClick(e) { this.props.dispatch(setPoint(e.latlng