[postgis-users] Polygon problem in Lon/Lat SRID 4326

Carlos Ferrão cferrao at gmail.com
Thu May 18 11:47:14 PDT 2006


Hello all,
I am using a Geometry data type to store Polygons in Lon/Lat
coordinates with the SRID 4326.
I created the database, ran the lwpostgis.sql and spatial_ref_sys.sql.
I added the geometry column with SELECT
AddGeometryColumn('mytable','mygeolocation',4326,'GEOMETRY',2);

For most of my polygons everything seems ok. However, the polygons
which have one of its points in the other side of the time limit are
considered invalid (isValid='f') and the polygon is stored as if my
world is flat and not a sphere (doesn't connect the 180 to the -180
longitudes).

For instance, defining POLYGON((177.87 72.75,-179.15 72.4,174.19
66.05,173.92 65.7,171.66 65.98,171.91 66.33,177.87 72.75)) returns a
polygon whose vertices cross the whole world as the second longitude
is a negative value. As you can see, the polygon points are defined in
a clockwise order.

What is the correct way to define a polygon in this case? Do I have to
translate my coordinates somehow?

Thanks in advance,
Carlos Ferrao



More information about the postgis-users mailing list