Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
An Open-Source JavaScript Library for Mobile-Friendly Interactive Maps
3
votes
Leaflet L.geoJSON.getLatLng() is not a function
To elaborate on @Stefan_Fairphones answer and also add some minimal code example:
To fly to the feature on an event, use
document.getElementById("fly").addEventListener("click", function() {
map.f …
3
votes
Accepted
Leaflet add data to GeoJSON without showing on map
I have a minimal working example at https://codepen.io/anon/pen/MxaEOW that does what you want without error.
The relevant code part is
var map = new L.Map('map').setView([ 52, 9 ], 4);
....
var myL …
1
vote
Strange 404 error when loading Leaflet map
The img tags you write in your HTML document on line 289
"<img src='"+ feature.properties.Bildlink +"'width='300'</img>" +"<br>"+"<br>"+
are not formatted correctly.
Change it to
"<img src='"+ featur …
1
vote
Showing polyline coordinates in text input
You need to append to the contents of the input elements, not overwrite them, so your code becomes
map.on("click", function(e) {
var latlng = e.latlng;
document.getElementById("lat1").value += lat …
4
votes
Accepted
Specify tilelayer position on Leaflet
Build a VRT tileset and use that as input to gdal2tiles. That way you get a single tiletree that is a mosaic of your source images.
My data:
I cut a USGS topo map into 3 PNG files, 1.png, 2.png and 3. …
0
votes
Prevent automatic zoom on location found event in Leaflet?
That happens because you create a new marker every time.
Try to set the geometry of your marker.
# create a marker
var m = L.marker([50.4,9.6]).addTo(map);
# on an event (in my example on button cl …
5
votes
How to generate legend in leaflet webmap?
See their help page (on the help tab in the plugin UI):
When you're interested in building a legend as well, you need to fill
the column legend_exp with a text and legend_ico with the path to a …
0
votes
Showing all features by real-time API with Leaflet Map
Your json() function does not return anything. You can just call it. Replace the line L.geoJson(json()).addTo(map); with json();.
Do you want your data to show as point markers?
Then add L.marker(data …
0
votes
Fetch GeoJSON once and display on different styles on Leaflet map?
If I understand correctly what you want to do is to create 3 different layers that are displaying the same geometries but are styled differently.
You could achieve that like this:
Promise.all(...).the …
2
votes
Accepted
Accessing JSON layer as a Leaflet layer outside the AJAX call
To elaborate on the comment by @Matt :
The problem is that you use asynchronous calls and promises, therefore you cannot simply assign the myLayer to a global variable and use that in the L.control.la …
3
votes
Use Geoserver geojson in Leaflet
I would think your issue is the prohibited CORS (cross-origin resource sharing, see https://en.wikipedia.org/wiki/Cross-origin_resource_sharing).
You have to deal with cross-origin resources, because …
4
votes
Accepted
Populating all the data from GeoJSON to an HTML div
That's because you set $("graphs").html() to each element in turn, overwriting the previous content.
Use $("graphs").append(content);, that should retain the previous content, or whatever jquery funct …
4
votes
Merge geojson polygons with WGS84 coordinate
It's easy to do with QGis.
Open QGis
Drag&Drop the geojson file to qgis
use the "dissolve" tool in the vector menu (it's inside a submenu). use the "dissolve all" option from the dropdown
this will …
1
vote
Accepted
Zoom to GeoJSON point feature in leaflet
In your code lalo is an array of LatLng objects. Changing the line
lalo.push(L.GeoJSON.coordsToLatLng(coord));
to
lalo = L.GeoJSON.coordsToLatLng(coord);
, so lalo will be a single LatLng objec …
3
votes
How can I load GeoJSON from URL to leaflet?
Plain leaflet does not offer asynchronous loading from external resources. …