leaflet

turf.nearestPoint only returning the same point

跟風遠走 提交于 2020-02-22 07:26:22
问题 I am making a Leaflet map. I am loading some geoJSON data. I have an on click function for the map. When I click I simply want to alert the nearest point from the loaded geoJSON. The problem is that only one point is returned no matter where I click in the city ( the point shown in the image below. //Create the map var map = L.map('mapdiv').setView([-43.534384, 172.640528], 13); // Add the basemap L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href=

R Leaflet Offline Tiles within Shiny

徘徊边缘 提交于 2020-02-13 16:30:02
问题 Is it possible to load offline/local leaflet map tiles within a Shiny app? I am able to load the tiles in an interactive R session as shown here, but I now want to try and load them for use in a Shiny app. Here's an example of what I have so far. I'm thinking it has something to do with Shiny running through an IP and port and needing to load the tiles through an IP and port as well. I've tried a few things to change IPs and ports (making them the same) as explained here but haven't figured

R Leaflet Offline Tiles within Shiny

大憨熊 提交于 2020-02-13 16:15:12
问题 Is it possible to load offline/local leaflet map tiles within a Shiny app? I am able to load the tiles in an interactive R session as shown here, but I now want to try and load them for use in a Shiny app. Here's an example of what I have so far. I'm thinking it has something to do with Shiny running through an IP and port and needing to load the tiles through an IP and port as well. I've tried a few things to change IPs and ports (making them the same) as explained here but haven't figured

addlegend R Leaflet-based-on-user-input

柔情痞子 提交于 2020-02-08 02:31:07
问题 I am using Shiny's varSelectInput function to display a map with R Leaflet from spatialpolygondataframe, so that by selecting a variable of the object the map of the corresponding variable is drawn and I changed its color. For this I have generated a reactive object of the ColorBin function of R leaflet from conditional varSelectInput. All this when rendering the map works correctly and consequently the map is painted, updating the color and the title of the legend. However, when deploying

Remove Zoom control from map in react-leaflet

限于喜欢 提交于 2020-02-06 08:43:09
问题 I am building a react-leaflet application, and I am trying to separate the zoom control from the map itself. The same question in a vanilla Leaflet context was asked here: Placing controls outside map container with Leaflet?. This is what I'm trying to accomplish within the react-leaflet framework. Here is the general outline of my project: import UIWindow from './UIWindow' import Map from './MapRL' class App extends React.Component { render () { return ( <div className="App"> <Map />

Remove Zoom control from map in react-leaflet

北战南征 提交于 2020-02-06 08:43:04
问题 I am building a react-leaflet application, and I am trying to separate the zoom control from the map itself. The same question in a vanilla Leaflet context was asked here: Placing controls outside map container with Leaflet?. This is what I'm trying to accomplish within the react-leaflet framework. Here is the general outline of my project: import UIWindow from './UIWindow' import Map from './MapRL' class App extends React.Component { render () { return ( <div className="App"> <Map />

How to set tile_data from .mbtiles file as tiles for leaflet?

烈酒焚心 提交于 2020-02-05 04:09:09
问题 I'm developing a hybrid mobile app using meteorjs and cordova. App needs to have offline map support. I exported a .mbtiles file using Maperitive, of area that can be viewed offline and copied the file to my app so I can access it when loading tiles with Leaflet. For that i used cordova plugins for file system (to copy .mbtiles to the right place) and cordova sqlite plugin (for accessing .mbtiles data) and that part works, I can successfully load tile_data when leaflet requests tiles whit z,

Restrict the viewable part of a tile to a polygon area in Leaflet?

冷暖自知 提交于 2020-02-05 03:49:14
问题 In Leaflet, how does one restrict the viewable part of a tile to the area contained within a polygon (or geojson), i.e., the intersection between a polygon and the tile beneath. Example use : display only one country and hide all others. EDIT: I'm not looking for the fitBounds/setMaxBounds method but for a way to display only the inner area of a polygon. 回答1: You can use the map.setMaxBounds(L.latLngBounds) method to restrict the view. For restricting the map view: map.fitBounds(polygon

Force Leaflet popup to stay open when a draggable marker is moved

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-03 02:01:34
问题 I am working on a crowdsourcing app aimed at geotagging old pictures. I display a grid of image thumbnails and when I click on one it places a draggable marker on the map and opens the popup containing the image and associated details. This is done with: L.marker([newlat, newlng], { icon: movableIcon, draggable:true }).addTo(map).bindPopup(popupContent).openPopup(); This works, but as soon as a user drags the marker the popup closes, hiding the very thing that they are trying to set at the

Vue Leaflet map tiles in wrong order

陌路散爱 提交于 2020-02-02 11:28:27
问题 I just trying Vue Leaflet and trying to use this example. But when I try it in my local server, the map has wrong order. Here's my code <template> <div class="home"> <l-map :zoom="zoom" :center="center"> <l-tile-layer :url="url" :attribution="attribution"></l-tile-layer> <l-polygon v-for="s in shapes" :key="s.id" :color="s.color" :lat-lngs="s.geometry.coordinates" @l-mouseover=change_color(s) > </l-polygon> </l-map> </div> </template> <script> import { LMap, LPolygon, LTileLayer } from 'vue2