Hot answers tagged

26 votes
Accepted

Showing which way line features are oriented in QGIS?

Simplest way is to style the line. Add a new symbol layer to your line and change the 'Symbol Layer Type' to marker line. Select 'Marker' in the style tree and select a triangle as your default ...
Knightshound's user avatar
  • 4,430
22 votes
Accepted

Show/hide markers depending on zoom-level

All right. I came up with a solution using a layer: var shelter1 = L.marker([55.08, 11.62], {icon: shelterIcon}); var shelterMarkers = new L.FeatureGroup(); shelterMarkers.addLayer(shelter1); map....
Saud 's user avatar
  • 711
20 votes
Accepted

Using Leaflet Js, is it possible to know the onclick location of a Marker (ignore anchor point)?

On one hand: whenever Leaflet handles a mouse (or touch) event, you can access the original DOM event in the originalEvent property of the event. On the other hand: Given a mouse (or touch) DOM event,...
IvanSanchez's user avatar
  • 10.2k
18 votes

Using SVG icon as marker for a geoJSON point file in Leaflet?

I use this simple approach: var svg = ''; /* insert your own svg */ var iconUrl = 'data:image/svg+xml;base64,' + btoa(svg); var icon = L.icon( { iconUrl: iconUrl, } );
Dawied's user avatar
  • 281
18 votes
Accepted

Changing colour of imported SVG icon in QGIS 3.4

You can simply do it directly in QGIS via Layer Properties > Draw Effects > Effect Properties. Open your SVG Layer Properties and click Draw Effects and then open the Star symbol Customize ...
Taras's user avatar
  • 32.6k
17 votes
Accepted

Unions of SVG Point Markers In QGIS?

Since your symbol are quiet simple, you can use a simple marker and set the blending mode to lighten
JGH's user avatar
  • 41.6k
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: ...
tallistroan's user avatar
  • 2,351
14 votes

Changing colour of imported SVG icon in QGIS 3.4

You need to edit the SVG file and replace the fill="#000000" stroke="none" by something like fill="param(fill) #FFF" stroke="param(outline) #000" stroke-width="param(outline-width) 1" the "...
J.R's user avatar
  • 15.7k
12 votes
Accepted

Zoom to polygon bounds on click. Leaflet ´, GeoJSON

