Hot answers tagged distance
12
Using the Pythagorean formula on positions given in latitude and longitude makes as little sense as, say, computing the area of a circle using the formula for a square: although it produces a number, there is no reason to suppose it ought to work.
Although at small scales any smooth surface looks like a plane, the accuracy of the Pythagorean formula depends ...
5
If your facilities and incidents are both feature layers, and you only care about finding the closest (and not 2nd closest, 3rd closest, etc.) then you can just run Spatial Join. Set your incidents as the target_features, facilities as join_features, and closest as the match_option, and it will join the attributes of the nearest facility to each incident.
4
The simplest way to do this is to use the linear referencing methods with Shapely.
from shapely.geometry import LineString, Point
# Example data
busRoute = LineString([(80, 380), (160, 380), (220, 370), (280, 330), (310, 210), (379, 185)])
currentLocation = Point(280, 350)
# The current location is not exactly on the bus route
...
2
ArcMap has a default selection tolerance of 3 pixels. The IMxDocument interface exposes this value in two ways:
SearchTolerance: The global search tolerance in geographic units for selection. The application's search tolerance is measured and set using pixel units. This property automatically converts the size of the pixels to map units.
...
2
You could try running your point and polyline dataset through the spatial join geo-processing tool. If you set the match option to closest you can also specify a distance field which gives you the distance to the nearest polyline. From that you can do your summary statistics.
So fire up desktop help and look for the spatial join tool.
2
I interpreted "Pythagonean distance" as "Euclidean distance". Then the
answer is the same as "what is the difference between the length of a
chord of a circle and the subtended perimeter?" Let radius be R,
subtended angle is A (radians).
perimeter = L = A*R
chord = C = 2*sin(A/2)*R
diff = D = L - C
= (A-2*sin(A/2))*R
= A^3/24 * R (for A small)
...
1
If you have an ArcInfo (or Advanced) license level the Near Analysis tool should give you exactly what you need. It will add the ID of the nearest feature to your input point feature class attribute table, and a distance as well. FYI - The distance will be in the units of your input data's projection.
1
If you have ArcInfo you can run a Near analysis to calculate the distance to the nearest feature and then get the average from the NEAR_DIST field.
If you don't have you may need to write a script and depending on the size of your data-sets, you may want to create a fishnet first to minimize the amount of processing time.
1
Although I have found no documentation to the effect that a Projected Coordinate System is required it is perhaps unsurprising that a Geographic Coordinate System is unsupported because the length of a degree varies depending on the latitude.
I suspect that a documentation enhancement is the most that is likely to happen with this but I encourage you to ...
1
A historical footnote:
The haversine was a way of avoiding large round-off errors in
computations such as
1 - cos(x)
when x is small. In terms of the haversine we have
1 - cos(x) = 2*sin(x/2)^2
= 2*haversin(x)
and 2*sin(x/2)^2 can be computed accurately even when x is small.
In the old days, the haversine formula had an additional ...
1
In Arc10.1 there are 3 tools that will complete this task:
Near
Near3d (3d analyst)
Generate Near Table
Both Near and Near 3d will change your original data while Generate Near Table will create a separate table output.
Near 3d may be the best option for mountainous terrain with high relief, but if you lack the 3d Analyst license or are working ...
1
As Indicated in my comment, I am not sure why you have chosen EPSG:32661. I would have chosen a UTM projection.
However, the actual usage of the query is quite simple.
ST_DWithin requires three inputs. The First two are geometries, and the third is the distance. If you use it in a query, the first geometry comes from your table, and the second geometry is ...
1
Microsoft (due mostly to a lack of knowledge about geodesics) elected to
define geographical distances along great ellipses and this is what
STDistance on Geographic objects returns. For the formulas that are
used see Kallay, Geometric algorithms on an ellipsoid earth model (2008),
http://dx.doi.org/10.1145/1463434.1463487 Also relevant is Kallay, Defining ...
Only top voted, non community-wiki answers of a minimum length are eligible


