Tag Info

New answers tagged


Not tested pseudo code CREATE TABLE work (sid serial , gid biginteger, geom geometry) INSERT INTO work (gid, geom) SELECT gid, geom from baselines WHERE ST_Length(geom) > 250 SELECT floor(max(1/st_length(geom))) as forloop from work -- for future use SELECT max(sid) as max_sid from work -- for future use LOOP this : do forloop times (4.5 -> 4 ...


ST_Length, when called on a geometry, reports in units of the spatial reference system. For EPSG:900913/EPSG:3857, the units are in Mercator meters, not in meters. At all points on the globe, a Mercator meter is at most 1 real meter. To do this there are two possible fixes Transform to an appropriate projection for your area. UTM, state plane and albers ...


You should cast all geometry DB fields to geography and then do the calculations: SELECT polys.id, sum(st_length(st_intersection(geography(lines.the_geom),geography(polys.the_geom))))/1000 total_lengths from schema.table1polys polys schema.table2lines lines on ST_Intersects(geography(lines.the_geom),geography(polys.the_geom));

Top 50 recent answers are included