Move marker/labels within area to avoid clashes with clusters in Leaflet - leaflet

I've trying to display point data and areas with labels using Leaflet. The point data is in a markerClusterGroup and the points pop in and out of clusters according to zoom. Also on the map are large areas representing national parks and each park has a marker currently drawn using the GeoJson's centre property. At some zoom levels the pins drawn for the point data have labels which stick out to the side and clash with the area shape labels. I'd like to be able to assign the area shape label to the area and have Leaflet draw it anywhere within that shape that doesn't clash with a point data marker. This would also mean that if the user zoomed in far enough that some of the national park area was not visible, the label would still be shown rather than attached to a specific location within the area which might be off screen.
Is this possible?

Related

Mapbox markers and the centre of the map v marker

See attached image, I have a Mapbox map and a marker that is "centred in the map", what I want is the marker's point to be at the centre (where the red arrow is) and not the middle of the marker.
the marker is Mapbox, setting the lng lat is Mapbox, getting the centre of the map is Mapbox, does anyone know if Mapbox construct the marker in such a way where the end point is the middle?
if not, is there a way to adjust ?
thanks
Martin
for anyone else needing this information
1)
mapbox allows the markers centre to be set when you add the marker, so you can say the centre is top, bottom, centre etc etc
2)
out of the box the mapbox markers are centred in the correct place using "centre". proved this by debugging the GPS from mapbox and comparing to google maps lng,lat and then using every setting to see which one was exactly the same mapping

Mapbox gl repeat marker

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.

Mapbox GL JS: Set Map Center or Bounds to show visible part of a layer

I have a layer with 7000+ polygons and am displaying a portion of the polygons in a web app using "setFilter" on map load. (The filter is choosing the polygons to display dynamically based on data from the url of the current page.)
However, I can't figure out how to make the map center on the particular polygons currently showing (the visible part of that layer), which means the user has to hunt around to find it. There can be multiple polygons visible at one time, and they are a range of different sizes. Any ideas?
If you have the feature collection of polygons that are visible on your map, you can use the turf-extent module to get the geographical extent of the visible polygons, and then call map.fitBounds(extent) to make all visible polygons within the viewport.

How to zoom in on map tiles instead of drawing next zoom level

I've been using this code to display OpenCycleMap tiles on my app's mapview, but if I zoom in too far the map tiles will disappear. Since OCM tiles may not exist at close zoom levels (say, 15 or 16 for a certain area), they just don't appear when drawing the maps for a certain zoom level, and the mapview only shows the Google Street map that is underneath the OCM overlay.
Is there a way to edit the code to make the mapview display whichever map tiles are available for an area, but resized for the region that the mapview shows?

How show circle around annotation how in google maps

I use MKMapView.
How to show circle around annotation how in google maps ( when show current user location).
This circle moving with animation to new location and radius of circle dependent from current zoom level.
The annotations themselves don't have a property for showing a circle but you can use a circle overlay with the same center as the coordinate of the annotation to achieve this effect, just like the image below (from one of my projects).
Note: the property for the center of the circle is called "coordinate", just as for the annotations.
The second part is animating the movement. You achieve this by animating the coordinate property of the circle overlay at the same time as the coordinate property of the annotation. This way they will both move together to the new location.
This question can help you with how to move and animate the position of an annotation. If you need the radius of the circle to change at the same time (e.g. when animating the coordinate) you just use Core Animation to animate it together with the coordinate.
Concerning changing the size depending on the zoom level, Map Kit will always handle this for you automatically with Overlays and Annotations so that they always cover the same area of the map, even as the map resizes. (The second image is the same annotations and overlays as below, just zoomed in on the ones to the left (closer to Stockholm in the first image)).