Questions tagged [leaflet]

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

Filter by
Sorted by
Tagged with
3 votes
1 answer
2k views

reusing cached tiles with leaflet, mbtiles and mbtiles-php

I am using Leaflet and infostream's fork of mbtiles-php to serve MBTiles stored on my server. I'm using a Leaflet layer group (and a layer control) to serve two MBTiles files. When I toggle between ...
grovduck's user avatar
  • 266
2 votes
1 answer
2k views

How to keep bound popups from opening on [click]?

I am working on a map application which creates and binds popups on markers and polyline objects. The popups are created and bound lazily, i.e. ad-hoc when a user clicks on a specific object. The ...
fgysin's user avatar
  • 570
5 votes
2 answers
3k views

binding nested arrays as geojson popups in leaflet

I am struggling with geojson popups in leaflet.js I have nested arrays as properties for my features - an example would be counts of fish caught at a location (not my actual project data!) {"type":"...
abenrob's user avatar
  • 175
4 votes
1 answer
582 views

How to set up a maximal zoom for polygons in Leaflet?

How to set up a maximal zoom for some layer, for example state polygons? I need that my US polygons which represent states have maxZoom 6, and when zoomed higher than 6, that US counties show up ...
againstflow's user avatar
  • 5,036
2 votes
0 answers
2k views

Problem with multipolygon in Leaflet

I'm using Leaflet L.Polygon, but for some reason there's only blank site. Here's my code: var map = L.map('map').setView([37.8, -96], 4); var cloudmade = L.tileLayer('http://{s}.tile....
againstflow's user avatar
  • 5,036
39 votes
1 answer
43k 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 ...
Anton's user avatar
  • 491
24 votes
5 answers
16k views

Database for offline slippy map tiles [closed]

I currently have an offline HTML5 map application (built on Leaflet & KendoUI with custom additions) that has an app manifest and works fine on multiple platforms. However, I am hesitant to use ...
Dr.YSG's user avatar
  • 1,367
10 votes
3 answers
7k views

Chart inside pop up window in Javascript

How to show a chart inside pop up window? I'm using Leaflet JS, which has support for raphael plugin http://dynmeth.github.com/RaphaelLayer/. Is it possible to create a div inside popup window? I was ...
againstflow's user avatar
  • 5,036
2 votes
1 answer
1k views

leaflet: Zooming a tile cache

I have a NASA BlueMarble tile layer that goes from zoom factors 0-8. I when I go to zoom level 9, I do see a momentary scaling to 9 (stretching pixels). But then, as expected, I get the errorTileUrl. ...
Dr.YSG's user avatar
  • 1,367
7 votes
4 answers
10k views

Leaflet / Google Map baselayer / markers not visible

New to Leaflet, currently trying to migrate a project from native Google Maps to Leaflet; having been drawn to Leaflet by the layer management and options of using better 'roadmap' style basemaps. ...
Dave Martin's user avatar
0 votes
3 answers
2k views

Using Leaflet, PostGIS and pgRouting for web mapping [closed]

I am new to Open Source GIS. I have already created a web mapping using custom tiles and Leaflet. I have used my own database. TileMill was used to create the tiles and Leaflet was used to visualize ...
Devils Dream's user avatar
  • 3,169
5 votes
1 answer
939 views

What platform to use for building mapping application using existing ArcGIS Rest Services? [closed]

I have clients that have an existing ArcGIS Server. Map layers are published as rest services and I am going to build a mapping application that displays their datasets. Functionality should include ...
jotamon's user avatar
  • 1,727
1 vote
1 answer
2k views

Is it possible to show migration arrows on Leaflet map?

I need to develop Leaflet map which will show the whole world. Also, I need to draw some arrows which will show paths of migrations in the world. The important thing to say that those arrows need to ...
againstflow's user avatar
  • 5,036
18 votes
3 answers
13k views

Leaflet: how to draw curved lines?

So, I'm trying to draw curved lines in my application which is based on a Leaflet map. As far as I know Leaflet does not support drawing curved lines at the moment, so my question is really more ...
fgysin's user avatar
  • 570
1 vote
1 answer
1k 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 ...
Glen Robertson's user avatar
3 votes
0 answers
900 views

Raster Over Layer in Leaflet from GeoServer

I want to add a raster over layer onto the base layer and the raster layer is published by a Geoserver WMS. I set the raster layer's geographic coordinate system as the same as the cloudmate tiles. ...
user1056824's user avatar
2 votes
2 answers
9k views

How to deal Leaflet map control checkboxes?

I add some geojson layers to the map control once a layer is loaded and the control can show all the layer names. But I notice that all the checkboxes are unchecked by default. So that once I click ...
user1056824's user avatar
1 vote
0 answers
1k views

Allowing Add/Delete/Update of features (web application): OpenLayers + WFS and GeoServer?

I've developed a WPF application that has a custom SQL Server database and uses the Esri ArcGIS WPF API to allow users to view, edit and query shapes (features) on a custom map. Maps are created from ...
acardona's user avatar
12 votes
3 answers
29k views

How to label GeoJSON polygons?

I'm using Leaflet combined with GeoJSON features. Is there a way to label GeoJSON features (in this case - polygons)? It should get labels from feature.properties.name This is my code where I ...
againstflow's user avatar
  • 5,036
2 votes
2 answers
2k views

Go to URL on click with GeoJSON

I'm using Leaflet API and GeoJSON. I defined a function which zooms to the feature when clicked: function zoomToFeature(e) { map.fitBounds(e.target.getBounds()); } function ...
againstflow's user avatar
  • 5,036
4 votes
2 answers
9k views

Click link inside Leaflet Popup and do javascript

I have a leaflet map up and running. It overlays a series of polygons (via GeoJSON) on the map and attaches popups to each polygon. Each of the popups display information about that polygon. I'd ...
Josh's user avatar
  • 1,162
0 votes
1 answer
2k views

In leaflet does the addControl automatically handle events via the leaflet API?

I need to add additional overlay layers to be controlled by the controls within the leaflet map boundaries, but the code utilizes a leaflet-custom.js file. I am assuming it handles the event and ...
Carl Carlson's user avatar
0 votes
0 answers
153 views

How do I determine programmatically what values to add to the proj4js constructor for a CRS or SRS such that I can iteratively render proper overlays

I think this is primarily a GIS based question as far as for example: var crs = L.CRS.proj4js('EPSG:2154', '+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=...
Carl Carlson's user avatar
3 votes
3 answers
8k 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 ...
Carl Carlson's user avatar
1 vote
0 answers
787 views

When I try to do a WMS request to geoserver using the leaflet API I am getting a format related error

This XML file does not appear to have any style information associated with it. The document tree is shown below. <ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
Carl Carlson's user avatar
33 votes
3 answers
51k 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). ...
Josh's user avatar
  • 1,162
15 votes
2 answers
43k 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....
fgysin's user avatar
  • 570
9 votes
4 answers
15k 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) { ...
mrg's user avatar
  • 1,565
1 vote
1 answer
239 views

Is a new map object required in order to create a wms overlay on top of a current map object with wfs layers using the leaflet api

I am trying to add a wms tile layer overlay over a wfs tile layer which I added to a map object. When I tried to simply add a layer on top of my current setView for my map object it overwrote the ...
Carl Carlson's user avatar
1 vote
1 answer
2k views

Does leaflet support wms tile layers in applications/openlayers formats?

I am trying to create a tilelayer.wms overlay on top of a wfs base map and I wasn't sure whether leaflet allows the applications/openlayers type of format which I served up from geoserver or only ...
Carl Carlson's user avatar
0 votes
1 answer
84 views

What kind of different results or what is the difference between two URL based WMS requests [closed]

I am trying to retrieve some WMS layers from geoserver so that I can display them in leaflet and I need to populate a URL field and I noticed that many of the layers that I opened up in openlayers had ...
Carl Carlson's user avatar
3 votes
0 answers
565 views

Format tilelayer.wms URL properties such that I add an overlay iteratively to my base map in Leaflet

My base map was created using hard-coded template variables. I am using the leaflet tilelayer.wms constructor and including the URL like so: url: "http://localhost:8080/geoserver/sf/wmsservice=WMS&...
Carl Carlson's user avatar
5 votes
1 answer
11k views

Is it possible to create filters based on attributes for markers in Leaflet?

I need to create filters based on attributes of markers. I have markers defined this way: var locations = [ ['AB11 5HW','17','A',57.147701,-2.085442 ] , ['AB11 8DG','3','B',57.129372,-2.090916 ] ,...
againstflow's user avatar
  • 5,036
5 votes
2 answers
931 views

How to download Leaflet vectors in GPX format?

I would like to use the leaflet.draw plugin to allow users to digitize vectors on the map. At the end the data should be downloadable as a GPX-file. Is there any sample that shows how this can be ...
Ralf's user avatar
  • 51
3 votes
1 answer
14k views

location of a dragged and dropped marker using leaflet

I am using the leaflet API with OSM. I need to implement a functionality where on dragging the marker and dropping it on user preferred location, I need to get its latitude and longitude and save its ...
DomincJune's user avatar
25 votes
2 answers
112k views

Getting Lat, Long of clicked location using Leaflet API?

I am using OSM with Leaflet API. Now I want to get the lat and long of a clicked location. I meant something similar to this. ex: http://openlayers.org/dev/examples/click.html map.events.register("...
DomincJune's user avatar
3 votes
1 answer
4k views

Drawing line following road using Leaflet [closed]

Short version: What I wish to be able to do is drawing a polyline along part of a road. In that way marking certain houses, along this road. Long Version: I have several houses that I wish to mark ...
Thomas's user avatar
  • 39
2 votes
1 answer
2k views

Leaflet, wrong API key when using CloudMade tiles!

I've registered on CloudMade and got some API keys but non of them work with Leaflet API. When I checked for image URLs and opened each directly using my browser it prints out the message "Wrong ...
samanmg's user avatar
  • 21
-1 votes
1 answer
5k views

how to customize the marker using leaflet

I am adding markers to the map as below: var markers = new L.LayerGroup(); L.marker([Latitude], [Longitude]).bindPopup("Hi there").addTo(markers); map.addLayer(markers); I have my own marker icons....
DomincJune's user avatar
3 votes
0 answers
3k views

How to serve OpenStreetMap Tiles locally using ArcGIS Server 10?

We want to serve OpenStreetMap Tiles locally using ArcGis Server 10 to use as base maps in our ESRI Silverlight and Flex GIS clients. We've downloaded our regions OSM file and created PNGs using ...
ajayel's user avatar
  • 413
2 votes
1 answer
3k views

How to preload tiles in Leaflet?

I'm trying to make a user controlled cross-layer animation in Leaflet. I have about 70 tileLayer.wms layers, that need to be preloaded on the map before animation can run. The question is - is there ...
nextstopsun's user avatar
  • 1,129
9 votes
2 answers
17k views

Auto zoom on multipolygon with Leaflet

I have a geojson with a multipolygon and I want to fit this multipolygon to the map. The map center only on one polygon not on the multipolygon. Here is my script var map = L.map('map',{ ...
Henri Labarre's user avatar
3 votes
2 answers
4k views

Rendering problems for some polygons in a Leaflet map with a GeoJSON tile provider

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 ...
pcasa's user avatar
  • 199
5 votes
1 answer
4k views

Creating proper GeoJSON from PostGIS data using node.js

I am trying to build a GeoJSON object from a SQL query to some GIS point data in a postgis postgresql database. A snippet of my node.js app.js is below. As it stands I understand building the type ...
Roybert Soylend's user avatar
3 votes
2 answers
10k views

Leaflet drop markers animation

Is it possible to do drop markers on the map like in google maps (https://google-developers.appspot.com/maps/documentation/javascript/examples/marker-animations-iteration) in leaflet
vetri02's user avatar
  • 303
2 votes
1 answer
271 views

Is it necessary to add Tile layer background?

Is it necessary to add tile layer for making a GeoJSON data rendered in web browser using Leaflet or any other API ? I have a geoJSON data (I obtained the GeoJSON data by converting .shp file to ...
Sibi's user avatar
  • 1,077
1 vote
0 answers
1k views

Leaflet markers do not open popup on click (with markerclusterer)

I just started using Leaflet and Marker Clusterer to organize the markers. Problem #1: When an unclustered marker is clicked, no popup appears. Problem #2: When a cluster is clicked several times, ...
Nyxynyx's user avatar
  • 1,687
2 votes
1 answer
2k views

How to setup leaflet map to display a WMS layer in ESRI:102012 projection?

I have a WMS server that serves layers in ESRI:102012 projection. http://spatialreference.org/ref/esri/102012/ It accepts GetMap requests with srs=EPSG:102012 parameter. My goal is to display a map ...
nextstopsun's user avatar
  • 1,129
1 vote
0 answers
470 views

How to access arcgis cache directly using leaflet like openlayers?

I want to access arcgis server cache dircetly by only using leaflet,I wrote some code,but it work badly,could you anyone give me any hints? my code: getTileUrl: function (tilePoint) { var zoom = ...
MRChanged's user avatar
118 votes
8 answers
97k 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 ...
Sam007's user avatar
  • 4,395