How to get the radius given Min and Max Latitude and Longitude? - math

Given coordinates:
min_lat=25.862491496700553
max_lat=26.358213103705367
min_lng=-80.790159828186
max_lng=-79.78628409576413
Is is possible to determine a radius?

"Given [two geographic points] [i]s it possible to determine a radius?"
As asked, no.
A radius is the distance from the center of a circle or sphere to its perimeter. It is used for 2D circles and 3D spheres.
That said, I suspect you may in fact being trying to ask a different question that can be answered.
You may be asking for either the "great circle distance" between two points (each point with a latitude and longitude value);
I would suggest reading Calculate distance, bearing and more between Latitude/Longitude points by Chris Veness and the StackOverflow question here: "How do I calculate distance between two latitude-longitude points?"
If you need a unusually high degree of accuracy (far more than almost everyone using Google Earth needs) you can use the Vincentry Formula which takes into account an ellipsoidal Earth model, as the Earth is not a perfect sphere.
Or you may of meant that you wish to find the mid-point of the four line segments along the perimeter of max and min latitude and longitude. e.g. (min_lat, min_lon), (min_lat, max_lon), (max_lat, min_lon), and (max_lat, max_lon), a less frequent request.
This covered in more detail in the StackOverflow question "Mid point of two point where latitude and longitude given."

No. You could mark out that region on a billiard ball, or on Jupiter.

Related

Finding the coordinates in Cartesian coordinate system

I have 3 points in Cartesian coordinate system. I know the inter distance between the points. I also know the distance of the points from the origin. Is it possible to know the coordinates of the points?
This isn’t enough information to determine the locations of the points.
Imagine that you have found one possible location for those three points. Take the points and rotate each of them around the origin by the same angle θ. This preserves all the distances between the points and between the points and the origin, but gives a different solution to the original set of constraints.

Returning distance in miles or kilometers from manhattan distance formula output

I am running a taxicab distance function on a list of coordinates and I would like to convert the outcome integer to a mile or km quantity. For example:
0.0117420 = |40.721319 - 40.712278| + |-73.844311 - -73.841610|
Where 0.0117420 is the output I would like to convert to mi/km. How could I go about this?
This appears to be a situation where you are trying to navigate from (40.721319, -73.844311) to (40.712278, -73.841610) where these are lat / lon pairs, and you want to navigate using a "Manhattan" routing rather than a direct great circle route.
It looks like you are considering these points as opposite corners of a "rectangle" where travel is only allowed along north, south, east and west headings to move from one point to another and where travel along the path always brings the traveler closer to the destination point.
An approximation of this is to find one of the corners of the bounding rectangle for all such paths. There are two of them, one at (40.721319, -73.841610) and the other at (40.712278, -73.844311). So, you can pick one of these and chose that as a waypoint for approximating the length each possible "Manhattan routes" between the two points. If we chose the first, you will need to calculate the distance from the starting point to the waypoint then to the destination point. Such as:
l(0) = (40.721319, -73.844311)
l(1) = (40.721319, -73.841610)
l(2) = (40.712278, -73.841610)
Using the Haversine equations we see the distance from l(0) to l(1) is approximately 0.2276km and the distance from l(1) to l(2) is approximately 1.005km making the entire route about 1.2326km.
This is approximately the length of any "Manhattan route" you pick where the distance is strictly decreasing along the path taken between the two points. There are also some errors due to the curvature of the Earth, but for points this close to each other and so distant from either of the poles, this should be good enough for most applications.

Finding the maximum of points in a given angle of circle

I'm looking an algorithm which can determine the best angle (which represent the center of a circle sector) to get the maximum of points in this circle for a given sector size.
Example :
Red is the sector (admit size is known).
Green is the angle i want to find.
Black points coordinates are known.
If I didn't explain correctly, ask it.
Thanks for your answers.
No there is not fixed number of sectors. Goal was to find the sector (by center angle) of given maximum angle having a maximum of points.
I found a solution algorithm to this. thanks for help anyway. still think there are more efficient ways but i did like it :
using atan2 to get angles for each points
sorting points by angle
associating points which are close enough to be in the sector maximum angle to the point checked (using a double for loop)
returning the angle of the point with a maximum of associated points.
Tried to be clear but not really easy.
can post c++ sample if some of you are interested.

