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

learn more… | top users | synonyms (1)

3
votes
1answer
8k views

Go to the URL when clicked on Leaflet marker

I want to implement marker click event so when user click on marker it goes to url. Url is written inside an array (a[3]). However, this is my code which doesn't work, it always goes to the link of ...
3
votes
2answers
8k views

How to open popup menu on right click in Leaflet

I want to open a popup menu list on right click with Leaflet map. I have tried the ContextMenu of leaflet but couldn't do it. Here is the sort of code I used. map.on('contextmenu', L.popup() ....
3
votes
3answers
99 views

Projection issues with Leaflet - polygon appears off

Using Leafletjs to upload coords from a json file as a polygon. The original coordinates are Vicgrid94(3111). I used QGIS to change the projection to LatLng (4326). When I load the points onto my ...
3
votes
1answer
360 views

Navigate two leaflet maps

I am looking for an example where there would be multiple map divs containing leaflet maps. When one is panned I want the other one to pan or zoom with it so they are always in sync.
3
votes
1answer
6k 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 ...
3
votes
3answers
239 views

GeoJSON Rendering in Leaflet

I have published a wms using the QGIS Cloud and on top of it I am overlaying the same data (countries of Europe), using GeoJSON. Have a look at an example here: http://jsfiddle.net/j21kh7ao/ At a low ...
3
votes
1answer
12k views

Leaflet: How do you use removeLayer?

This is driving me mad. See the Leaflet tutorial for adding a layer control to your map: L.Icon.Default.imagePath = "Scripts/images"; var mapUrl = 'http://{s}.tile.openstreetmap.se/hydda/full/{z}/...
3
votes
2answers
3k views

leaflet and geojson tiles

New to mapping. Trying to create a heat map with data that updates every hour for US Counties with leaflet.js similar to http://leaflet.cloudmade.com/examples/choropleth-example.html. But, adding ...
3
votes
3answers
803 views

How to pull lat/lng from a map canvas and update a database

