How to draw bearing angle using leaflet - leaflet

I want to draw bearing angle using leaflet, as input I have a marker on map and the user can enter an angle value from a custom interface(this angle matches the bearing angle), so I want to draw this bearing angle on map. How can I do that on map using leaflet plugins? Any help is appreciated.

Related

How to "correct" the roundness of the earth leading to ellipsis instead of circle in react leaflet

I'm trying to programatically "draw" a circle with multiple Marker with React leaflet.
I'm doing it with cosinus and sinus trying to calculate theirs coordinate from the center point ...
But the more I'm near the pole the more the circle is an ellipssis ... Is it a way to transform the calculus to take this into account ?
In this example I'm in Oulu (near the pole) If you just change the x var into '0' you'll notice that the markers are now in circle !
please see this CodePen
Because a Leaflet map is a projection of a sphere onto a flat map, distortions will happen near the poles. You want to project your spherical Lat/Lng into flat Points, calculate the marker placements in flat Points and then unproject the points back to spherical LatLng.

Display Earth map in Azimuthal Equidistant Projection

I have to display the Earth's map in azimuthal equidistant projection, by giving the lattitude and longnitude as input in Matlab. I am using the eqdazim projection, but I am still getting the map with point (0,0) in the center. I want to be able to change the point that is the center if the circle map.
landareas = shaperead('landareas.shp','UseGeoCoords',true);
axesm ('eqdazim', 'Frame', 'on');
geoshow(landareas);
Also, I don't know how to change the radius of the image. I don't need the circle with the whole Earth but instead something about ~2000km radius around center point.
I need it in order to put its image on a dome. Below is a simple example with such a dome and random fragment of the Earth's surface. Keep in mind, that it's just an image that I cropped manually from large Mercator map.
I was hoping that I can use the Mapping Toolbox in order to get such a map automatically, by giving lattitude, longnitude and radius. I have all necessary data, which is:
Lattitude & Longnitude
The radius of the circle
I just don't know how can I get this part of Earth's map. I think I have to use the azimuthal equidistant projection. I just don't know how to do this in MATLAB/Mapping Toolbox.

Rotating an arbitrary polygon around its own center

I'm trying to find a way to rotate an arbitrary polygon around its own geometric center. It was drawn in a blackboard built with creating js.
I've been trying many approaches, but any of them has worked.
How can I accomplish it?
Find the geometric centre as the average of all the points' coordinates. Make all the points relative to this centre (such that the centre is (0,0)), then rotate them by the desired angle using a rotation matrix. You can then draw using these points.
This is assuming you have the coordinates of all the points.

how to find angle between an ellipse and a vertical line that is in the middle of the image?

i am using this code:
http://blogs.mathworks.com/steve/2010/07/30/visualizing-regionprops-ellipse-measurements/
to make an ellipse around an object. How can i find the angle that is created from the center of the ellipse to a vertical line that is in the middle of the image?
The angle between the major axis of the ellipse and the x-axis is given by the Orientation property of regionprops.
The angle is given in degrees and will lie in the range between -90° and +90°.
I assume you are using exactly the mentioned code. There the Orientation value is already calculated and used for drawing the ellipse.
You get thus get the value with
s(k).Orientation
If you want to get the angle from the major axis to a vertical line, you can simply add 90° to that angle. The result will then be in the range between 0° and 180°.

Polygon creation in OpenModelica

While creating a regular polygon in the Icon/Diagram Layer in OpenModelica, I can understand that the origin is the centre/centroid of the polygon and the co-ordinates of the points of the polygon are calculated using the origin as a reference.
Can anyone tell me how the origin co-ordinate and the point co-ordinates of an irregular ploygon are generated in OpenModelica?
Each graphic shape has a bounding rectangle http://qt-project.org/doc/qt-4.8/qgraphicsitem.html#boundingRect. The center of this rectangle is used as an origin.
What do you want to achieve?