Hot answers tagged

24

Setting the z-index for each layer should help: http://www.openlayers.org/dev/examples/ordering.html EDITED The example I originally linked to isn't too helpful. You want to set the layerindex/z-index of the layers, not the makers within the layers (as the ordering example showed). I put together an example (based off this example) showing custom layer ...


18

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 marker symbol. I believe 'triangle 2' is your best bet. Accept these changes and all your lines will now have arrow showing the direction of the line. You can mess ...


16

I ended up solving this. I also figured out you can add arbitrary options and access them later. That is useful for assigning unique ids to markers: for (i = 0; i <= points.length-1; i++) { testmarker[i] = L.marker([points[i][0], points[i][1]], {icon: unselectedIcon, id: i}); testmarker[i].on('click', function(e) { e.target.setIcon(...


15

I have written down a small piece of code might be helpful for you. You can try working example on jsFiddle <!DOCTYPE html> <html> <head> <title>Leaflet - Marker Click Event</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="http://...


13

Just a quick fix: you were on the right track with the z-index. Try adding this to your own css file (may break other things! I simply got it to display the markers): .leaflet-map-pane { z-index: 2 !important; } .leaflet-google-layer { z-index: 1 !important; }


13

Since your symbol are quiet simple, you can use a simple marker and set the blending mode to lighten


12

Here's a stripped down version of your code, sidestepping the AJAX stuff and just using the color. http://jsfiddle.net/erictheise/HQhzr/22/ Hopefully that points you in the right direction. The main difference is that I'm using pointToLayer: function(feature, latlng) where yours was simply pointToLayer: function(latlng)


12

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.on('zoomend', function() { if (map.getZoom() <7){ map.removeLayer(shelterMarkers); } else { map.addLayer(shelterMarkers); ...


11

It seems like there's no way to just symbolise the line as a zigzag: unfortunately, you'll have to alter the underlying data. You can get a reasonably good zigzag line by first splitting the original line into many equidistant line segments, and then offsetting every other point by a fixed amount. Here's a Python script that does this, taking NathanW's ...


11

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 mouseout when the mouse comes near the arrow of the popup, causing the disappearance of the popup. gpsMarker = new L.geoJson(gjsonMarker, { onEachFeature: ...


11

You can add an Arrow in Arcmap. This is what you need to do: Using the Draw toolbar insert a straight line. Double click on the line and change its properties as illustrated in the below


11

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, Leaflet can magically translate its clientX and clientY properties into an instance of L.LatLng by using map.mouseEventToLatLng(). Combine these two things ...


11

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 override button: Select column: Result: If you select Edit... in Data defined override you can also insert a custom expression.


9

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 clicked feature is a marker (point feature), and act accordingly, as it will not have the getBounds() method. References: Event object event.layer Note: in the ...


9

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, } );


8

You can do it , if you want your vector layer always top with simply code... var vecLyr = map.getLayersByName('VectorLayer')[0]; map.raiseLayer(vecLyr, map.layers.length); May it be easy!


8

Geoserver layers have associated styles. These styles are written in Styled Layer Descriptor (SLD), a subset of XML. To change your styles, you'll have to edit the SLD. In Geoserver, the SLD can be edited using the Style Editor in the Styles Page. Pretty ain't it? Fortunately, you don't have to edit the Styles by hand. A workaround is to use a GIS ...


8

As QGIS also has Simple and Marker Line I will answer from a QGIS point of view. Like Stephen said using the marker lines won't really give you want you need - although that would make a good feature request - which I have just opened. You best bet at the moment to generate points along the line. I have outlined how you can do this in QGIS on my blog at ...


8

Starting from the custom example from the github repo, modify the iconCreateFunction to add a different css class based on the size of the cluster: iconCreateFunction: function (cluster) { var markers = cluster.getAllChildMarkers(); var n = 0; for (var i = 0; i < markers.length; i++) { n += markers[i].number; } var small = n < 200; var ...


8

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: 'my-icon-url', iconSize: [32, 37], iconAnchor: [16, 37], popupAnchor: [0, -28] }); function onEachFeature(feature, layer) { layer.bindPopup(feature....


7

This may not be the most elegant solution, but, with some fine-tuning of the timeout durations and customization of the cluster icons, I think you can get the effect you are looking for. See this example. The trick is to first create a marker and set the map attribute in the marker options object. This adds the marker to the map with the nice drop ...


7

Figured it out thanks to some documentation reading. The polygon in leaflet responds to setStyle but the marker can be changed using setIcon Documentation for setIcon


7

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.lon], you are adding both markers to your map.


7

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 fill', stripes 1:1. Make a note of your blue and green colours first. Next, change to use 'Flat Color' on both the coloured areas, then reselect your colours ...


7

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 location. Centered by default if size is specified, also can be set in CSS with negative margins. If you specify iconAnchor with the same value as iconSize (i.e. [...


7

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 - its line. You will need a style with 1 line and 2 marker lines, one of which having an offset along the line of 8mm. This ensures it will not go outside of ...


7

You can simply do it directly in QGIS (works both 2.18 and 3.0.3) Layer Properties > Draw Effects > Effect Properties Open your SVG "Layer Properties" and click "Draw Effects" and then open the Star symbol "Customize effects" . Then use "Colorise" as an "Effect type" References: Documentation QGIS Testing | Draw effects Introducing QGIS live layer ...


6

Can drop marker like google maps using this Third party plugin bouncemarker And here is a demo Demo


6

Welcome to the site. Since you mention Simple Line and Marker Line I'm going to assume that you're using ArcMap. I'm not sure whether any of the line symbolisation methods lets you specify a distance which will be maintained as you zoom in/out. A workaround may be to create a separate point layer, and place a point every 100 feet. See the help file under ...


6

I think there is no better way than to handle zoomend event. To group markers by zoom levels, use L.LayerGroup: turning them on and off will be easier. Calling map.removeLayer() or map.addLayer() twice won't produce any errors or add a layer twice: there is an internal hash that prevents such things. So you can just have a bunch of if (zoom > 6 &&...


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