[postgis-users] Another few questions

Stephen Woodbridge woodbri at swoodbridge.com
Sun Mar 30 11:48:12 PDT 2008


Paul Tomblin wrote:
> Sorry to start bugging everybody like this, but the manual is pretty 
> horrible if you're trying to handroll stuff from scratch.  Keep in mind 
> I'm not trying to display this data in some pre-existing program, just 
> do a bunch of spatial queries on point, line and polygon data.
> 
> 1. I'm trying to do geographic (lat/long) projections.  How do I define 
> a polygon that encompasses the whole world?  I've added a column to one 
> of my tables using:
>     select addgeometrycolumn('areaids','rectangle',4326,'POLYGON',2);
> but when I try to add a world encompassing polygon using:
>     insert into areaids values (nextval('areaids_pk_seq'), null, null, 
> 0, geomfromtext('POLYGON((-180 -90, 180 -90, 180 90, -180 90, -180 
> -90))'));

insert into areaids values (nextval('areaids_pk_seq'), null, null, 0, 
setsrid(geomfromtext('POLYGON((-180 -90, 180 -90, 180 90, -180 90, -180 
-90))')), 4326);

> I get:
>     ERROR:  new row for relation "areaids" violates check constraint 
> "enforce_srid_rectangle"
> 
> 2. The documentation never mentions geographic projections except in the 
> section about ST_Distance_Sphere.  Do I enter them as latitude longitude 
> or longitude latitude?  Also, is East or West positive?

East is positive

> 3. Is there any way to get the corners of a polygon or its bounding box 
> out as separate points?
> 
> 4. Is there a perl library that will parse WKT or WKB?
> 




More information about the postgis-users mailing list