QGIS: Coordinate reference system - qgis

I want to use the buffer tool in QGIS with the distance in metres instead of degrees.
Which coordinate system is appropriate for Africa?

You will have to use something along these lines:
WGS projected UTM coordinates
But find the zone you want here:
UTM Grid zones

Related

How to un-normalize geo points in order to plot on leaflet

Leaflet consists of multiple self worlds. General limit of latitude n longitude is -90 to +90 and -180 to +180 respectively. So for a different number of world in map area i receive {lat: 76.12621315046384, lng: 370.70826412409673}, which i normalize to the limit format and send as a param to server in order to receive points based on an algorithm. However the points that i receive are in normalized format already which will plot on the initial first map only, however i would like to plot them on that number of world on map area from which i retrieved longitude as 370.70826412409673.
I tried getting getting pane, scaleZoom, zoomScale, scale, zoom but nothing seem to work in order to get me the world number or anything that helps me de-normalize the geopoints.
You can use the function getBounds() that gives you the coordinates of the two corners of the current view and/or getCenter(). You can then change your longitude to fit this view.
An other solution is to keep the offset between the normalized and "true" coordinates, and add it back to the answer of your algorithm.

how to plot a node on osmnx with known latitude and longtitude

is there anyone know what is the relationship between ['x'], ['y'] and ['lon'] and ['lat']? If I know a node's ['lon'] and ['lat'], how I can plot this node on the street map?
I can use the G.node[22258] find the detail information of a node, like
{
'x':319101.513
'y': 4427916
'osmid':
'ref':
'lon':'-81.11861'
'lat':'39.982066'
}
But I would like to plot a node on the map. I know the latitude and longtitude of this node, but it seems I need to know the 'x' and 'y'.
You can use ox.get_nearest_node to get the node from lat/long.
Use ox.get_nearest_node(G, (39.982066, -81.11861)) to get a nearest node
Use ox.plot_graph_route(G, [ox.get_nearest_node(G, (39.982066, -81.11861))]) to plot the node on map
As far as my knowledge goes, x-y are projected coordinates while lat-long is geographic coordinates expressed in decimal degrees. The projected coordinates are dependent on the projection itself which varies from place to place. What is needed here, I believe, is a transformation of the lat long into the desired projected coordinate system.
Here is a piece of code that does this transformation (from WGS 84 to Spherical Mercator).
While these do not reveal your x and y, I am sure this is the sort of calculation one needs to apply to get their desired result. You may try out other projections relevant to, say the US. For example, I transform to epsg 3112 for Australia. When I do that, I can directly apply euclidian geometry to obtain distances in metres.
Links: https://spatialreference.org/ref/epsg/wgs-84/, https://epsg.io/3857
from pyproj import Proj, transform
inProj = Proj(init='epsg:4326')
outProj = Proj(init='epsg:3857')
x1,y1 = -81.11861,39.982066
x2,y2 = transform(inProj,outProj,x1,y1)
print (x2,y2)
Output:
-9030082.35905815 4863336.501637128

Mongodb geospatial indexes, 2d vs 2dsphere

According to the docs it says about 2d indexes:
The 2d index supports calculations on a flat, Euclidean plane. The 2d index also supports distance-only calculations on a sphere, but for geometric calculations (e.g. $geoWithin) on a sphere, store data as GeoJSON objects and use the 2dsphere index type.
Few things I do not understand..
I do not understand what is meant by distance-only, does it mean the Chord (that line which connects two surface points through a line "inside" the surface)?
How does that calculation work against Earth Longitude and Latitude? If that was designed for Euclidean space, how does it express distance in radians?
Instead, using the 2dsphere indexes, it calculates the surface distance correctly between two points, but it works without specifying the 360 longitude lines and the 180 latitude lines. Is it programmed to specially for Earth longitude and latinudes?
If 3. above is correct. does it takes into account that Earth is oblate spheroid and not a perfect sphere?
No. It means the surface distance using the Haversine formula.
I'm not sure what you are trying to ask in regards to "how does it express distance in radians" but if you mean how are lat/lon angle values and deltas converted into radians it is: PI * angle / 180.0. For the full Haversine formula, check out this link for implementations in 84 languages: http://rosettacode.org/wiki/Haversine_formula
2dsphere indexes use the WGS84 datum (which defines the bounds) See: http://spatialreference.org/ref/epsg/4326/.
Without looking at their code it is impossible to say. But given that they use WGS84 and talk about an "earth-like sphere" it is highly doubtful. I'm guessing they use Haversine (so distance calculations are only an approximation).

