Is MKCoordinateRegion span center to boundary or boundary to boundary? - objective-c

Does the span for MKCoordinateRegion represent the distance from the center to each boundary or the distance from boundary to boundary?
If I want to calculate the boundaries of the region to I add/subtract the span from the center or do I need to /2?
lowerLatitude=center-span.latitudeDelta
or
lowerLatitude=center-(span.latitudeDelta/2)

Running this code:
self.mapView.region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(23.5, 10.0));
I was able to see as far north as the border of the Western Sahara, and as far south as the Etosha National Park; as far west as the west cosast of Senegal; and as far east as N'Djamena.
Based on that, and a little time with Google Maps, it appears that the span is a total of 47 degrees north-south, and 20 degrees west-east.

The span is the distance from boundary to boundary. If the most Westerly place you can see is at 10 degrees and the most Eastery is 20 degrees, the longitudeDelta will be 10 degrees (span). The center coordinate will have a longitude of 15 degrees (a point, not a span).
To put it another way, the span is twice the distance from the center to the edge. The center is the point half way along both spans.

Related

Road Distance Calculation using GPS Co-ordinate

Path image
I need to calculate distance from subscriber position to Position B in the image. I have the GPS co-ordinate of the subscriber and the "B" position. How can I calculate the distance?
Simple case: Express lat and long values in decimal form and use the standard geometry distance formula if subscriber is less than 100 miles from position B. distance = sqrt((lat1-lat2)^2 - (long1-long2)^2).
More general case: Use the haversine formulas using a great circle to calculate distances from points on a sphere for more accurate measurements if position B might be a continent or two away from the subscriber. Let's call the subscriber position A and say and say he is at lat[a], long[a] and the fixed point B is at lat[b], long[b]. Let r represent the radius of the earth (about 3961 miles).
distance = 2*r*arcsin(sqrt(sin^2((lat[b]-lat[a])/2) + cos(lat[a])*cos(lat[b])*sin^2((long[b]-long[a])/2)))
If you specify r in miles, your answer will come out in miles. If you use kilometers use 6373 for a good number for the earth's radius, and of course the answer will come out in kilometers.
Exact case: The haversine formula will not provide a perfect answer because the earth is not a perfect sphere. Even apart from the mountains and the canyons, the earth has a larger radius at the equator than it does at the poles. The radius at the equator is the equator is about 3963 miles, and at the poles it is about 3950 miles. So you really need to devise your own lookup table (or borrow one from google maps) if you are measuring distances halfway around the globe and you have to be exact.
The haversine formula will be accurate to less than half of a percentage point. In 1000 miles your answer will be accurate to within 5 miles.
Haversine formula: https://en.wikipedia.org/wiki/Haversine_formula
Radius of the earth: https://en.wikipedia.org/wiki/Earth_radius

Moving Collada file Lat Long

I append a collada file into the plug-in, and then move it (append.Child, then remove.Child, then append.Child, etc) based on very small Latitude and Longitude increments. When the Latitude increment = Longitude increment, however, the file moves in a rectangular fashion and NOT a square fashion. What am I doing wrong? Shouldn't the "path" which the collada file travels be "square"?
The increment in both directions (lat or long) is the same increment (0.00001499817). In trying to figure this out, I also noticed that the "circle" polygon code also shows up as an oval unless you place it along the equator.
Should I be assuming that a latitude increment EQUALS a longitude increment in Earth???
Anybody know what might be going on? Thanks. Paul
Should I be assuming that a latitude increment EQUALS a longitude
increment in Earth???
Do you assume the Earth is a perfect sphere?
Do you assume that latitude and longitude lines are evenly spaced out?
To quote someone else from a quick google search
Longitude is the east-west (right/left) measurement on a map. It goes
from 180 degrees west to 0 (through Greenwich, London, UK) then to
180 degrees East. 180 degrees West or East is actually the same line
- its in the middle of the Pacific ocean.
There are thus 360 lines of integer Longitude.
Latitude goes from the Equator - 0 degrees, North to the North Pole at
90 degrees north. Or south to the South Pole at 90 degrees south.
There are thus 180 lines of integer latitude.
Technically, you'd have to say that the number of possible lines is
actually infinite. Since between any two lines you choose, no matter
how close together they are, you can always fit a bunch more in
between them.

Find out if a point is in the course of CLLocationCourse

I have 2 points, a static map annotation and the user device that moves. For both points i have Lat and Long and for the moving device i have the course which is give in degrees 0 for N, 90 for E and so on. How can i find out if the second point which is static is at N,E,W,S from my position ?
Let's say your device is at point (x,y) and the static point is at (xs,ys).
Consider the right triangle between these two points. It has catheti with length xs-x and ys-y, so the angle between the x-axis and the hypotenuse is arctan((ys-y)/(xs-x)). Note that the hypotenuse points in the direction of (xs,ys), so this angle tells you which direction that point is in.
If the angle is 0, the static point is to the east.
If the angle is pi/2, the static point is to the north.
If the angle is pi, the static point is to the west.
If the angle is 3*pi/2, the static point is to the south.
If you want this angle converted such that 0 degrees is north, 90 degrees is east, etc, it's simply a matter of computing (360 + 90 - angle * 180/pi) % 360

Are the W3C geolocation API accuracy parameter in diameter or radius of your position?

Maybe i got my head around this wrong, after stfw i could not find any info on this. When the geolocation api returns your position with latitute, longitude and accuracy (p.coords.accuracy), does the accuracy parameter return diameter or radius of your position? For instance, if accuracy of my position is 24 meters, does that mean i could be standing anywhere within a radius of 24 meters of my position, or within 12 meters radius of my position (that would give a 24 meters diameter, me being in the middle of the circle of accuracy)
Any help appreciated!
It would be the radius. So if the accuracy is 24, then the true position is within 24 meters, which would mean it would lie within a circle with radius 24 around the coordinate.

How to calculate area which was compose with mulit- Coordinates?

as topic, the Coordinates value (Latitude and Longitude) is known , these Coordinates will compose as polygonal area , my question is how to calculate the area of the polygonal that is base the geography ?
thanks for your help .
First you would need to know whether the curvature of the surface would be significant. If it is a relatively small then you can get a good approximation by projecting the coordinates onto a plane.
Determine units of measure per degree of latitude (eg. meters per degree)
Determine units of meature per degree of longitude at a given latitude (the conversion factor varies as you go North or South)
Convert latitude and longitude pairs to (x,y) pairs in the plane
Use an algorithm to compute area of a polygon. See StackOverflow 451425 or Paul Bourke
If you are calculating a large area then spherical techniques must be used.
If I understand your question correctly - triangulation should help you. Basically you break the polygonal to triangles in such a way that they don't overlap and sum their areas.