[postgis-users] polygon minimum width
Simon Greener
simon at spatialdbadvisor.com
Tue Oct 13 23:45:50 PDT 2009
Surya,
Yes, SQL Analytics / Windowing functions are only available in version 8.4.
There are many methods for simulating a ROWNUMBER in Postgresql but, in this case, we could use the CTID field
to distinguish between the two rows.:
select CTID as rin, the_geom
from River r
where r.Name = 'Barito';
ctid;the_geom
tid;geometry
(0,1);"010200002000000000050000000000000000B06DC000000000005061C00000000000E053C00000000000803FC00000000000E05DC000000000006059400000000000C044400000000000D064400000000000C049C00000000000706F40"
(0,2);"0102000020000000000700000000000000004045400000000000F870400000000000106B4000000000007064400000000000A051400000000000205540000000000000124000000000000012C00000000000C043C00000000000404DC00000000000E053C00000000000F062C000000000004044C00000000000706EC0"
SELECT min(ST_Distance(l.the_geom,r.the_geom)) as Min_Width
FROM (select ctid as rin, the_geom
from River r
where r.Name = 'Barito' ) as l,
(select ctid as rin, the_geom
from River r
where r.Name = 'Barito' ) as r
WHERE l.rin <> r.rin;
min_width
double precision
48.2597140480546
regards
Simon
--
SpatialDB Advice and Design, Solutions Architecture and Programming,
Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
Website: www.spatialdbadvisor.com
Email: simon at spatialdbadvisor.com
Voice: +61 362 396397
Mobile: +61 418 396391
Skype: sggreener
Longitude: 147.20515 (147° 12' 18" E)
Latitude: -43.01530 (43° 00' 55" S)
GeoHash: r22em9r98wg
NAC:W80CK 7SWP3
More information about the postgis-users
mailing list