Tag Info

Hot answers tagged

8

Do a spatial join! First, set up your data frame in a projected coordinate system of your choice (whatever units you want your distances to show up in). So, say you're working in State Plane Feet, make sure all your layers are in State Plane Feet, so if they're not project them into it. From there, Right click on the points layer and click Joins & ...


7

According to Wikipedia, Vincenty's formula is slower but more accurate: Vincenty's formulae are two related iterative methods used in geodesy to calculate the distance between two points on the surface of a spheroid, developed by Thaddeus Vincenty (1975a) They are based on the assumption that the figure of the Earth is an oblate spheroid, and ...


6

Given a list of geographic coordinate pairs, you can implement the Haversine formula directly in Excel. The simplest way to use this (or a more accurate, but I think it's not your case) formula consists into press Alt+F11 to open the VBA Editor, click Insert --> Module and then (copy and) paste e.g. the code kindly suggested by blah238. There will be a ...


6

I am answering my own question with a proposed query. select *, ABS(x_permit-x_station)+ABS(y_permit-y_station) as manhattan FROM (SELECT longname AS NAME, lines AS metadata, T .slug, ST_Distance ( T .geom, ST_Transform (P .geometry, 3435) ) AS distance, ST_X(ST_Transform(p.geometry, 3435)) as x_permit, ST_Y(ST_Transform(p.geometry, 3435)) as ...


5

You can do this analysis in the "spdep" package. In the relevant neighbor functions, if you use "longlat=TRUE", the function calculates great circle distance and returns kilometers as the distance unit. In the below example you could coerce the resulting distance list object ("dist.list") to a matrix or data.frame however, it is quite efficient calculating ...


4

If you're using geopy, then the great_circle and vincenty distances are equally convenient to obtain. In this case, you should almost always use the one that gives you the more accurate result, i.e., vincenty. The two considerations (as you point out) are speed and accuracy. Vincenty is two times slower. But probably in a real application the increased ...


4

There is a python plugin for QGIS to calculate Tobler's Hiking function. It's called Walking times and you can install it using the qgis oficial repository. The plugin page explains how it works: http://sigsemgrilhetas.wordpress.com/plugins-qgis/walking-time/ And, since we are talking about open source, you can see and download all the code here: ...


4

Distances, one to another, can't be calculated on polygons (or lines for that matter). What you need to do is convert the polygons to points using feature to point to get the centroids (1 point per polygon, roughly centre) then do a near or spatial join to find the closest swamp polygon to the land parcel. If you want better location of the nearest feature ...


4

There actually is no difference between the two functions, which both yield 1.195 km. The problem is that in your question the axis order is flipped for trajectory, so you are seeing different answers than you expect. SELECT ST_AsLatLonText(point_a) AS point_a_latlon, ST_AsLatLonText(point_b) AS point_b_latlon, ST_Distance_Spheroid(point_a, point_b, ...


4

Taking into account Andre's comment, and for the sake of learning I modified another user's answer to create a 3D Line from your sample data. I hope you or someone else might find it useful: X,Y,Z,pt_dt 2970969.635,359725.0088,83.4242,1-x 2970968.278,359722.2182,83.2591,1-x 2970941.771,359670.127,83.0655,1-x 2970961.369,359708.6424,83.4785,1-x ...


4

If I understand your question correctly, you can achieve this by using the Distance to nearest hub function via Processing Toolbox. Select the required options (first image), and choose what measurement you want the distance to be calculated in which will be added into a new column. You can repeat this step to then calculate the centre of each cell to the ...


4

The following code is not polished but should work to create the same output table as the Point Distance tool but requires ArcGIS 10.1 (or later) for Desktop and only a Basic level license: import arcpy,math # Set variables for input point feature classes and output table ptFC1 = "C:/temp/test.gdb/PointFC1" ptFC2 = "C:/temp/test.gdb/PointFC2" outGDB = ...


4

The best way I can think is to get two UTM points, convert them to Lat/Long, and compare their geodesic distances to their UTM pythagorean distance. E.g. Take a point from this example: The CN Tower is ... in UTM zone 17, and the grid position is 630084m east, 4833438m north. So if we take A (17n 630084 4833438) and move it 30 km east, we get B (17n ...


3

Both answers from @HåvardTveite and @mapBaker should help you get your results. What I normally do is first use the Distance to nearest hub tool and then Join the resulting layer with the polygon layer. This is a late answer but anyway, I created 2 simple layers (polygon and point) with the following attributes: I then ran the Distance to nearest hub via ...


3

We were solving similar problem. The best and fastest way for us is: Rasterize line layer (Raster/Conversion/Rasterize...) Convert to Proximity (Raster/Analysis/Proximity...) Use plugin Point sampling tool to get values for all your point from raster


3

You are absolutely correct. From wikipedia's Mercator projection: scale factor = secant (latitude) = 1 / cosine (latitude) Generally, divide map distance by the scale factor to get globe distance. But what about "long" lines, at different latitudes, what scale factor to use? According to EF Burkholder, for short lines, just calculate one scale factor ...


3

If you have access to Network Analysis - and your bus routes are connected and directionally accurate - you can use this to determine distances. This would give you the distance along the route as opposed to as the crow flys. http://resources.arcgis.com/en/help/main/10.2/index.html#//004700000001000000


3

your coordinates are probably in lat/long with degrees as a unit. therefore, along meridians or near the equator, one degree is approximately 111km (circumference/360). note that this will change depending on the distance to the equator. A good practice is to use a local projected coordinate system that is appropriate for your location in order to have a ...


3

Use the Points to Line tool. http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000003s000000 You could use a datestamp for the sort field, if the default doesn't work the first time. The shape length of the line should be included in the output feature class, if it is in a geodatabase. You might want to check the length by adding a field to ...


3

Achieving this goal is somewhat a basic task in GIS, however the method in QGIS might not be trivial. Your best chance is to use GRASS's r.walk function, which creates an anisotropic cost surface (dem+slope+other factors). First, you have to create a friction surface as an input to r.walk. In your case it can be a single-valued raster (1.0) matching the ...


3

Assuming that your points are in order, and that this works at 10.0 (I'm using 10.2): Field Calculator Expression: dist( !Shape! ) Field Calculator Code Block: count = 0 def dist(shape): global prev global count point = arcpy.PointGeometry(shape.getPart(0)) if count > 0: distance = point.distanceTo(prev) else: ...


3

I am the developer of FlowMapper plugin. Hope you find it useful. Regarding your question: FlowMapper offers two types of flow length caculations: (i) for cartesian coordinates (e.g. UTM x y) (ii) for geographic coordinates (e.g. WGS84 easting northing) User must properly choose either CARTESIAN or GEOGRAPHIC calculation depending on the type of ...


2

Maybe this answer comes 2 years too late, but anyway. To my knowledge, spatial clustering requires a defined neighborhood to which the clustering is constrained, at least at the beginning. The kulldorf function in the SpatialEpi package allows for spatial clustering based on aggregated neighborhoods. further the DBSCAN statistic available from the fpc ...


2

Below is T-SQL code that I use for building bounding box in SQL-Server 2012. In my case I get decimal values for Lat, Long. I use this to quickly limit number of rows before I use SQL STDistance function to verify that results are actually within particular distance. Geography functions are very costly in SQL Server thus by building bounding box I'm able to ...


2

A) Direction is calculated from the difference between start and end point B) Distance of line is best to be calculated simpy by $length and is the sum of all individual parts Also note nhopton's comment on how to get bearing of each individual segment: A most elegant solution, thanks. I'd mention that if you need to determine the bearing for each ...


2

ok figured it out eventually myself centroid.ED <-SpatialPoints(coordinates(eire)) proj4string(centroid.ED) <- eire.proj eire$distance <- gDistance(pt.coords,centroid.ED,byid=TRUE) > summary(eire$distance) 1 Min. : 18.44 1st Qu.: 56.78 Median : 99.48 Mean :106.46 3rd ...


2

What you're looking into is measuring a distance on google maps. Unfortunatly, this is not a question to which an easy answer can be given, but you might consider one of these ways : The least accurate way : the haversin formula , Ellipsoidal Earth projected to a plane formula (since Google Maps is based on a Mercator projection and a WGS84 Datum, this ...


2

In your case I would rather use "generate near table" in order to have the N closest lines. you can then apply your decision rules on the resulting table in order to select the points that match best. (remark : only available with advanced licence, unfortunately)


2

I think that the function distance to can resolve your problem. here is the openlayers documentation : DistanceTo And try to use this function function nearest_feature(pointA) { var minDistance = vector.features[0].geometry.distanceTo(pointA, {details: false, edge: true}); var index =0; for (var i = 1; i <= vector.features.length ...


2

Assuming that you have an Advanced level license (you do not specify otherwise), then I think the tool to try is Point Distance (Analysis): Determines the distances from input point features to all points in the near features within a specified search radius. Note that this will give you "as the crow flies" distances rather than distances along roads ...



Only top voted, non community-wiki answers of a minimum length are eligible