Leaflet: Polygonmarker instead of circlemarker - leaflet

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?

Related

Using leaflet to determine if a line intersects through a polygon

I am trying to work out the best way to determine if a line goes through a polygon, where it is possible that that points on that line do no fall within the polygon as shown in image below.
My data is multiple polygons and I wish to see if a line (lat,long to lat,long) goes through 1 or more of the polygons.
leaflet has a leaflet-pip that does a point in a polygon but I need to test a line... turf.js has lineIntersect but would this work with a line and a polygon (JSON)? Is there something else I can use but haven't found yet?
Just after some advice on the best way or library to achieve this
Thank you.
turf booleanIntersects works nicely.
Example here: https://codesandbox.io/s/ripkk?file=/src/index.js:9634-9641

Painting Polygon Shaped Areas on Terrain/Surface/Ground in Unity

I have a set of 2D polygon shapes, each one with a varying amount of points that are determined at runtime.
I need to draw (or "paint") these polygons on top of a surface.
I also need to fill in the areas of each polygon with a specific color that is also determined at runtime.
The polygons only really need to be drawn once, however solutions that would allow me to update/change the colors would be nice.The project will be built for WebGL.
The polygons are to mark of specific areas on a surface so they shouldn't repeat.
Polygons can overlap with eachother
What are the different/best solutions that may help me achieve this?
Am also open to suggestions and further reading
I'm a relative Beginner to Unity but a somewhat experienced programmer and know a slight bit about shader programming.
By polygons I don't mean geometry I just mean a regular shapes I would like to paint on to a surface. Its just that I will always have polygons with a varying amount of points that are loaded in at runtime.
First, u need to split the surface into that polygon then u need to have materials on them and the code that specifies the colour should update the colour of the material which is on that specific polygon. Creating materials could be done in code to avoid a lot of work in a simple loop.

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!

How do I Convert an OpenLayers Polygon to a Circle?

I have a drawing feature where, as in one case, a person can draw a circle using the methodology in OL docs example. When that's saved, the server needed to be have it converted to a polygon, and I was able to do that using fromCircle.
Now, I'm needing to make the circle modifiable after it's been converted and saved. But I don't see a clear cut way to get a Circle geometry out of the Polygon tools provided in the library. There is a Polygon.circular, but that doesn't sound like what I want.
I'm guessing the only way to do this is to grab the center, and one of the segment points, and figure out the radius manually?
As long as fromCircle used sides set to a multiple of 4 and rotation zero (which are the default) center and radius can be easily obtained to convert back to a circle:
center = ol.extent.getCenter(polygon.getExtent());
radius = ol.extent.getWidth(polygon.getExtent())/2;

Create custom map in Leaflet with coordinates

I have a historical city map that I want to display using Leaflet.
I like to set the coordinates of this image to reflect the real world, e.g so I can click on the image and get the real coordinates.
I guess I can just make it an overlay to a real map, but there must be a better solution just define at what coordinates of the corners of the image.
For this image, the approx real world coordinates is NW: 60.34343, 18.43360, SE: 60.33761, 18.44819
My code, so far, is here:
http://stage1876.xn--regrund-80a.se/example3.html
Any ideas how to proceed? It feels like it there should be an easy way to do this?
Any help would be so appreciated!
EDIT: The implementation (so far) with tiles are optional. I could go for a one image-map as well.