Leaflet finding distance to nearest markers on all 4 directions - leaflet

I have a leaflet map with several thousand markers that are clustered. I show an icon for the users current location on the map and I need to show the distance to the nearest marker in all four directions. So for example, North:100M, South:1KM, East:.... and so on.
I dont see an inbuilt way in leaflet to do this. Any ideas on I can go about accomplishing this ?

Related

Repeating Markers etc. every 360°

so if you look at the example map on the Leaflet Frontpage they set a marker in Londons Hyde Park. If you now zoom out all the way the image of the world repeats itself multiple times but the marker is only on one of the images. How do I get the markers, lines etc. to repeat themselves so there is a marker in every Hyde Park not just one?

How to make adjacent polygons align with the edited polygon in leaflet?

Is there any way in Leaflet to edit a shape file (from database) consisting of adjacent polygons in the same manner as in QGIS using the "Reshape feature"-tool in the Advanced Edit toolbar?
At the moment I'm using Leaflet.pm to edit. It works fine to reshape an activated polygon by draging coordinates, but I would like adjacent polygons to align to the new shape. And draging coordinates can turn into a lot of work. Drawing the new boarder as with "reshape feature"-tool would be ideal. Anyone know if it's possible and if so: how?
Thanks!

Leaflet: Polygonmarker instead of circlemarker

I am looking for a way to display a polygonmarker instead of a circlemarker in leaflet.
I am not looking for a way to draw a polygon on the map, because I need it to be the same size independent of zoomlevel.
Drawing a polygon also requires multiple coordinates which I don't have.
example: There is a spot on a mountain that allows to start flying here in winddirections from North to Southwest.
I want to draw a cone in those directions.
Can this be done in leaflet? I've looked around but can't find a solution to this.
If not, any suggestions?

setting map boundary / edge when nowrap is engaged

Is there any way to adjust the bounds of the map so that the right-edge of Russia doesn't appear over to the left? You can see in the image I have a MultiPolygon area overlaying Russia but the map and the overlay are split. I'd like that tiny piece of the country to be on the right if possible!
Edge of Russia on the wrong side of the map:
A workaround I can think of is using the maxBounds property, where you would shift the default bounds slightly to the right, along with minZoom: 1. This won't prevent the user from seeing the world several times for a short time if zoomed out far / panning outside, as it says there:
... bouncing the user back when he tries to pan outside the view
var map = L.map('map',{
maxBounds:[ [-90, -160], [90, 200] ],
minZoom: 1
}).setView([66.058, 189.459], 4);
Demo
Welcome to SO!
If your multi polygon is the blueish area, then I am afraid you have to refactor your data in order to achieve what you want (shifting the left area onto the right, as if it were stitched back to Russia main land).
Your data (probably GeoJSON?) contains a separate polygon which longitudes are in the [-180, -120] range. Leaflet has no choice but to display it on the left of your map, independently from the noWrap option.
So you would need to dig into your data, and add 360 degrees longitude to every node of this polygon, so that they now sit in the range [180, 300].
Or somehow introduce a "detection" in your code that would perform the longitude addition automatically for shapes which bounds and/or center are far away (let's say in the [-180, -120] longitude range). Leaflet does not perform that operation automatically out-of-the-box.
Note: the noWrap option is for your Tile Layer not to load tiles outside that "central" world (in order to avoid showing multiple copies of the world). But in your case, you want to show a part of Russia / Siberia on an "adjacent copy of the world", so you might want to remove that option, or you will have your polygon not sitting over any basemap.

Bing Maps v7 - Display TileLayer above Polygon

I am writing an application that needs to show a variable number of TileLayers and Polygons on a Bing Maps control in an order specified by another application.
Whilst I can get all items to display correctly, the zIndex I set doesn't do as I expect - the polygons appear in the correct order in relation to each other as do the tile layers, but all the tile layers are always below the polygons, e.g.
Expected display order set using zIndex:
TileLayer 1
Polygon 1
TileLayer 2
Polygon 2
Renders as:
Polygon 1
Polygon 2
TileLayer 1
TileLayer 2
Is this layout possible using Bing maps?
Polygon layers are vectors, whereas tile layers are rasters. I believe that Bing Maps (and, for that matter, every other web-mapping API that I'm aware of - Google Maps, Leaflet etc.) will always render vector layers on top of raster layers.