leaflet

Disable popup window while using the measure tool in leaflet

本小妞迷上赌 提交于 2020-07-09 05:25:09
问题 I am using a measure plugin tool in leaflet but when I try to measure between markers the pop up window interfers is there a way to fix this? I read something about oddclicks, I tried using that to no avail. $(".leaflet-control-measure").click(function() { var oddClick = $(this).data("oddClick"); $(this).data("oddClick", !oddClick); if (!oddClick) { map.off('click', popup); } else { map.on('click', popup); } }); popup logic- I am reading from a database, the popup is called from python in a

Disable popup window while using the measure tool in leaflet

瘦欲@ 提交于 2020-07-09 05:24:11
问题 I am using a measure plugin tool in leaflet but when I try to measure between markers the pop up window interfers is there a way to fix this? I read something about oddclicks, I tried using that to no avail. $(".leaflet-control-measure").click(function() { var oddClick = $(this).data("oddClick"); $(this).data("oddClick", !oddClick); if (!oddClick) { map.off('click', popup); } else { map.on('click', popup); } }); popup logic- I am reading from a database, the popup is called from python in a

Fit map to bounds exactly

社会主义新天地 提交于 2020-07-09 03:38:38
问题 Is there a way to fit the map exactly to bounds? (or as close a possible). For example, in this jsfiddle, even without padding the map leaves a lot of padding above and below the points: http://jsfiddle.net/BC7q4/444/ map.fitBounds(bounds); $('#fit1').click(function(){ map.fitBounds(bounds); }); $('#fit2').click(function(){ map.fitBounds(bounds, {padding: [50, 50]}); }); I'm trying to fit a map as precisely as possible to a set of bounds that closely match the map shape without all the extra

Vue2-leaflet map not showing properly in BoostrapVue modal

假装没事ソ 提交于 2020-07-09 03:19:10
问题 Here's my problem - a Vue2 leaflet map does not render correctly in BootstrapVue modal. Here's what it looks like visually (it should show just the ocean) <template> <div> <b-modal size="lg" :visible="visible" @hidden="$emit('clear')" title="Event details"> <div class="foobar1"> <l-map :center="center" :zoom="13" ref="mymap"> <l-tile-layer :url="url" :attribution="attribution"></l-tile-layer> <l-marker :lat-lng="center"></l-marker> </l-map> </div> <template slot="modal-footer"> <b-btn variant

How to assign popup on map polygon that corresponds with the country R leaflet

妖精的绣舞 提交于 2020-07-09 03:00:27
问题 I am trying to write a script that would allow people to click on a country then a popup would appear and show the country's name and corresponding value. I have successfully created the map and the boundaries of each country, however when you click on, for example Russia, the popup would show India. Below is a simplified version of the script: library(leaflet) library(maps) countries <- c("Australia", "South Africa", "India", "Mexico", "USA", "Russia") values <- c(1,2,3,4,5,6) bounds <- map(

How to assign popup on map polygon that corresponds with the country R leaflet

人盡茶涼 提交于 2020-07-09 03:00:08
问题 I am trying to write a script that would allow people to click on a country then a popup would appear and show the country's name and corresponding value. I have successfully created the map and the boundaries of each country, however when you click on, for example Russia, the popup would show India. Below is a simplified version of the script: library(leaflet) library(maps) countries <- c("Australia", "South Africa", "India", "Mexico", "USA", "Russia") values <- c(1,2,3,4,5,6) bounds <- map(

when to use L.TileLayer vs L.tileLayer

允我心安 提交于 2020-07-03 03:49:29
问题 I have just been using Leaflet to build a map for a website and noticed that to add a Tile Layer at least two methods can be used, L.TileLayer() and L.tileLayer() , differing in their name only by the case of a single character. However, while the object returned by both of these methods can be added to a map object returned by L.map() the object returned by L.TileLayer() does not seem to have the addTo() method whilst the object returned by L.tileLayer() . E.g. both var map = L.map('map');

when to use L.TileLayer vs L.tileLayer

戏子无情 提交于 2020-07-03 03:49:04
问题 I have just been using Leaflet to build a map for a website and noticed that to add a Tile Layer at least two methods can be used, L.TileLayer() and L.tileLayer() , differing in their name only by the case of a single character. However, while the object returned by both of these methods can be added to a map object returned by L.map() the object returned by L.TileLayer() does not seem to have the addTo() method whilst the object returned by L.tileLayer() . E.g. both var map = L.map('map');

Converting Geojson to Shapefile in Javascript using shp-write

隐身守侯 提交于 2020-06-29 04:18:45
问题 I'm using Mapbox, and I'm trying to convert a Geojson to a zipped shapefile using shp-write. But when I follow the example given on the GitHub page, I'm getting a "ReferenceError: require is not defined" error on this line: var shpwrite = require('shp-write'); This is a jsfiddle in which you can test this. I'm relatively new to JavaScript, and haven't had to use the 'require()' function before. 回答1: The jsfiddle you provided includes several external resources, among which a shpwrite

Popup on a shape using tmap

耗尽温柔 提交于 2020-06-27 17:09:15
问题 I have made a map unsing tmap to include in a shiny app using leaflet . I have roughly what I want: a thematic map with fill color based on a SpatialPolygonsDataFrame, and when you click the map, a popup with extra information on the polygon. I would like to change the popup for a better layout when clicking. By default, the name in the dataset is displayed, but it is not really user friendly. Here is a reproducible example. library(tmap) library(leaflet) data(Europe) tmap_mode("view") carte