Trouble understanding MKMapPoint(s)

Can anyone point me in the right direction when it comes to understanding MKMapPoint?
I understand that it has to do with laying suface of the globe on a 2D surface. But I don't understand how each "point" is measured?
Can anyone give me an example in code?
There is nothing much to it.. just a structure to display point on a 2D map... here is what the documentation says..
MKMapPoint A point on a two-dimensional map projection.
typedef struct {
double x;
double y; } MKMapPoint;
Fields x The location of the point along the x-axis of the
map. y The location of the point along the y-axis of
the map. Discussion If you project the curved surface of the globe
onto a flat surface, what you get is a two-dimensional version of a
map where longitude lines appear to be parallel. Such maps are often
used to show the entire surface of the globe all at once. An
MKMapPoint data structure represents a point on this two-dimensional
map.
The actual units of a map point are tied to the underlying units used
to draw the contents of an MKMapView, but you should never need to
worry about these units directly. You use map points primarily to
simplify computations that would be complex to do using coordinate
values on a curved surface. By converting to map points, you can
perform those calculations on a flat surface, which is generally much
simpler, and then convert back as needed. You can map between
coordinate values and map points using the MKMapPointForCoordinate and
MKCoordinateForMapPoint functions.
When saving map-related data to a file, you should always save
coordinate values (latitude and longitude) and not map points.
Availability Available in iOS 4.0 and later. Declared In MKGeometry.h
If you want to draw something over a map that has a certain real-world size, for example, a scale, then in your calculations you would multiply any given length in meters with the result of MKMapPointsPerMeterAtLatitude(...) to get the size in MKMapPoint units.
If your map displays only of small portion of the globe, MKMapPointsPerMeterAtLatitude(...) will deliver roughly the same constant value for all the latitudes involved in your map. In this case, you can simply use the latitude in the middle of your map as the argument of this function.
Also read in the documentation that a Mercator projection is used for the transformation. Here is an additional observation: northing (y) axis direction seems to be in reverse direction of standard mercator projections (positive direction is down instead of up).

How to determine if a latitude & longitude is within an ellipse

I have data describing a rotated ellipse (the center of the ellipse in latitude longitude coordinates, the lengths of the major and minor axes in kilometers, and the angle that the ellipse is oriented). I do not know the location of the foci, but assume there is a way to figure them out somehow. I would like to determine if a specific latitude longitude point is within this ellipse. I have found a good way to determine if a point is within an ellipse on a Cartesian grid, but don't know how to deal with latitude longitude points.
Any help would be appreciated.
-Cody O.
The standard way of doing this on a Cartesian plane would be with a ray-casting algorithm. Since you're on a sphere, you will need to use great circle distances to accurately represent the ellipse.
EDIT: The standard ray-casting algorithm will work on your ellipse, but its accuracy depends on a) how small your ellipse is, and b) how close to the equator it is. Keep in mind, you'd have to be aware of special cases like the date line, where it goes from 179 -> 180/-180 -> -179.
Since you already have a way to solve the problem on a cartesian grid, I would just convert your points to UTM coordinates. The points and lengths will all be in meters then and the check should be easy. Lots of matlab code is available to do this conversion from LL to UTM. Like this.
You don't mention how long the axes of the ellipse are in the description. If they are very long (say hundreds of km), this approach may not work for you and you will have to resort to thinking about great circles and so on. You will have to make sure to specify the UTM zone to which you are converting. You want all your points to end up in the same UTM zone or you won't be able to relate the points.
After some more research into my problem and posting in another forum I was able to figure out a solution. My ellipse is relatively small so I assumed it was a true (flat) ellipse. I was able to locate the lat lon of the foci of the ellipse then if the sum of the distances from the point of interest to each focus is less than 2a (the major axis radius), then it is within the ellipse. Thanks for the suggestions though.
-Cody