30
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, ...
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(...
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
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: ...
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....
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 ...
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/...
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://...
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,...
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
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 ...
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>');
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:
...
8
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-...
7
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 ...
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};
...
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 - ...
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'...
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-...
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 ...
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 ...
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 ...
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 ...
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 {
...
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="...
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 ...
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" // ...
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, ...
6
votes
Accepted
How do I stop the identify results popup window in QGIS 3
Using QGIS 3.10, you may click on the small wrench-icon in the icon-panel at the top of the identify-tool window (see screenshot). Make sure the (only) option is deactivated.
The documentation for 3....
6
votes
Variable nested inside another variable not displayed properly in popup in Leaflet
You missed innerHTML in else, and you should change + stream to + innerHTML in setContent. Use this:
onEachFeature: function (pointFeature, layer) {
var stream = pointFeature.properties.Stream;
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
popup × 506leaflet × 164
arcgis-online × 71
openlayers-2 × 69
javascript × 61
arcgis-maps-sdk-javascript × 61
openlayers × 46
geojson × 40
markers × 33
html × 27
getfeatureinfo × 22
wms × 21
qgis × 18
geoserver × 18
arcgis-pro × 16
arcade × 16
web-mapping × 14
hyperlink × 13
carto × 12
clustering × 11
image × 11
arcgis-desktop × 10
layers × 10
style × 9
features × 9