Tag Info

Hot answers tagged

14

The geopy module provides the Vincenty formula, which provides accurate ellipsoid distances. Couple this with the wkt loading in Shapely, and you have reasonably simple code: from geopy import distance from shapely.wkt import loads line_wkt="LINESTRING(3.0 4.0, 3.1 4.1)" # a number of other elipsoids are supported distance.VincentyDistance.ELLIPSOID = ...


9

Apart from, as @underdark says ST_Length() returns a cartesian distance between the two points which in an unprojected CS is meaningless in this case, I would go with the answer you get from PostGIS. Google Earth uses a spherical globe, whereas the WGS84 globe is a spheroid - it is slightly squashed at the poles. Over short distances, there won't be much ...


9

The principal radius of the WGS84 spheroid is a = 6378137 meters and its inverse flattening is f = 298.257223563, whence the squared eccentricity is e2 = (2 - 1/f)/f = 0.0066943799901413165. The meridional radius of curvature at latitude phi is M = a(1 - e2) / (1 - e2 sin(phi)^2)^(3/2) and the radius of curvature along the parallel is N = a / (1 - e2 ...


6

You are not using geodesic functions to calculate the length, which means that for a point there is an error factor of: cos( LATITUDE * pi() / 180 ) If you then multiply the calculated lenght by the error factor you should obtain a value pretty close to the actual trail length. For instance the Old Beechy Rail Trail is close to Melbourne, which has a ...


6

Coordinate Systems [...] Shapely does not support coordinate system transformations. All operations on two or more features presume that the features exist in the same Cartesian plane. Source: http://toblerity.org/shapely/manual.html#coordinate-systems Being shapely completely agnostic in reference to SRS, it's quite obvious that the length ...


6

As alfaciano says in shapely, the distance is the Euclidean Distance or Linear distance between two points on a plane and not the Great-circle distance between two points on a sphere. from shapely.geometry import Point point1 = Point(50.67,4.62) point2 = Point(51.67, 4.64) import math # Euclidean Dustance def Euclidean_distance(point1,point2): return ...


6

According to the ArcGIS Help website for a related tool, this field should be in the units of the output coordinate system, which in your case is meters. When the output is a feature class in a file geodatabase or a personal geodatabase, the values in the Shape_Length field are always in the units of the output coordinate system specified by the ...


5

Replacing st_length with st_transform(way,4326)::geography solves the geodetic distance problem - thanks unicoletti!. Old Beechy Rail Trail | 47.2km Great Southern Rail Trail | 53.5km Ballarat-Skipton Rail Trail | 57.2km High Country Rail Trail | 63.7km East Gippsland Rail Trail | 97.6km ...


5

One option is to create a fishnet grid specific to your area of interest. By specifying one row and X columns, you can very efficiently create a series of lines. I describe this method in greater detail here and here for two similar situations. For fine control of individual line placement, use the editor. From the image, you can see I created 16 lines ...


5

it is much easier now in 10. Right click on the length field and select calculate geometry. you can select the pcs of the data or the document, then select the units.


5

The CRS of your project is probably set on a geometric CRS like WGS. Try setting it to the same one you used for the shapefile.


5

Michael Miles-Stimson had the same idea as me, but since you aren't familiar with coding, here's another (similar) option. Turns out this is pretty easy to do using Field Calculator. Create a field called something like "Orientation" and make it a text type. Open the field calculator and set the parser to Python. Tick the "Show Codeblock" box and enter ...


4

Unioning the tables together is one way: WITH alltables AS ( SELECT the_geom FROM D1_r UNION ALL SELECT the_geom FROM D2_r UNION ALL SELECT the_geom FROM D3_r ) SELECT sum(ST_Length_Spheroid(the_geom,'SPHEROID["WGS 84",6378137,298.257223563]'))/1000 AS km_roads FROM alltables; Incidentally if you want PostGIS 1.5+ you can use the Geography ...


4

You could also use Shapely's length property, i.e.: from shapely.wkt import loads l=loads('LINESTRING(3.0 4.0, 3.1 4.1)') print l.length


4

try to use following sql. ALTER TABLE network ADD COLUMN shape_leng double precision; UPDATE network SET shape_leng = length(the_geom); i hope it helps you...


4

A slight modification of the answer linked in the comments would be to do a Summary Statistics to get the SUM of the Shape.Length field of the intersect feature class, using the FID field of the polygons a case field, and then Join Field that back to the polygon feature class. In the ArcMap 10.1 Python window, these commands worked for me: intersection = ...


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

For the first part of your question: What about ST_LongestLine using the same geometry twice as input? SELECT ST_Length(ST_LongestLine( (SELECT geom FROM mylayer WHERE gid=1), (SELECT geom FROM mylayer WHERE gid=1)) ); For the second part of your question: Concerning the calculation of the average width of polygons some interesting answeres can ...


4

So, you have a point feature class. Every point has a unique attribute that represents the sequence (e.g., from 1 to 100). You want to get a point with PointID = 1, find a distance to the point with PointID = 2, and write this distance value into the Distance field in the feature class (Distance field for feature PointID2 will contain the distance from ...


3

If you use bing map, you may use Openlayers plugin. The units of that are not real metres. They fit only at the equator, and get distorted the more to the poles you come. Try the UTM projection designed for your part of the world to draw the building with cad tools. If you don't have a suitable map in UTM projection, make a screen copy of the bing map with ...


3

If you can make the start of the line as coordinate locations in a table, then Add Field and Calculate Field values for the end coordinate locations (if the 30 m change is in both the X and Y or by an angle this may need trigonometry), then Make XY Event Layer for each set of coordinate pairs, Merge into one point file, and then use Points To Line with the ...


3

Let's first address the side note. "3D length" means the actual length of the path on the earth's surface represented by the polyline, accounting for the additional length contributed by its motion up and down. "Geodesic length" usually refers to the length of a path within a Riemannian manifold. There are at least two useful and reasonable ways in which ...


3

In QGIS start an edit session for your line layer, then open the attribute table. Click the Field Calculator button, create a new field with a "Double" data type, set the width and precision, then enter $length in the Expression area. When you click OK the length for each feature will be calculated. The length will be expressed in units of the layer's ...


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 ...


3

For part one use ST_MaxDistance Returns the 2-dimensional maximum distance between two linestrings in projected units. If g1 and g2 is the same geometry the function will return the distance between the two vertices most far from each other in that geometry. Example: SELECT gid, ST_MaxDistance(geom, geom) AS "Max Length" FROM layer


3

I have made a tool that does this measurement. This tool needs only three parameters: Just download the Measure_Length.tbx and locate in the ArcCatalog and run. Input Point Feature Unique field (in the attribute table) A field that will be populated by this script, data type for this field must be double Please find the tool in the github at here. ...


2

I'd use ogr2ogr (http://www.gdal.org/ogr/index.html) to do it directly but if you really must use python then there are python bindings (http://pypi.python.org/pypi/GDAL/) to let you do it.


2

do you mean inside the field calculator? in this case I suggest you to use python because starting from 10.0 it's the "official" language supported in ArcGIS 10.0 is the last ArcGIS version that uses VBscript, staring from 10.1 it will be deprecated and unsupported with Python in field calculator you have to use !Shape.length! or !Shape.area! (Python "!" ...


2

The way I will do it involve to steps 1)make a point layer where you can control the limits of the rectangle 2)Make a new polygon layer, set the proper snapping options, in order that you can trace the polygon by snapping the points, Hope it helps


2

The "Improved Polygon Capturing" plugin will let you specify line lengths as you draw. The CAD Tools ortho tool will let you draw 90 degree angles. However, unfortunately it doesn't seem like the two will work together!



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