Tag Info

Hot answers tagged

9

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


8

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


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


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

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.


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


2

Answer: SELECT (SELECT sum(ST_Length_Spheroid("D1_r".the_geom,'SPHEROID["WGS 84",6378137,298.257223563]'))/1000 FROM "D1_r") AS km_roads1, (SELECT sum(ST_Length_Spheroid("D2_r".the_geom,'SPHEROID["WGS 84",6378137,298.257223563]'))/1000 FROM "D2_r") AS km_roads2, (SELECT sum(ST_Length_Spheroid("D1_r".the_geom,'SPHEROID["WGS ...


2

If the data in the network table is either being updated or added, it would be wise to make a trigger function to update the data, so the line lengths are always up-to-date. To do this, make a trigger procedure, written in PL/pgSQL: CREATE OR REPLACE FUNCTION shape_leng() RETURNS trigger AS $BODY$BEGIN NEW.shape_leng := ST_Length(NEW.the_geom); RETURN ...


2

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


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


1

Most probably your project CRS is set to default WGS84, that is lat/lon degrees. You better set the project CRS to that of the Geotiff you created. Then the values for vector grid are in the units of the CRS. You can select min and max values to the ones you need, either by taking the values written on the map, or moving the mouse to the lines and noting ...


1

It sound like instead of the intersect you may be using the merge. The three items are then what is known as a multipart objects. You can use the explode on multiparts to get the singleparts. However If you use the intersect command correctly it should give what you want. Be sure to select the Line layer first. Then select the Polygon layer. (that could be ...


1

Another option is to use the GRASS plugin. GRASS has a module called v.mkgrid. You can either set the number of rows and columns, or the width/length of each grid cell. The grid is created within the current GRASS region. The plugin interface within QGIS allows to set only the number of rows and columns. But if you run the module in the GRASS "shell" you ...


1

Perhaps try splitting the lines into segments after digitizing the entire length, using the Split command on the Editor toolbar. Alternatively, the free tool Station Points in ET Geowizards can be used to create points that can then be used in the Split Line At Point tool.


1

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.



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