29
votes
Displaying properties of GeoJSON in popup on Leaflet?
The line where you create and bind your popup should have been included in the onEachFeature option of your L.geoJSON factory.
var layerGroup = L.geoJSON(data, {
onEachFeature: function (feature, ...
- 7,013
22
votes
How to update a popup content from its marker?
_popup has an underscore in front of it to indicate that it's a private / member instance, and should not be accessed directly. The correct API is Layer.setPopupContent().
e.g.
marker.setPopupContent(...
- 323
18
votes
Showing popup on mouse-over, not on click using Leaflet?
If you're using Leaflet 1.3.x, tooltip binding is a built in method.
http://leafletjs.com/reference-1.3.0.html#tooltip
var polyline = L.polyline([[StartLat, StartLong],[EndLat,EndLong]]).addTo(this....
15
votes
Leaflet Marker Mouseover Popup
You just have to add 'mouseover' and 'mouseout' event listeners to your newly created layer.
You will also want to change the offset of the popup to make it higher. If not, you will have annoying ...
- 999
15
votes
Accepted
Custom marker and properties from geoJSON in Leaflet
To create a custom marker you can create a L.Icon object and for the popup you can use the onEachFeature option.
Here is an example code snippet for these functions:
var myIcon = L.icon({
iconUrl: ...
- 2,341
14
votes
Accepted
Error when trying to bind popup on geojson, failed to execute 'appendChild'
I had the exact same problem and it solved when I concatenated a string to it.
// the number shows correctly itself
console.log(layer.feature.properties.ROWID); // 46
// but bindPopup() won't accept ...
- 288
14
votes
Accepted
How to update a popup content from its marker?
I suppose you want the content to be changed after some event occured, like mouseover, contextmenu, or anything else.
To do so, you can use the following code:
//marker creation
var marker = L....
- 383
11
votes
Accepted
Styling popup with two separate styles at once in Leaflet
I have no idea what the error means, but you can make a circle and a semicircle, then, combine them in a featureGroup.
var map = L.map('map').setView([39, 30], 7);
L.tileLayer('https://api.mapbox.com/...
- 68.7k
10
votes
Accepted
Handling Popups in Leaflet with Overlapping Features?
One option would be to use leaflet point in poly (leaflet.pip) which is available through Mapbox: https://www.mapbox.com/mapbox.js/example/v1.0.0/point-in-polygon/
Or as a leaflet plugin: https://...
- 339
10
votes
Displaying properties of GeoJSON in popup on Leaflet?
Build a simple popup content for any properties in a simple way, in one line:
var layer = L.geoJSON(data, {
onEachFeature: function (f, l) {
l.bindPopup('<pre>'+JSON.stringify(f.properties,...
- 386
10
votes
Accepted
Why does the className option of a Leaflet popup change only the outside of the popup?
A popup in Leaflet is not one single HTMLElement. If you use the developer tools in your web browser, you'll see that a popup has:
A container for the whole thing:
(note how there's a margin on the ...
- 9,825
9
votes
Open popups in a fixed position with Leaflet
You could for example use a div-Container and a click-Event instead of the default popups:
HTML:
<div id="info"></div>
Javascript:
onEachFeature: function (feature, layer) {
//...
- 7,728
9
votes
Accepted
Submit a form from within a leaflet popup?
I figured it out! - the problem is that my function or wherever I hold my line of code to "preventDefault()" was outside of the function that created the form in the first place. I need to place the ...
- 1,292
9
votes
Accepted
Adding popup to Leaflet but only on click?
Just leave out call of .openPopup() method:
mymarker.bindPopup('<p>You are here ' + username + '</p>');
- 20.3k
8
votes
Accepted
how can I specify a popup to show only for a specific layer in openLayers 3?
When doing forEachFeatureAtPixel, you should do any filtrering inside the callback function. You have the feature and it's layer available as arguments.
This would return the first clicked feature:
...
- 632
7
votes
Accepted
How do I show feature attributes in a Leaflet popup?
Look at the docs! You'll see that you need to define other callback methods on the L.geoJson object. Namely:
L.geoJson(data, {
style: function (feature) {
return {[style properties here};
...
- 6,596
7
votes
Accepted
OpenLayers 3.10.1 - Feature Popup
This works on OL 3.10.1. This example assumes you already have a feature layer added to your map and are using bootstrap and Jquery.
For a solution without Jquery and Bootstrap see :
OpenLayers 3 - ...
- 726
7
votes
Accepted
Automating Pop up configuration of web app in ArcGIS for Portal?
If you're using Portal for ArcGIS or ArcGIS Online you can manage your configuration files via the ArcGIS Online Assistant. Login with your Portal or ArcGIS Online credentials and select 'View an Item'...
- 10.6k
7
votes
Accepted
How to add top and bottom margins to leaflet popup with scroll
I couldn't get your strategy that both custom-popup and leaflet-popup-content-wrapper style classes have overflow: auto property to work properly.
I moved overflow: auto property to leaflet-popup-...
- 20.3k
7
votes
Accepted
Access report/atlas page from feature in layer (QGIS)
The identify tool could do what you expect in possibility number 1. It could open the atlas page you click on.
Step by step :
Select the layer used as coverage layer
Click on the identify tool
Right-...
- 2,868
6
votes
Getting image pop ups in QGIS
At 3.8.0, here's what works for me:
Create a point layer (Geopackage, shape file, etc)
Create a text attribute field in the point layer:
call it, say, image_path
A reasonable maximum length is 320 ...
- 7,443
6
votes
Getting image pop ups in QGIS
Like Maj said, I think that he easiest way to do something like you said is based om the map tips functionality. You can find the steps by step description here
First you should have a file name or a ...
- 227
6
votes
Moveable ArcGIS Identify Popup Window (Dojo)
This blog has an excellent example of how to make the window draggable and hide the arrow using dojo: https://gavinr.com/2015/04/13/arcgis-javascript-draggable-infowindow
Here's the key javascript ...
- 431
6
votes
How to get a pop up in QGIS when clicking on points on a map
Ok two things here I think. Getting information for a point and creating a shapefile.
Information.
There is a tool called "Identify Features" which is a point that allows you to bring up a window ...
- 146
6
votes
Changing popup position on Leaflet marker?
You can specify the offsets by using the popupAnchor options, but not where you would expect it. First, you need to specify an icon like this:
var myIcon = L.divIcon({ popupAnchor: [0, -30] });
You ...
- 161
6
votes
Accepted
OpenLayers 3 - Feature Popup without Jquery/Bootstrap
This works on OL 3.20.1. This example assumes you already have a feature layer added to your map.
HTML
<div id="map" class="map"><div id="info"></div></div>
CSS
#map {
...
- 726
6
votes
Accepted
Changing data and style with <select> in Leaflet popup
From the code you provide in your JSFiddle:
function onEachFeature(feature, layer) {
var popup = '<select name="select" onchange="restyleLayer(this.value)">'
popup += '<option value="...
- 7,013
6
votes
Accepted
Combining popup info from overlapping polygons in Mapbox GL JS
Within your map.on('click') callback, e.features is an array of all features from testlayer at the point clicked.
So instead of only choosing the first in your popup, you can display all values like ...
- 2,171
6
votes
Accepted
Multiple popup styles for Leaflet
You should assign a different classname and define the relative CSS style for each kind of popup:
var popup = L.popup({
closeButton: true,
autoClose: true,
className: "custom-popup" // ...
- 14k
6
votes
Add a polygon programmatically in OpenLayers 3?
Polygon geometry needs two additional pairs of brackets
geometry: new ol.geom.Polygon([[[8623931.28, 1449016.75],[8624007.72, 1458265.63],
[8629358.31, 1458571.37],[8628441.06, ...
- 11.5k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
popup × 499leaflet × 163
arcgis-online × 71
openlayers-2 × 69
javascript × 61
arcgis-maps-sdk-javascript × 60
openlayers × 44
geojson × 38
markers × 33
html × 27
getfeatureinfo × 22
wms × 21
geoserver × 18
qgis × 17
arcade × 16
arcgis-pro × 14
web-mapping × 14
hyperlink × 14
carto × 12
arcgis-desktop × 11
clustering × 11
layers × 10
image × 10
features × 9
qgis2web × 9