leaflet

Leaflet geoJson layers hidden outside viewport

不打扰是莪最后的温柔 提交于 2020-01-22 03:24:05
问题 I have a leaflet map with a few layers on it. Whenever layers are not in the viewport, they are hidden untill panning has completed: Regular view with layers: Panning right, to show layers outside viewport: Panning stopped: As illustrated above, the layers will first become visible once panning has stopped and mouse(finger) released. I have tried the following, which didn't work var map = L.map('map',{ bounceAtZoomLimits: false, removeOutsideVisibleBounds: false}).setView([40, 0], 2); L

Convert array of intensity points to Markers

徘徊边缘 提交于 2020-01-22 01:31:07
问题 So I have this code. Heat map has already been added but now I need to add the markers for each of the place that has intensity point. I have the latitude and longitude and also intensity. I also want to show the data using that marker. I have this code and I am unable to add marker for each intensity point and display the data. <html> <head> <title>Leaflet HeatMap </title> <meta charset="utf-8" /> <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" /> </head> <body

Leaflet layers Z-index

守給你的承諾、 提交于 2020-01-21 23:44:53
问题 I need to set z-index (control what is in foreground) between leaflet layers. It is possible to e.g. control between 2 (or more) geoJson layers or between 2 (or more) ImageOverlay layers, with bringToFront, bringToBack functions. L.geoJson layer is always over L.imageOverlay layer and I need to set imageOverlay to be over GeojJson. Is this possible in Leaflet? 回答1: Yes, but not using bringToFront and bringToBack . You need to use custom panes in the 1.0.0 version. See this post on GIS.SE and

Show only United States when using Leaflet.js and OSM

别来无恙 提交于 2020-01-21 04:27:29
问题 I'm using leaflet.js and OSM tiles to create a map, but I'd only like the continental United States to be viewable, not the entire world. Is that possible? I'm loading the map like this: var map = L.map('map').setView([39.82, -98.58], 5); L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', { attribution: '...', maxZoom: 18 }).addTo(map); 回答1: That's possible and easy to do. First of you'll need the coordinates for the bounding box (the outermost edges) of the continental

How to set the zIndex layer order for geoJson layers?

不打扰是莪最后的温柔 提交于 2020-01-21 03:20:53
问题 I would like to have certain layers to be always on top of others, no matter in which order they are added to the map. I am aware of bringToFront() , but it does not meet my requirements. I would like to set the zIndex dynamically based on properties. Leaflet has the method setZIndex() , but this apparently does not work for geoJson layers: https://jsfiddle.net/jw2srhwn/ Any ideas? 回答1: Cannot be done for vector geometries. zIndex is a property of HTMLElement s, and vector geometries (lines

maximum number of svg elements for the browser in a map

跟風遠走 提交于 2020-01-20 21:46:30
问题 I am creating a map with leaflet and d3. A lot of circles will be plotted on a map. In terms of browser compatibility, there is an expected limit of how many svg elements the browser can render. In terms of user experience however, I would prefer that the user can see as many elements on the map as possible (otherwise the user might need to zoom in and out constantly and would need to wait for the ajax to return data). There will be some optimisation that I need to consider (user waiting time

Incorporation Ordnance Survey map into sheetsee.js plugin in Leaflet

不想你离开。 提交于 2020-01-16 20:18:11
问题 I would like to have the Ordnance Survey map shown in my Sheetsee.js map. The example comes from this plugin: https://github.com/jlord/hack-spots I tried both OS API for leaflet that has been more described here: https://gis.stackexchange.com/questions/342571/incorporation-the-ordnance-survey-map-to-sheetsee-js-plugin-for-leaflet-mapbox?noredirect=1#comment559596_342571 and recently also with OS OpenSpace example, where I replaced: // create map, tilelayer (map background), markers and popups

sync d3.js map and leaflet map

十年热恋 提交于 2020-01-16 18:02:48
问题 In one application I have both d3 map and leaflet map, I follow Mike's code to sync them(http://bost.ocks.org/mike/leaflet/) and draw svg points on leaflet map. The problem is that some points being cutoff at the edge of SVG container, and other SVG elements added later on (an animated pulse in this case) will only partially shown. I wonder if there's anyway to expand the SVG container based on the features (points) bound. a working demo is here: http://xqin1.github.io/usschools/usac_school

sync d3.js map and leaflet map

我与影子孤独终老i 提交于 2020-01-16 18:00:09
问题 In one application I have both d3 map and leaflet map, I follow Mike's code to sync them(http://bost.ocks.org/mike/leaflet/) and draw svg points on leaflet map. The problem is that some points being cutoff at the edge of SVG container, and other SVG elements added later on (an animated pulse in this case) will only partially shown. I wonder if there's anyway to expand the SVG container based on the features (points) bound. a working demo is here: http://xqin1.github.io/usschools/usac_school

Leaflet with Webpack in Rails 6. L.timeline is not a function

只愿长相守 提交于 2020-01-16 08:43:08
问题 This looks just like the question @rossta answered for Gmaps, but I don't understand the problem and answer well enough to make his suggestion work. The error is: Uncaught TypeError: L.timeline is not a function at Object.success (mapTwo.js:14) Line 14 is var timelineData = L.timeline(data_data, { . Complete code below. I removed the leaflet gems that work in Rails 5.2 and in console yarn add leaflet yarn add leaflet.timeline and code: // app/javascript/packs/application.js import "core-js