12.07.2015 Views

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PostGIS</strong> <strong>1.5.8</strong> <strong>Manual</strong>193 / 3107.8.25 ST_Length_SpheroidST_Length_Spheroid — Calculates the 2D or 3D length of a linestring/multilinestring on an ellipsoid. This is useful if thecoordinates of the geometry are in longitude/latitude and a length is desired without reprojection.Synopsisfloat ST_Length_Spheroid(geometry a_linestring, spheroid a_spheroid);DescriptionCalculates the length of a geometry on an ellipsoid. This is useful if the coordinates of the geometry are in longitude/latitude anda length is desired without reprojection. The ellipsoid is a separate database type and can be constructed as follows:SPHEROID[,,]SPHEROID["GRS_1980",6378137,298.257222101]NoteWill return 0 for anything that is not a MULTILINESTRING or LINESTRINGThis function supports 3d and will not drop the z-index.ExamplesSELECT ST_Length_Spheroid( geometry_column,’SPHEROID["GRS_1980",6378137,298.257222101]’ )FROM geometry_table;SELECT ST_Length_Spheroid( the_geom, sph_m ) As tot_len,ST_Length_Spheroid(ST_GeometryN(the_geom,1), sph_m) As len_line1,ST_Length_Spheroid(ST_GeometryN(the_geom,2), sph_m) As len_line2FROM (SELECT ST_GeomFromText(’MULTILINESTRING((-118.584 38.374,-118.583 38.5),(-71.05957 42.3589 , -71.061 43))’) As the_geom,CAST(’SPHEROID["GRS_1980",6378137,298.257222101]’ As spheroid) As sph_m) as foo;tot_len | len_line1 | len_line2------------------+------------------+------------------85204.5207562955 | 13986.8725229309 | 71217.6482333646--3DSELECT ST_Length_Spheroid( the_geom, sph_m ) As tot_len,ST_Length_Spheroid(ST_GeometryN(the_geom,1), sph_m) As len_line1,ST_Length_Spheroid(ST_GeometryN(the_geom,2), sph_m) As len_line2FROM (SELECT ST_GeomFromEWKT(’MULTILINESTRING((-118.584 38.374 20,-118.583 38.5 30) ←↪,(-71.05957 42.3589 75, -71.061 43 90))’) As the_geom,CAST(’SPHEROID["GRS_1980",6378137,298.257222101]’ As spheroid) As sph_m) as foo;tot_len | len_line1 | len_line2------------------+-----------------+------------------85204.5259107402 | 13986.876097711 | 71217.6498130292

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!