So if i want to pull out lat/lngs after user clicks on a map canvas (lat/lngs are pulled using any javascript API (leaflet, wax etc.) and add this to a postgresql database using a query, how do i do ...
3
votes
2answers
865 views

How to generate legend in leaflet webmap?

Although I have checked the "Create Legend" option in the qgis2leaf plugin, it did not generate any legend in the output webmap. What am I missing here ?
3
votes
1answer
2k views

Display a link in a popup with Leaflet

Hey there! Im working with the Leaflet javascript library. There should be an option to click on my map and view a popup. I already have a code for that: var popup = L.popup(); function onMapClick(...
3
votes
3answers
1k views

Offline Map Service with Mapnik and Leaflet

I'm relatively new to GIS, so I hope my asking doesn't appear to be ignorant in any way. I currently work on an offline map service solution for usage in areas without internet connection. For that ...
3
votes
3answers
870 views

Is it possible to check incoming GeoJSON to see if any of the features are identical to existing ones before adding to map?

I am working on a Rails/PostGIS app and doing a typical ajax call to retrieve GeoJSON within the map viewport bounds. Whenever the map is shifted or zoomed all of the markers are removed and then ...
3
votes
2answers
214 views

Convert data to another Coordinate Reference System

Assuming I've a point like this : POINT (751318 9760879) This point is in EPSG:27700 coordinate reference system. How do I convert the point to display in a map with EPSG3857 coordinate ...
3
votes
2answers
1k views

GeoJSON formatting for Leaflet

I am using http://GeoJSON.io as the source for my data, which is then to be displayed via Leaflet.js. I found that leaflet neads the file to include "var name = {" but GeoJSON.io doesn't like it, ...
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?
3
votes
2answers
791 views

Slippy map format

When do you decide which to use? I've started using Geoserver and it seems like map files are downloaded to the browser (using Leaflet) in the WFS format. When I look at OSM, Mapbox etc, they use ...
3
votes
1answer
3k views

Leaflet - how can I call custom js after drawing polygon?

I want to draw a polygon on a leaflet map and afterwards send it to the DB and retrieve all objects that intersect that polygon. In Openlayers I did it by using custom function in "featureAdded:" ...
3
votes
1answer
892 views

How to save a Leaflet or OpenLayers map for opening later?

Can a webmap state be saved to a text file or something for restoring later? Like if I set up a map with a particular zoom and choose my layers and draw a polygon or two, can it be saved to a file and ...
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 = { ...
3
votes
3answers
746 views

Prevent Leaflet from requesting non-existing custom tiles

I have created custom tiles using TileMill. extracted tiles as png images and adding them on base layer. using following code var venu_map = new L.tileLayer('static/b18/{z}/{x}/{y}.png', { ...
3
votes
2answers
1k views

How do you get the nodes of an area in Overpass API in the “right” order?

I use the Overpass API to get the boundary of an OSM relation. I then use the result to display the boundary on a leaflet map. My problem is however, that the nodes are not in the "right order". ...
3
votes
1answer
2k views

GeoJSON, circlemarkers using the Leaflet OverlappingMarkerSpiderfier plugin

I am wondering if I can use the Leaflet OverlappingMarkerSpiderfier plugin with my circlemarkers. I've loaded a GeoJSON file and added circlemarkers using; var gj = L.geoJson(route, { pointToLayer:...
3
votes
1answer
775 views

Get bounding box of WMS

Is it possible to request the bounding box of a WMS from GeoServer? In my case I have a WMS that I show with L.TileLayer.WMS in a Leaflet map. I like to center and zoom my map to the WMS.
3
votes
2answers
4k views

Make sidebar div active on Marker click (and vice versa)?

What's the best way to change an element to active when you click on a marker. For example, when you click on a marker on a Leaflet map, how to make it so the sidebar element that's related to it ...
3
votes
2answers
106 views

Mixing coodinate systems

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 in an area of ~10x10 kilometers in several layers. ...
3
votes
1answer
251 views

looking for an esri compatible javascript engine

I work on an esri heavy team, i'm looking for a mapping engine that will give me flexibility to build on top of and leverage only the pieces I need and or add more as the app grows. I've been using ...
3
votes
2answers
2k views

OpenLayers vs Leaflet for specific app

Could anybody give me some advice on which one should I use? OpenLayers or Leaflet I will implement OSM on a web-app for taxi management. The requirements for the map part are: Tracking of the ...
3
votes
2answers
2k views

Leaflet WMTS layer

I would like to start using Leaflet instead of OpenLayers, but I can't find a way to load WMTS layer into the map. Is that possible with Leaflet, or do I have to stick with OL? I haven't found ...
3
votes
2answers
3k views

Animated lines and line styles in Javascript

I'm using Leaflet library and Mapbox. I need to create animated line from one city to another, slow motion "travelling" from one point to another point. Is that possible in javascript and how? I can ...
3
votes
1answer
67 views

How to make WFS request using LeafletJS

In the past I have used OL extensively in order to make WFS requests to Geoserver and add layer on a map. Now I am trying to learn LeafletJS and I want to do something similar. I have made a WMS ...
3
votes
1answer
134 views

Leaflet pop-up does not work with Geojson data

I have a geojson file(Polygons).I want to display it on a leaflet map and when user clicks on a polygon, a popup with an information should be visible. The information is 'type'. I am able to see the ...
3
votes
2answers
172 views

Leaflet JS - Add text to circles

I am trying to create a map using Leaflet with circles that indicate distances on the map at current zoom level (map scale). See illustration below: I know how to calculate sizes and update the ...
3
votes
2answers
154 views

Move leaflet polygon to given position

I have a circle and a polygon that I'd like to move to the user's local position. I managed to move the circle latLng but I can't find a way to do the same thing with a polygon. Can someone help me ...
3
votes
1answer
189 views

Leaflet map loads incorrectly when inside a Bootstrap .collapse element

I'm trying to create a Leaflet map which is hidden when the page loads, and revealed when the user clicks a button. I'm trying to use the Bootstrap collapse functionality to reveal the map on a ...
3
votes
2answers
365 views

Generate HTML file with R using Leaflet

I try to display the France map on HTML with RStudio; I followed the tutorial to the World card in Creating an interactive map with leafle; Example works. I wanted to do the same just by displaying ...
3
votes
1answer
351 views

Put LeafletJS geoJSON's into a MySQL database through PHP

I'm doing a project that will let users manipulate a map through LeafletJS, creating circles and polygons on top of the map. I need to gather these inputs for later analysis, using a MySQL database ...
3
votes
1answer
901 views

How to make transparent the background of a WMS layer in Leaflet

I have inserted the following layer from a geoserver in the following Leaflet map : var nexrad = new L.TileLayer.WMS("URL", { layers: 'Wrecks:WrecksGreaterNorthSea', format: 'image/png', ...
3
votes
1answer
6k views

How to style specific polygons from a geojson with Leaflet

I have a World Countries geojson, that has country codes as "ID" (feature.id) and names as feature.properties.name I would like to color specific countries for making a "countries visited" map. ...
3
votes
1answer
2k views

getActiveLayers for LeafletJS

I'd like to identify the layers that are currently active (which basemap is currently in view and which overlays are currently turned on). Was hoping to find something akin to getActiveLayers in the ...
3
votes
4answers
669 views

Where to host private CartoDB/Leaflet web app

I am looking for suggestions/recommendations on where to host my cartodb/leaflet map site. It needs to be private with authorized users and have a document management system. So, I was thinking ...
3
votes
2answers
245 views

How to display information in a div outside the map?

I tried a bit around and created a simple map with two polygons(most of the code I got from the Interactive Choropleth Map Tutorial). I added a "L.control()" to show information about the polygons in ...
3
votes
1answer
1k views

How to control the order of appearance of markers using leaflet?

I'm plotting out markers from GeoJSON files onto my Leaflet map. Some of these markers overlap so now I want to control the order of appearance of these markers so that one type always sits above the ...
3
votes
1answer
609 views

GeoServer 2.3.0 Proxy Setting

I've upgraded to GeoServer 2.3.0 running on Apache Tomcat 7.0.39 on my host WebFaction. My websites and GeoServer are on same host but different ports. How do I go about setting a proxy so that my ...
3
votes
2answers
3k views

How do I project my WMS tilelayer in leaflet if I want it to display as an overlay on my basemap if they have different EPSG?

So my basemap is a world Mercator projection and in wfs format and I'm trying to put a WMS overlay in a different projection over it? Leaflet's API didn't give me much info on changing the epsg so is ...
3
votes
1answer
44 views

How do I set the width and height of a popup using QGIS2Web and Leaflet

I am a newbie to editing javascript. I want to set the Max width and height of the popup that QGIS2Web generates with a Leaflet map (I have quite a lot of text in the attributes and will need a ...
3
votes
1answer
50 views

Packing polygons without intersection and empty places [closed]

How can I pack polygons without empty places and intersections? Please tell me everything that might help me (API, algorithms, etc.) I'm using: USPS API to get carrier routes. dbscan.js to ...
3
votes
1answer
132 views

Leaflet Choropleth Map

I'm trying to create a choropleth map using leaflet. When running the code below the map just comes up with each county being the same color. How do I get each county to be colored based on the data ...
3
votes
1answer
169 views

Leaflet: How to style my polygons in a GeoJSON layer?

I am trying to figure out why my polygons are not changing color based on a value I have in my GeoJSON. I've set up a hypothetical test here to replicate my issue here. JSFIDDLE link here My data ...
3
votes
4answers
85 views

Problem in ubuntu loading geoserver wms layer in local server with leaflet

I am just starting to work with geoserver. I am trying to do the same openlayers-geoserver example but using leaflet to view the map instead of openlayers: Publishing a shapefile This code is not ...