Given latitude and longitude of a location say 27.1231 and 72.3454 how do I randomly plot points within a circle of radius say 10km with the above lat and log as the center?
It's somewhat similar to this (?)
EDIT
It's a geocoder question and not a Gmaps4rails one
How to get the co-ordinates of random points within a given range?
you may use google.maps.geometry.spherical.computeOffset with random distance and heading
Related
I am attempting to calculate the bearing from an object with geodesic coords given by latitude/longitude and a heading to another object at different latitude/longitude coordinates.
A rough sketch of the problem is
where the triangle represents object one, the arrow represents object one's heading, and the square represents object two.
I am aware this can be done using the haversine formula, as in , but how would one do this while simultaneously taking spheroid earth into consideration.
I have two geo points (-27, 152) and (9, -83) and an intermediate point is (?, 180). I want to calculate Latitude of the intermediate point.
Conditions:
1) On Google Map all three points are on straight line.
So please suggest a formula to calculate it.
//For iOS developers
In actual I am trying to draw polyline on Apple Map in iOS. The polyline does not work when path is crossing 180 meridian.
You need to figure out the slope of the line given the two coordinates that you have. Then use the slope and one point on the line to figure out the x coordinate (latitude).
Here is a link that will teach you the basic geometry and formula: Find X-Coordinate of a point on a line, given another point and slope
I'm trying to iteratively traverse the United States in 1 mile increments using latitude and longitude coordinates. Essentially, once I start (lets say in Portland, OR), I want to move south in one mile increments until I reach the southernmost boundary of the United States that is of the same latitude as Portland, OR. At this point, I want to start back at the northernmost part and move one mile east, repeating the entire process until I get to the east coast. I need to aggrigate these longitude/latitude points in a database.
My question is: Is it accurate to step through latitude and longitude by calculating the next lat/long pair using a delta of 1 mile each time, or are there simpler and more elegant methods to achieve my end goal?
I suppose you could start with the lat/lon of Portland, OR and the lat/lon of the bottom boundary. Compute the distance using Haversine found here: http://www.movable-type.co.uk/scripts/latlong.html
Using the distance above, loop through each mile using a the section Destination point given distance and bearing from start point from the website above. For moving south, your bearing will 180 deg (use π in the formula as they expect radians). For moving east, your bearing will be 90 deg (π/2).
Based on Instructions on how to display and clear a route on a map by using a location document
the routing use x,y Based Location.
my question : how to convert longitude and latitude to x,y based location to be able to use them to route in BB maps.
thanks
The X and Y values in the location document specified by your link are latitude and longitude respectively in degrees multiplied by 10,000.
I have a series of lat/lon which represents the center of some object. I need to draw a line through this point that is x meters on either side of the center and it needs to be perpendicular to the heading (imagine a capital T)
Ultimately I want to get the lat/lon of this line's endpoints.
Thanks!
The basic calculation is in this similar question's answer: Calculate second point knowing the starting point and distance. Calculate the points for the two headings perpendicular to the main heading the distance away you want.
Have a look at: Core Location extensions for bearing and distance
With those extensions and two points on the initial line you should be able to get the bearing, add/subtract pi/2 and find points to either side like this:
double bearing = [bottomOfT bearingInRadiansTowardsLocation:topOfT];
CLLocation *left = [topOfT newLocationAtDistance:meters
alongBearingradians:bearing+M_PI/2];
CLLocation *right = [topOfT newLocationAtDistance:meters
alongBearingradians:bearing-M_PI/2];