Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
71 votes
7 answers
159k views

Loading 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 ...
  • 1,261
49 votes
14 answers
45k views

Converting ArcGIS Server JSON to GeoJSON?

I'm creating a web map using Leaflet, and I want to be able to grab feature layers from our ArcServer. I have successfully been able to retrieve a feature class as JSON, but Esri's JSON objects don't ...
  • 7,315
8 votes
3 answers
3k views

Great circles in QGIS and export in 3857 web map

My plan is to visualize great circles in a Leaflet web map. So coming from this great postgis article and R version I thought it would work like this in QGIS: create a line from two points, store ...
  • 2,566
48 votes
5 answers
157k views

Showing popup on mouse-over, not on click using Leaflet?

Is it possible in Leaflet that popup opens on mouse-over, not on click? This is working for just one marker at a time, but I need it for a bigger number of markers: marker.on('mouseover', function(e)...
  • 4,968
20 votes
1 answer
67k views

How to change Leaflet Map panes layering order (z-index)?

Leaflet maintains that the Map panes elements contain all layers added to the map. The difference between many of the Map panes is strictly the z-index order of layering. I would like to use a ...
15 votes
2 answers
23k views

leaflet geojson coordinate problem

I just started to play with leflet/geojson a little. But my coordinates are not rendered properly and I have no clue what is going on. My coordinates are: 52.23943, 4.97599. They work correct with ...
  • 2,496
1 vote
1 answer
4k views

Splitting a polygon by multiple linestrings leaflet and turf.js

I am trying to implement an utility for land subdivision using leaflet and turf. I am not sure if these tools are the right ones for the task. I've got it right for most of the scenarios but sometimes ...
117 votes
8 answers
94k views

Choosing OpenLayers or Leaflet? [closed]

I was debating with one of my collegues on OpenLayers v/s Leaflet. I made a point that OpenLayers is much better API if we wish to build a project, where you need direct connectivity to the Geoserver ...
  • 4,335
17 votes
3 answers
47k views

Displaying properties of GeoJSON in popup on Leaflet?

This is my simple GeoJSON with Leaflet map. I want to display properties as popup but I don't know why it is empty. Can you tell me my mistake? <html> <head> <title>A Leaflet map!...
  • 171
11 votes
2 answers
18k views

How to add Geoserver WFS to Leaflet JS Application

I have a PostGIS database and have successfully consumed a table into GeoServer and published a WFS. Are there REST endpoints available for these WFS' akin to ESRI's feature services? How are ...
9 votes
1 answer
28k views

Combine Leaflet with Geoserver WMS map

I'm not very skilled within the GIS world, however, I would like to know if it's possible to use this map: http://wfs-kbhkort.kk.dk/k101/wms?service=WMS&version=1.1.0&request=GetMap&...
6 votes
1 answer
8k views

Multiple on-the-fly filtering based on markers' features on leaflet

I would like to filter the markers on my (geojson) layer according to two features: year and type of event, ideally using both filters (year and eventType) as check-boxes without using layerGroup at ...
2 votes
1 answer
1k views

Small features don't draw when zoomed out using Geoserver WMS

I am using Leaflet to access polygon layers through Geoserver WMS. When I zoom out the smallest polygons will disappear and not draw. They would essentially be a dot if they did draw. Is there a way ...
1 vote
2 answers
2k views

GeoJSON does not appear on my Leaflet map

I'm a beginner in Leaflet and I need help to deal with GeoJSON files. I succeeded in creating a Leaflet basemap. I can add markers without troubles but I cannot manage to show a GeoJSON layer. Here ...
  • 31
14 votes
1 answer
25k views

How to label geojson points in Leaflet?

How to show labels for geojson points in a Leaflet map? There is Leaflet.label that is now deprecated in favour of L.Tooltip, but that only shows text on hover. I want to show the text labels ...
  • 27.9k
14 votes
1 answer
29k views

Overriding Leaflet tooltip style?

I'd like to override the default style of Leaflet 1.0.0 tooltips, especially the bubble/frame. I don't see any options or methods for this. How do I hook into the CSS? I want to change layers ...
  • 5,732
4 votes
3 answers
5k views

Leaflet proj4leaflet with multiple projections

I am looking at having both EPSG4326 tiles and EPSG3857(cloudmade) tiles on a single map (but separate layers). I have been looking at the proj4leaflet plugin, and it "appears" to me that this might ...
  • 1,367
2 votes
0 answers
725 views

Polygon intersection using turf js

I have given this code for intersection: function intersectPolyByPolyFC(poly,fcPoly){ var fgp=[];//variable for feature group var bbPoly=turf.bboxPolygon(turf.bbox(poly));//polygon ...
1 vote
1 answer
3k views

How to add a bounding box filter to this leaflet WFS request?

I use this function to add an interactive layer to my leaflet application. It works great in most browsers, but fails due to time-out error on certain networks and browsers. The solution I think is to ...
0 votes
1 answer
2k views

Turf intersect point with Leaflet GeoJSON error

Leaflet and Turf. I am trying find all the layers on a Leaflet map that intersect a point when the user clicks on the map. I am using the turf library to test for this. In the console when I click on ...
  • 4,320
60 votes
7 answers
13k views

Creating Vector Polygons with rendering performance like GISCloud?

I have been looking for a solid solution which would allow me to create a web map and overlay vector polygons without taking forever to load such data with the goal of allowing me to make each polygon ...
33 votes
3 answers
50k views

Adding/Removing GeoJSON layers using Leaflet

I am trying to show different GeoJSON layers at different zoom layers using the Leaflet API. I can load and display all three layers at once (though I do not actually want them all to show at once). ...
  • 1,162
31 votes
4 answers
36k 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.
  • 493
17 votes
1 answer
87k views

Adding a search box to a Leaflet.js example

Consider the example in the following link for Folium: US Employment visualization per county. The result looks like what you see below:     I would like to add a search box to it to be ...
16 votes
2 answers
7k views

How can I make a polyline wrap around the world?

I am using leaflet maps to create a representation of a round-the-world challenge. I would like to add a polyline which heads east from tokyo and then appears west of south america on the map - but ...
15 votes
2 answers
17k views

Placing controls outside map container with Leaflet?

Can someone tell me how I can place controls outside of the map content with Leaflet? In this case, I just want to place the layer switch control outside the map object.
10 votes
4 answers
5k views

Advantages of WFS over GeoJSON/KML?

I'm planning to create an online map with openlayers (2 or 3) or leaflet. I have to show some points/markers (~30.000), polygons (~500) and lines on top of an OSM map in several layers. Those points ...
  • 273
10 votes
3 answers
24k views

Leaflet layers on different zoom levels. How?

I've added a polygon layer and a point layer to my leaflet map. I would like the points to appear after a certain zoom level or when a "click" event occurs e.g. (polygons.on("click", function....) ...
  • 581
9 votes
4 answers
43k views

Getting WFS data from Geoserver into leaflet

I'm trying to use a ajax call to load WFS data from geoserver into a GeoJson layer in leaflet. When I do the following message in the console: XMLHttpRequest cannot load http://localhost:8080/...
  • 688
9 votes
1 answer
14k views

Leaflet GeoJSON with projected coordinates (3857)

I am trying to get a GeoJSON with projected coordinates to show in Leaflet. I have no problems loading GeoJSON with lat/lng (EPSG:4326). Here is a fiddle where I load the GeoJSON with unprojected lat/...
8 votes
2 answers
11k views

What does the default crs being EPSG:3857 in Leaflet mean?

In the documentation of leaflet, it says the following about the projection that is being used: L.CRS.EPSG3857 The most common CRS for online maps, used by almost all free and commercial tile ...
user avatar
7 votes
1 answer
24k views

Filtering GeoJSON data to include in Leaflet map

I am trying to filter through my geojson polygons and get all data entries with a specific attribute. I have a layer of polygons describing parks around the city parks.json. I want the user to click ...
6 votes
2 answers
24k views

How to edit an existing layer using leaflet?

I am used to working with OL3 and I wanted to try using leaflet and see if it is as powerful as OL. I loaded a map with some data from a GeoServer WFS layer using this tutorial from Georepublic. var ...
6 votes
2 answers
13k views

Load a raster file directly in Leaflet

Is it possible to load a raster file (e.g. GeoTIFF or Erdas img) directly into a Leaflet map? If so, can you guide me to the correct documentation or method to do this? I am trying to do this with the ...
  • 485
6 votes
1 answer
6k views

Tile names & coordinates relationship

I'm aware that this site is intended for cartographers, geographers and GIS professionals. I must admit that I'm absolute beginner in the area of maps, but not in the area of programming (40+). I hope ...
  • 20.3k
5 votes
4 answers
5k views

Can Geoserver return the raster value of a lat/lon point

I have a GeoTIFF published by Geoserver 2.2 and being used by Leaflet via WMS. How can I get Geoserver to return the raster value at a lat/long point? I'm guessing it has to do with using WCS, but ...
  • 1,647
4 votes
1 answer
4k views

How to access Leaflet EPSG:3857 coordinates?

I read everywhere that Leaflet is internally using a spherical web mercator (EPSG:3857), but whatever I try I get either Lat/Lon (EPSG:4326) or strange coordinates I dont understand: map.getBounds()....
  • 2,156
4 votes
1 answer
13k views

How do I get GeoJSON data from GeoServer into show up on my Leaflet map?

I'm trying to create a simple "Green" map for my city. The idea being that it is a website with a map and layers you can turn on and off. I am serving the data through GeoServer and am using GeoJOSN ...
  • 298
3 votes
2 answers
11k views

GTA V coordinates to LatLng

I'm here because I'm trying to create a GTA V map with Leafletjs API. In deed, I've got my tiles that are ready. But the aim is to put markers on the map by using GTA V in-game coordinates. To achieve ...
2 votes
1 answer
1k views

Leaflet side by side plugin is not working with imageOverlay

I'm trying to use the side by side plugin. I already check in the issues and change the getContainter() with getPane() in the .js file. this._divider.style.left = dividerX + 'px' this.fire('...
  • 103
0 votes
1 answer
2k views

Displaying selected layers depending on zoom in Leaflet

It looks like I found the problem between the document.querySelector and map.on('zoomend') function. I was going to set the zoom level for switching off some layers, what has been raised here: ...
  • 3,643
35 votes
1 answer
39k views

What is the default projection in Leaflet?

I've read an API documentation for Leaflet on its site, but I can't realize: what is a default projection to view maps? It was written about spherical and elliptical Mercator and Equirectangular - so ...
  • 451
19 votes
2 answers
15k views

What is the most common way of displaying geodata from Postgis on Leaflet?

For example, in my database I've some points with geographic coordinates. I want to display them on Leaflet JS layer. Which instruments should I use? Maybe there is some API...
18 votes
1 answer
39k views

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

I built a simple map app where I have a layer on top of a map. In Leaflet, how can I check if the layer is already present?
  • 2,584
17 votes
2 answers
39k views

Loading vector tile layer in Leaflet map?

I need to load a vector tile layer in a Leaflet map. The vector tile is the vector tile layer about Mapillary sequences (look at https://a.mapillary.com/#vector-tiles ...), and the tile URL pattern ...
  • 1,913
16 votes
1 answer
3k views

How to copy the color styling to a color column in a layer's attribute table?

I have a polygon layer in QGIS that I have applied a random color style to each polygon. Under Layer Properties -> Style I selected a Categorized style and then generated a random color ramp. I added ...
15 votes
2 answers
41k views

Leaflet: How to move the layer-control menu?

This might be a silly question, but I could not find a documented way to achieve this. I'd like to freely position the layer-control menu, probably to the top left near the default zoom-in/out button....
  • 560
15 votes
3 answers
55k views

Is it possible to convert regular JSON to GeoJSON?

I have JSON data I've exported from Openpaths.cc which contains lat and lon values. However, the data is not in GeoJSON format so can't be read by OGR2OGR. Could anyone point me in the right direction ...
  • 1,745
14 votes
5 answers
31k views

Changing layer order in Leaflet

I would like to be able to change the order of the layers in Leaflet. I tried implementing two Leaflet plugins in order to change the layer order. First I tried leaflet-control-orderlayers, which ...
  • 612
11 votes
2 answers
31k views

Fly To Location in Leaflet

Is it possible to 'fly to location' in Leaflet in the same way as this Mapbox GL example?

1
2 3 4 5
9