I want to add the ArcGIS MapServer/WMS Layers on the leaflet. And I want the leaflet map initialized with a specified extent view ,then the layers can displayed well in the map.
I had seen the leaflet API. There is no option to set the initial Extends of the map.There is a option to set the center and zoom to control the entend but i want to set with the Lat/Lont or coordinate.Is There any way to solve this?
Thanks!
Use map.fitBounds() right after map initialization.
Related
After adding custom image markers using the Marker.addTo() method there doesn't seem to be a way to query the markers to dynamically set the draggable property on/off. There is no way to get a collection of markers added to a map. Please help!
I don't see a .getMarker() method on the map object nor do I have access to the collection of custom image markers added to the map. Is there any other method besides Markers to add custom photo images to the map and control them?
I see plenty of great examples using symbols, etc but I need to use custom images for each marker.
I would like to add photo thumbnails on a map and query them by name or id to update their draggable state on/off in realtime. Thanks!
may I know what framework are you using ,and you can use geojson to add multiple markers, and can define draggable as a property in geoJson and alter it if you are are using JS or just define the property as a state variable in react and play with it accordingly.
I try to repeat a marker at the same coordinates when I am moving the map to infinity, in the same way that layers.
example : https://www.mapbox.com/mapbox-gl-js/example/geojson-polygon/
Has anyone found how to do that please?
If it's not possible, conversely is it possible to not repeat layers when you moving the map ?
Thank you
The Link example you provided is not using Markers to render the shaded area. It is using a feature, in this case a polygon, included in a layer (a layer can have many features).
In MapBox the rendered map is made up of any number of layers (including the tile data) which is rendered whenever you scroll or drag to a particular area of the map. For example as you keep dragging to the right in the map it will just keep rendering in the relevant layers and tiles.
The Marker functionality has a different purpose which is as a one off selected point which is useful for a user click or hover interaction.
Is it possible to display tileLayer on top of all other layers? This means that all other layers are displayed below the tileLayer.
Googled all day, but couldn't find definite yes or no.
Yes you can manipulate the order by simply adding this code:
var topPane = map._createPane('leaflet-top-pane', map.getPanes().mapPane);
topPane.appendChild(yourtileLayer.getContainer());
yourtileLayer.setZIndex(5);
Create a map pane on top of (with a higher z-index than) the standard tile pane, and position your tile layer in it.
There is an entire Lealfet tutorial on the issue.
I am using mapbox and featureGroup control.
World map is repeating horizontally.How can I prevent horizontal repeating of world map.
I have tried 'no-wrap:true' ,but this seems to work only for tile layer.
For featureGroup,Please suggest some way.
var map = L.mapbox.map(mapData, MapBoxAccess.mapBoxAccess.accessId);
var featureGroup = L.featureGroup().addTo($scope.map);
I am adding my polygons and polylines on featureGroup
Please find attached image for better understanding.
That actually is the intended behavior and features cannot repeat across the globe like this. If you wanted to prevent scrolling across the globe, you can set bounds over the map so that someone can't scroll or pan side to side. Also, there is a Leaflet method called WorldCopyJump which will also bounce the view back to the bounds.
I want a Leaflet layer control which when checked/unchecked must display/hide all the sublayers inside the main layer. I also want to check/uncheck the sublayers independently. I looked through Leaflet docs and forums but couldn't find any reference for this. Should I write a custom control for this? Please advise.
I believe you are going to need to have to write a custom control for this, as L.Control.Layers does not have nesting support built in currently.
You can try using LayerGroup. From official documentation:
LayerGroup
Used to group several layers and handle them as one. If you add it to
the map, any layers added or removed from the group will be
added/removed on the map as well. Extends Layer.
Usage example
L.layerGroup([marker1, marker2])
.addLayer(polyline)
.addTo(map);