An Open-Source JavaScript Library for Mobile-Friendly Interactive Maps

learn more… | top users | synonyms (1)

6
votes
2answers
238 views

Access GeoJSON from GitHub in Leaflet

I am new to JSON, GitHub, and Leaflet. But I am trying to create a simple application which will render my points which are in GeoJSON up on GitHub. From everything I have read this should work. ...
0
votes
1answer
355 views

How to draw a rectangle on a Leaflet map from GeoJSON data

I am trying to draw a rectangle on a Leaflet map with JSON data which looks like this. var geojsonfeatures = {"type":"FeatureCollection","features":[ {"type":"Feature", "geometry":{"...
1
vote
2answers
22 views

Remove Leaflet markers _leaflet_id

So I want to remove some markers that are created on a button click. If I use map.removeLayer() it removes the layer and also I set the array.length = 0, which resets the containing layer. However, if ...
0
votes
1answer
62 views

Leaflet Client Side rendering

A project I am working on contains 15 different layers with 5 containing over 50,000 polygons in each layer. Some of these layers must be "queryable" for data (ex: click to get more information of ...
0
votes
0answers
22 views

Remove thumbnail of Qgis from wms,wfs layer

I have created one Qgis map server for serving map as wms or wfs feature. As i am adding the layers in QGIS various thumb nail of Qgis is coming which i donot want them to appear in my map. Same thing ...
0
votes
1answer
253 views

How to calculate a map scale with bounding box, width and height?

I have a map that will allow the user to select or slice images/pictures out of it. As example a map width is 1200px * 1200px and the user selects say 700px x 700px square (note: aspect ratio is ...
1
vote
0answers
26 views

Leaflet Server Side rendering [duplicate]

A project I am working on contains 15 different layers with 5 containing over 50,000 polygons in each layer. Some of these layers must be "queryable" for data (ex: click to get more information of ...
2
votes
2answers
803 views

How to tell if a GeoJSON path intersects with another feature in Leaflet?

I have an application where the user draws a path (a series of connected straight lines) and this path may not intersect any feature in a particular GeoJSON layer. I need to check that no point along ...
1
vote
3answers
2k views

leaflet-routing-machine add waypoints, routing summary

I'm playing around with leaflet-routing-machine (https://github.com/perliedman/leaflet-routing-machine) and have 2 questions about it's usage: 1) I have the following code now routeControl = L....
1
vote
1answer
246 views

Leaflet popups events through CartoDB

How I can use the leaflet popups events throught CartoDB. I have seen that some events are working like 'click', 'movestart',but 'popupclose' and 'popupopen' are not working. My goal is to do some ...
0
votes
1answer
45 views

Select one feature of multiple overlapping features (here polygons) on a Leaflet map

I have a map with multiple polygons rendered on it which can overlap eachother. I use leafletPip.pointInLayer(point, layer) from https://github.com/mapbox/leaflet-pip for determining which polygons do ...
4
votes
1answer
4k views

select two markers & draw line between them in leaflet

I am very much new to leaflet. I have multiple markers plotted on my map in leaflet. now I have to draw line between two markers when I select them. Can any one help in doing this.
0
votes
0answers
42 views

Mapzen Turn-by-Turn routing in Leaflet Routing Machine with costings: “multimodal”

I wanto to setup a routing service for my leaflet map. The Route should route over pedestrian, train or bus. Mapzen Turn-by-Turn Routing is exactly providing this by using the option: costing: "...
3
votes
1answer
439 views

Leaflet.label and MarkerCluster problem with zoom dependent add/remove layers

Here's the setup: I have a leaflet map with point data, to which I have applied leaflet.label and leaflet.markercluster. I add the clustered point data at a particular zoom level (code below). All ...
1
vote
3answers
567 views

How to load geojson from geoserver to define a variable in leaflet?

How can I load a geojson file from geoserver in leafletjs? There are lot of suggestions out there, but none of them work for me. Currently my app loads a js file from the server that starts like this:...
0
votes
1answer
29 views

leaflet: javascript scope issue within geojson onEachFeature function

I'm new to javascript and even newer to Leaflet (version 0.7.7), so I'm having difficulty determining how to ask this question. With leaflet, when I click on a polygon, an ajax request is made, it ...
1
vote
1answer
185 views

How can track marker clicks in Leaflet?

How can I view which markers are being clicked on by users in Leaflet?
8
votes
2answers
6k views

Disable leaflet interaction temporary

How can I temporary disable zoming/draging the Mapview in Leaflet.js Tried so many ways but without any luck. It's important to make it temporary and I also need the option to enable again.
6
votes
1answer
87 views

Is it possible to use a raster::click event within an interactive leaflet map?

Data Download: https://www.dropbox.com/s/f849ra8l6umo9d8/crops.tif?dl=0 I have various raster images of the world that I would ultimately like to plot within an interactive leaflet map; an example is ...
1
vote
1answer
839 views

How can I project geojson borders on the google earth tiles in leaflet?

I started working with leaflet and google earth tiles. I want to add borders on my map so I tried to use the countries geoJson Data as a layer on the map. The problem is that the json borders ...
2
votes
1answer
241 views

Leaflet removing labels when any popup window is shown

I am newbie to leaflet and i found the following solution to add static labels to features in my map: L.CircleMarker.include({ bindLabel: function (content, options) { if (!this._label || ...
1
vote
3answers
250 views

Load a really big geojson to a feature layer in leaflet

I have this geojson file(about 60mB) that contains the administrative area boundaries. I want to make a chloropleth and give color based on each geometry properties value and add it to the ...
0
votes
1answer
22 views

Highlighting or marking property using node id in leaflet?

I am working on openstreetmap using leaflet.js, I found some difficulties in highlighting a way(road) using it's node ID of OSM data. I need to know is it possible or not?
1
vote
1answer
198 views

Add multiple strokes to Leaflet geojson feature path

Wondering if it's possible to add multiple strokes to a polygon or line feature (the same thing could apply to multiple fills for polygons too). The leaflet documentation on the L.Path style options ...
3
votes
1answer
2k views

How can I make a leaflet control open by default?

I'm using leaflet to display a map. I have a control section that I'd like to be open by default, but I can't find a way to do it through the API. Is there a way to do this?
1
vote
1answer
18 views

Leaflet - CRS.Simple custom scale?

I am displaying a gamemap using Leaflet. The map is nonwrapping. I use L.CRS.Simple which is recommended for this (and makes sense). I add multiple tilelayers, each created using gdal2tiles. The ...
0
votes
1answer
35 views

How to update position of markers with “real time gps coordinants”?

I've got real time gps positions for a few cars and I want to create a map with updating markers. My code works but it doesn't "update" the markers, instead it adds new objects with new coordinates to ...
2
votes
0answers
39 views

Leaflet.Draw only edit GeoJSON

I am trying to enable editing of a GeoJSON layer in my Leaflet map using Leaflet Draw. I need to allow only a single edit at a time before saving the results back to the database. I tried to implement ...
0
votes
1answer
282 views

Using Leaflet: How do I get it to display one popup based on a condition?

Using Leaflet: How do I get it to display one popup based on a condition. See below. basemap_0.addTo(map); var layerOrder=new Array(); function pop_thunder(feature, layer) { ...
-1
votes
0answers
11 views

How to apply levels to building using height?

I am using OSMBuilding classic 2.5D and leaflet versions, here i am not understanding how to apply levels to building using building height ? I have applied to geojson properties like "levels": 9, ...
0
votes
0answers
31 views

Write latlng array to gpx file

So I have this small application that stores some GPS values along a route as var position = [lat, lng, height] objects in an array. Now I would like to export this array as a .gpx file. I ...
0
votes
1answer
39 views

Adding drop-down menu to leaflet map to update map/tiles to new location?

What I want to do is create an interactive choropleth map that has a dropdown menu of various countries so that the map updates when you click on that country. As an example, here's an interactive ...
1
vote
0answers
29 views

GeoJSON path using d3

I've been trying to make an animated path using d3, JSON, and a list of coordinates. This is the result in JSFiddle: http://jsfiddle.net/5m35J/92/ As you can see, there is a red dot in the corner, ...
0
votes
1answer
2k views

Bootstrap navbar and leaflet zoom controls

I'm using the THE MAP GUY(DE) Bootstrap temple and applying it to leaflet using the code below. The issue I'm having is that the zoom-control doesn't toggle right on page load. It will only after ...
2
votes
2answers
200 views

Simplify GeoJSON by retaining external boundaries (clustering)

I created a website (http://www.cartescolaire.paris) that basically loads a GeoJSON and displays it on a map using Leaflet. This geoJSON is pretty large (over 2 Mb), the loading time can be very long ...
0
votes
0answers
37 views

Debugging Uncaught SyntaxError: Unexpected token : from WFS in Ajax request?

I am trying to insert a WFS layer into a Leaflet map; therefore I need to enable jsonp and want the output in json/geojson so Leaflet can consume it. However, I keep getting an error that I suspect is ...
0
votes
1answer
13 views

how do I map from a mapbox map or tile to the lat lon extents of the map?

A web app I use displays map tiles from mapbox and then uses leaflet to overlay that map with an svg path representing a route. The problem is that the area given to the map is very tiny, it's short ...
1
vote
0answers
35 views

Leaflet map with 'query of features' on mouseover and multiple layers

I have produced two working Leaflet maps that in total contain the features that I need for my application. However, I cannot solve how to have multiple 'overlay' layers that can be queried with ...
0
votes
1answer
579 views

Leaflet geoserver wms doesn't show on google map base layer

I have a site running Openlayers (base layer google and overlay wms in epsg4326 from geoserver). The site works fine. I've decided to try doing the same with leaflet , and from some reason I can't ...
2
votes
1answer
297 views

Draw heatmap only over water layer using Leaflet?

I need to draw a heatmap, but only over water because I want to represent water heat level. I am using Leaflet. How can I do it? I found an only-water layer, maybe it would be usefult for developing ...
1
vote
1answer
55 views

How to load html file with leaflet map using PyQGIS

I have simple .html file with leaflet map layers. I want to load these layers in QGIS mapCanvas with ability to choose one of the layers. How can I load this .html and show one of map layer with using ...
1
vote
1answer
209 views

CartoDB JSONP callback in leaflet-search plugin

long time reader, first time question-asker etc... So I'm trying to implement a search function on an app I'm building using data from cartodb in leaflet and this leaflet-search plugin: http://labs....
1
vote
1answer
573 views

Leaflet update getcenter coordinates

I am bringing in leaflet routing control into my map and I would like to have the route icons show up in the center of the current view. using the code below I can get the icons to show up at the ...
4
votes
2answers
5k views

How do I set the fillcolor of polygons in Leaflet.js dynamically?

I'm using the interactive chloropath example for leaflet.js I figured out how to make each of my polygons add a running tally of values to the bottom of the page after each polygon is clicked. Upon ...
1
vote
0answers
54 views

Can MapboxGL use nearest neighbour interpolation for overlay image? [closed]

In HTML+CSS version of mapbox/leaflet I can set image-rendering option for .leaflet-image-layer with CSS to choose interpolation method. How can I make this in GL renderer? UPD Solved You can set ...
2
votes
2answers
34 views

Can't continue scrolling on mobile devices when a map occupy all the screen

We have an issue on mobile which is the user can't keep scrolling if the there is a map on the page and it occupies the whole screen. Here is the code: // center of the map var center = [-33.8650, ...
1
vote
2answers
51 views

Issue in loading external geojson file into leaflet map?

I want to load an external geojson file into leaflet map. I created a global variable (i.e. tracts) for json file and referenced this variable in the script file. But i receive an error message that ...
0
votes
1answer
39 views

Display Popup from postgis db over WMS layer file using leaflets?

i want to display popup information over WMS service file that i published from geoserver and using it Leaflets. Below is the picture for illustration. Now i just want when user click any polygon ...
2
votes
2answers
46 views

Leaflet filled contour map

I have evaluated the Getis-Ord Gi*-spatial statistic for each point in my map. Like this, each point is assigned a Gi-score and due to this a certain color, as you can see in the image below. What I ...