Probably: markers.on("click", function (event) { // Assuming the clicked feature is a shape, not a point marker. map.fitBounds(event.layer.getBounds()); }); You may want to detect if the ...
ghybs's user avatar
  • 7,173
12 votes

Using Leaflet Js, is it possible to know the onclick location of a Marker (ignore anchor point)?

You always can retrieve the coordinates from the Leaflet object map. You can use something like this: map.on('click', function(e){ var coord = e.latlng; var lat = coord.lat; var lng = coord.lng;...
ramiroaznar's user avatar
  • 4,419
12 votes
Accepted

Rotate marker symbols individually in QGIS

Use Data defined override. Go to Layer Properties and in Simple marker style open the Data defined override menu with icon next to the Angle value. Choose Field Type -> "your column". Data defined ...
Oto Kaláb's user avatar
  • 6,885
11 votes

Enabling all layers by default using Leaflet?

For the sake of completion, as per https://github.com/Leaflet/Leaflet/issues/3199#event-230611315: Simply add the layer directly to the map. map.addLayer(layer) The control layer function will pick ...
FredFury's user avatar
  • 1,087
9 votes
Accepted

Leaflet routing control change marker icon

The issue is that the createMarker function is called for every waypoint, so obviously the resulting markers will look the same. To work around it, you simply use the arguments that you already have. ...
Senshi's user avatar
  • 1,767
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>');
TomazicM's user avatar
  • 25k
8 votes
Accepted

Custom marker based on geojson attribute in Leaflet

First, your GeoJSON is invalid. Each feature should have a geometry and a properties property. i.e. the following is wrong: var feature = { "type":"Feature", "geometry":{ "type":"Point", "...
IvanSanchez's user avatar
  • 10.2k
8 votes
Accepted

How can I prevent Leaflet from moving my marker while zooming into the map?

See Leaflet doc about iconAnchor option: The coordinates of the "tip" of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker's geographical ...
ghybs's user avatar
  • 7,173
8 votes
Accepted

"Orphan Symbol" problem with QGIS marker line symbol

The issue arises because the symbol is asked to be located 8 mm away from its supposed location. To overcome this, you will want not to offset the symbol but rather the marker location along - but on ...
JGH's user avatar
  • 41.6k
7 votes
Accepted

Leaflet marker/icon help

It looks strange that you add both a GeoJSON layer from result.geojson and a marker created from [result.lat, result.lon]. If result.geojson contains the same point information as [result.lat, result....
ghybs's user avatar
  • 7,173
7 votes
Accepted

SVG markers made in InkScape appear transparent in QGIS

I see the same issue. Took a look at this file in InkScape, and used Shift-Ctrl-F to bring up the Fill and Stroke properties. I noticed that the fill on your green and blue areas were set to 'pattern ...
Steven Kay's user avatar
  • 20.3k
7 votes

List of available marker symbols

On https://www.mapbox.com/developers/api/v3/static/ [ EDIT (Aug 20, '19): this page currently doesn't exist anymore, an archived version can be found here: https://web.archive.org/web/20150907064418/...
Michel Stuyts's user avatar
7 votes
Accepted

Scaling vector field marker arrow based on attribute?

You should get the desired output by recurring to a custom expression. Firstly, click on the Edit... button for the Head length option: Then, type this expression: length( make_line( $geometry, ...
mgri's user avatar
  • 16.1k
7 votes

How to change the icon-image on click

This is a good question. Typically you'd use feature-state for this like in https://docs.mapbox.com/mapbox-gl-js/example/hover-styles/, however feature-state doesn't support the icon-image layout ...
AndrewHarvey's user avatar
  • 2,219
6 votes
Accepted

Multi Symbol for Pointlayer in PyQGIS

If I understand your question right - You solved the Problem by creating Symbol in QGis, but you don't know how to write it in pyqgis, right?! Try this: symbol = QgsMarkerSymbolV2.createSimple( ...
Henhuy's user avatar
  • 886
6 votes

QGIS plugin that adds a point along a line at a specified distance?

As Nelson Silva suggested I also use the LRS plugin. Additionally I use the "Locate points along lines" plugin to quickly create polyline end lengths used for LRS calibration process. Once the LRS ...
CRT's user avatar
  • 101
6 votes

Display L.marker without icon

What if you created a transparent L.DivIcon for your first invisible image? (This technique is used in the Leaflet.draw plugin.) From Leaflet.draw's javascript source code: var marker = L.marker(...
user2441511's user avatar
6 votes

How can I prevent Leaflet from moving my marker while zooming into the map?

As ghybs has mentioned, the issue is in the parameters that have been passed to iconAnchor. Given your marker, you need the icon to be Anchored to the bottom center of the icon, for which, the ...
Devdatta Tengshe's user avatar
6 votes

Scaling vector field marker arrow based on attribute?

An alternative more simple approach would be to use a SVG marker instead of a vector marker field, with just setting the scale and rotation. SVG Style: Attribute table: Map: If you want the ...
Jakob's user avatar
  • 7,451
6 votes
Accepted

Removing specific Circle Markers in Leaflet Shiny

The id column of the data.frame must be of class character or factor. I modified the id vector when creating the data.frame. Try the working code below. You will be able to add and remove markers when ...
Guz's user avatar
  • 3,166
6 votes
Accepted

Repeat polygon marker line by interval: neighboring polygons

@Taras's answer is almost there, but if you dissolve the polygons first, you will only get the outer boundary and none of the inner ones. If you are OK with creating a separate layer, you can try the ...
she_weeds's user avatar
  • 11.9k
6 votes

Prevent marker from moving in QGIS when zooming

After @Erik’s comment, I found the answer quickly. I just missed that the Anchor point wasn't centred, so I just centered it and everything works fine!
Lenn's user avatar
  • 1,193

Only top scored, non community-wiki answers of a minimum length are eligible