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

learn more… | top users | synonyms (1)

3
votes
3answers
84 views

Automatically refresh my wfs layer in Leaflet when adding data in Postgis

I’ve built a web-sig based on postgis, geoserver and leaflet. My polylines, …, are stored in Postgis and I call them through Geoserver in Leaflet as wfs layers like : var defaultParameters = { ...
0
votes
1answer
1k views

Positioning leaflet divIcon when adjusting size using css

I am using the L.divIcon when using iconSize:null which is causing iconAnchor:[0,0] to not be recognized,my code looks like this: var divIcon =L.divIcon({ className:'current-location-icon', ...
1
vote
1answer
20 views

Leaflet / Mapbox.js: incorrect Popup offset using divIcon with CSS class

I'm having an error which I can't seem to find elsewhere online with Leaflet / mapbox.js regarding the offset of a popup from a marker's custom icon which has been set with L.divIcon and using a CSS ...
1
vote
1answer
22 views

Features disappear from Leaflet after zooming in

I have a Mapbox studio template which already looks the way I want it to, but when I put it in a Leaflet app, after I zoom in past level 17, a lot of the features disappear. Zooming in inside Mapbox ...
0
votes
1answer
430 views

Creating Leaflet layer that can be toggled in layer control from CartoDB viz.json?

How do I create a leaflet layer that can be toggled in the layer control from a cartodb viz.json? I have read that the cartodb.createlayer does not create a leaflet layer. It seems you can add the ...
2
votes
2answers
130 views

How to get current scale of a Leaflet map?

I've been looking through the Leaflet API to see if there is a getScale method or scale property of a map, and have't seen anything. Does anyone know if Leaflet provides a way to get the current map ...
1
vote
2answers
589 views

Polygon intersection with bounding box with polygon's holes intact

I am trying to serve GeoJSON FeatureCollection tiles with each feature's geometries trimmed to the tile boundary. I am working on a Leaflet plugin to re-assemble the geometries. It works by building ...
0
votes
0answers
19 views

Parallel visualizing in leaflet shiny

I want to visualize a large number (about 27000) of lines (streets of Amsterdam) on a base map (of Amsterdam), using leaflet and shiny in R. The opacity of these lines changes when a slider is moved. ...
7
votes
4answers
4k views

How do I stop event propagation with rightclick on Leaflet marker?

I didn't find a rightclick event in Leaflet markers so I started listening to the mousedown event. In the method that resolves this event I check if (event.originalEvent.button == 2) { ...
0
votes
1answer
283 views

Convert Leaflet WMS layer to Leaflet GeoJSON layer

Using the Leaflet API I am adding a WMS layer through the L.tilelayer.WMS feature. This feature includes only a certain amount of options such as 'layers','crs','style' etc. Through the Leaflet ...
0
votes
1answer
20 views

Export csv-coordinates to JSON - square brackets [closed]

I´ve got multiple point-layers that I want to join in a single JSON-file used for webmapping. The layers is to be listed in column by column like this: [55.778659,12.151137 ], [55.77272358,12....
0
votes
1answer
53 views

Create buffer around point with Turf

This code is not working and I don't know why? function getlatlong(b,d){ return b,d; } function buffer(feature){ var point = { type: 'Feature', geometry: { type: 'Point', ...
0
votes
2answers
26 views

How to access array inside of Leaflet LayerControl?

When you make a Leaflet LayerControl you first make an array of markers, then pass the array to the LayerControl constructor and add the LayerControl to the map, like this: myLayerGroup = L....
1
vote
2answers
44 views

Is there an editor for Leaflet JavaScript that has intellisense functionality?

Is there an editor for Leaflet JavaScript that has intellisense functionality? I've tried both Visual Studio 2015 and Visual Studio Code ... in 2015, if I type code like var geojsonlayer = L and ...
1
vote
1answer
35 views

Displaying raster images using Leaflet?

The purpose is to create a small web application using an open source product, preffered Leaflet (but I will Switch the product if it works within another Framework than leaflet), simply showing a ...
0
votes
1answer
30 views

What SRS does leaflet use when it creates new markers?

I'm using leaflet 0.7. I'm wondering what spatial reference system is used when a new marker is created? Also, how does this impact my use of maps? (I'm using leaflet .7 because of dependency ...
1
vote
1answer
236 views

Is there any method to retrieve SQL queries into a GeoJSON file using JSP?

I want to display the contents of my PostGIS database of various shape-files in leaflet pop-up dynamically. I know there are static methods available that retrieves attributes. But I need to by ...
1
vote
1answer
37 views

Realtime in Leaflet with Socket.io

I'm trying to get events on the client side and showing changes (new markers) in realtime on a leaflet map with socket.io. The problem is in defining data that comes from socket.. I don't know the ...
1
vote
1answer
26 views

Leaflet subdomains: if subdomain is down, attempt another

When giving leaflet an array of subdomains for a tile layer, how can I cause it to try a different subdomain if the attempted subdomain is down? For instance, adding this layer: var map = L.map( '...
0
votes
1answer
32 views

Projections leaflet and OSM

I downloaded data from OSM and extract lat/lng coordinates from a user who is clicking on a leaflet map. So my program returns the coordinates where a user clicked! I am wondering what crs I need to ...
10
votes
1answer
925 views

How to add an attribution on a GeoJSON Layer from Leaflet?

I need to use a GeoJSON Layer on my Leaflet map. Here is a sample of my code: function onEachFeature(feature, layer) { if (feature.properties && feature.properties.popupContent) { ...
0
votes
1answer
228 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
votes
1answer
291 views

How to filter polygons in Leaflet using range slider

I have a map I'm working on with Leaflet that displays a choropleth of zip code-level data. One piece of functionality I would like to add is to allow users to use a range slider to filter out ...
1
vote
1answer
34 views

Is it possible to cluster polygons in Leaflet?

Is it possible to cluster polygons in Leaflet? In a similar way to the Marker Cluster plugin
0
votes
1answer
306 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":{"...
0
votes
1answer
116 views

How do I store GeoJSON format in Firebase so it can be used for Leaflet GeoJSON

I am new with Firebase, Leaflet, and GeoJSON .. I have a question, how to store data with GeoJSON format in Firebase, so it can be retrieved and used for leaflets GeoJSON to display marker(s). I know ...
1
vote
3answers
3k views

How to update a popup content from its marker?

I created a popup with Leaflet doing so: marker.bindPopup(content).openPopup(); How can I update the content value afterwards? I suppose to do it from the marker, something like this: marker....
0
votes
1answer
264 views

serving UTFgrid information made with mb-util with leaflet

I've created the mbtiles file with tilemill and exported it on my ubuntu webfolder with the following command: mb-util --scheme=xyz /folder/tile.mbtiles /var/www/html/my-tiles To get utfgrid ...
1
vote
1answer
56 views

How to check if a leaflet layer is already added on the map?

I build a simple map app where I have a layer on top of a map. How can I check in leaflet, if the layer is already present?
1
vote
1answer
38 views

Leaflet javascript in popup

Can JavaScript be included in a leaflet popup? We have modified this example To this :- var this_marker = L.marker([51.5, -0.09]).addTo(mymap).bindPopup( '<div style="color: red">Hello<...
2
votes
1answer
48 views

How in-sync is the MapBox flavour of Leaflet with the FOSS version?

How in-sync is the MapBox flavour of Leaflet with the open source version? I'm concerned that if I got with the MapBox sku, I'll be locking myself into a non-standard version, so things like ... are ...
-3
votes
0answers
19 views

div 'map' in 3 part [duplicate]

I wanted to split the div 'map' of 3, part contains the map, another the legend and 3rd layers with leaflet image
2
votes
2answers
668 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 ...
0
votes
1answer
48 views

Leaflet Map Layout

I have been learning how to use leaflet recently and have create a number of maps which have all been full screen maps. I would like to understand how I would place other features on a web page along ...
0
votes
0answers
23 views

How import variable from leaflet.markercluster

Maybe someone can help me... How i can import variable from leaflet.markercluster if i using webpack. I can't find class, which i can import. https://github.com/SINTEF-9012/PruneCluster
3
votes
1answer
58 views

Click event returning wrong Y container point in Leaflet

I am using QGIS Server and Leaflet to display geotiffs on my website. I have created an onMapClick function which uses a GetFeatureInfo request to QGIS Server which returns the value of the geotiff in ...
0
votes
0answers
32 views

How to make leaflet image overlay draggable?

I simply want to make a georeferenced imageOverlay draggable in leaflet. I found several unanswered posts (e.g. here and here). Since it is easy to make markers draggable, someone tried to adapt the ...
3
votes
1answer
76 views

Leaflet printing does not show pins and map is shifted

I don't exactly why but whenever I try to print my leaflet map with layers, it shows the map a little shifted to the left as well as the pins are not quite ok. I tried using easyPrint() and window....
1
vote
3answers
41 views

Is it possible to limit the records retrieved from a GeoJSON file?

Is it possible to limit the records retrieved from a GeoJSON file? I have a data file in GeoJSON format that my Leaflet page loads from a local text file and displays as a series of markers But it's ...
18
votes
4answers
29k views

How to load external GeoJSON file into Leaflet map

I would like to load a geoJSON (polygon) file into my leaflet map. I have seen examples where geoJSON is embedded into the javascript code but I can't find any examples showing how it is done with an ...
14
votes
4answers
19k views

Custom Leaflet Controls

I have gotton some help in creating a custom control for leaflet, but I am still having trouble upgrading to the CSS styles used by the latest versions of Leaflet. Basically, all I need is a icon in ...
0
votes
1answer
30 views

Cannot get L.control.coordinate to work properly

I am trying to make a map modal with Leaflets that displays the lat./lng. coordinates in a box when the user clicks on the desired point. I got the popup given in the Leaflets tutorial to work fine ...
1
vote
1answer
821 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 ...
0
votes
0answers
12 views

how to update control content when adding it to map in leaflet

I have a control which displays its content based on the current map position. In the onAdd method I create its components but cannot style them using jquery methods (likely because they are not fully ...
1
vote
1answer
260 views

A problem with event firing upon mouseout

I'm trying to create a point map that displays information about a point in an info box upon user mouseover and changes the styling of the point. On mouseout, I want the info box and marker styling to ...
1
vote
1answer
29 views

Using createLayer in CartoDB isn't working

So, the scenario is I have a situation where users can look up multiple tables worth of data, and want to view them in an aggregate fashion. Based on certain filters, I get a list of tables then want ...
1
vote
3answers
233 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 ...
1
vote
1answer
189 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 ...
0
votes
0answers
13 views

Leaflet renders big lines

On opening the page i get this type of view.The lines are very thick. On clicking anywhere in the map it changes to 2nd picture.I am not being able to figure out why this is happening.
1
vote
1answer
15 views

Show html page(from different file) inside a leafleat marker

I am developing a web application and I would like to be able to show a full web page inside an L.marker popup window with fixed size... Until now I figured out how to run some php or html in the ...