Approaches for spatial geodesic latitude longitude clustering in R -- Follow-Up

Mine are follow-ups to the question & answer in Approaches for spatial geodesic latitude longitude clustering in R with geodesic or great circle distances.
I would like to better understand:
Question #1: If all the lat / long values are within the same city, is it necessary to use either fossil or distHaversine(...) to first calculate great circle distances ?
or, within a single city, is it OK to run clustering on the lat/long values themselves ?
Question #2: jlhoward suggests that :
It's worth noting that these methods require that all points must go into some cluster. If you just ask which points are close together, and allow that some cities don't go into any cluster, you get very different results.
In my case I would like to ask just ask "which points are close together", without forcing every point into a cluster. How can I do this ?
Question #3: To include one or two factor variables into the clustering (in addition to lat/long), is it as easy as including those factor variables in the df upon which the clustering is run ?
Please confirm.
Thanks!
"within a single city, is it OK to run clustering on the lat/long values themselves ?"
Yes, as long as your city is on the equator, where a degree of longitude is the same distance as a degree of latitude.
I'm standing very close to the north pole. One degree of longitude is 1/360 of the circumference of the circle round the pole from me. Someone ten degrees east of me might only be ten feet away. Someone one degree south of me is miles away. A clustering algorithm based on lat-long would think that guy miles away was closer to me than the guy I can wave to ten degrees east of me.
The solution for small areas to save having to compute great-circle ellipsoid distances is to project to a coordinate system that is near-enough cartesian so that you can use pythagoras' theorem for distance without too much error. Typically you would use a UTM zone transform, which is essentially a coordinate system that puts its equator through your study area.
The spTransform function in sp and rgdal will sort this out for you.

Determine the centroid of multiple points

I'm writing a mapping application that I am writing in python and I need to get the lat/lon centroid of N points.
Say I have two locations
a.lat = 101
a.lon = 230
b.lat = 146
b.lon = 200
Getting the center of two points is fairly easy using a euclidean formula. I would like
to be able to do it for more then two points.
Fundamentally I'm looking to do something like http://a.placebetween.us/ where one can enter multiple addresses and find a the spot that is equidistant for everyone.
Have a look at the pdf document linked below. It explains how to apply the plane figure algorithm that Bill the Lizard mentions, but on the surface of a sphere.
poster thumbnail and some details http://img51.imageshack.us/img51/4093/centroidspostersummary.jpg
Source: http://www.jennessent.com/arcgis/shapes_poster.htm
There is also a 25 MB full-size PDF available for download.
Credit goes to mixdev for finding the link to the original source, and of course to Jenness Enterprises for making the information available. Note: I am in no way affiliated with the author of this material.
Adding to Andrew Rollings' answer.
You will also need to make sure that if you have points on either side of the 0/360 longitude line that you are measuring in the "right direction"
Is the center of (0,359) and (0, 1) at (0,0) or (0,180)?
If you are averaging angles and have to deal with them crossing the 0/360 then it is safer to sum the sin and cos of each value and then Average = atan2(sum of sines,sum of cosines)
(be careful of the argument order in your atan2 function)
The math is pretty simple if the points form a plane figure. There's no guarantee, however, that a set of latitudes and longitudes are that simple, so it may first be necessary to find the convex hull of the points.
EDIT: As eJames points out, you have to make corrections for the surface of a sphere. My fault for assuming (without thinking) that this was understood. +1 to him.
The below PDF has a bit more detail than the poster from Jenness Enterprises. It also handles conversion in both directions and for a spheroid (such as the Earth) rather than a perfect sphere.
Converting between 3-D Cartesian and ellipsoidal latitude, longitude and height coordinates
Separately average the latitudes and longitudes.

Resources