[postgis-users] Getting dimensions of polygon sides

Obe, Regina robe.dnd at cityofboston.gov
Wed Jun 11 08:01:56 PDT 2008

I'm trying to similuate ArcGIS annotations.  I guess ArcPad doesn't
support ArcGIS annotations according to what I have been told but can
support line strings and so forth.  

Here is the the problem.  I have a set of parcel polygon geometries.
I'm going to assume that each lines side is composed of 2 points and no
polygon has more than 1000 sides.  I need to create a table that has a
separate row for each side with the length  of that side as an attribute

I stupidly thought I could take the boundary and then figure out the
length of the boundary forgetting that this just gives me the perimeter.

So my second thought was that if I reconstitute points of the boundary
grouping 2 at a time  - that would do the trick.

My query is still running so haven't looked to see what the final result
is.  I'm wondering if someone has done something similar and if they
have an easier way.

Below is the query I am testing right now.

  INSERT INTO assessing.parcdimstime_2008(pid, pid_year, the_geom)
	SELECT b.pid, b.pid_year, ST_MakeLine(ST_PointN(the_boundary,n),
ST_PointN(the_boundary, n + 1)) As the_side
	FROM (SELECT pid, pid_year, the_boundary,
ST_NumPoints(the_boundary) As nump
		FROM (SELECT pid, pid_year, ST_Boundary(the_geom) As
			FROM assessing.parceltime
			WHERE pid_year = 2008) p) As b
				CROSS JOIN generate_series(1, 1000) n
	WHERE n < b.nump;

UPDATE assessing.parcdimstime_2008 SET sd_length = ST_Length(the_geom);


The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.

More information about the postgis-users mailing list