views:

226

answers:

1

Hello guys,

I would like to insert the polygon containing Europe in my PostGIS database.

I have the follwoing extremes points:

NW = NorthWest Border(lat=82.7021697 lon=-28.0371000)

NE = NorthEast Border(lat=82.7021697 lon=74.1357000)

SE = SouthEast Border(lat=33.8978000 lon=74.1357000)

SW = SouthWest Border(lat=33.8978000 lon=-28.0371000)

Is the following a valid polygon:

POLYGON((NWLon NWLat, NELon NELat, SELon SElat, SWLon SWLat, NWlon NWLat))

Is this a valid polygon?

I do see some polygon with the follwing format POLYGON((), ()) ? When are they used?

Why not a linestring?

Any help will be apreciated? This is getting me really confused.

Thanks

+1  A: 

This is a PostGIS polygon:

ST_GeomFromText('POLYGON(lon1 lat1, lon2 lat2, ... lonN latN)', SRID)

where SRID is the SRID of the geometry column you are interacting with.

In plain Postgres, the geometry types include a polygon (ie, no projection data, no background GIS functions, not really to be used with longitude and latitude); the syntax for those polygons is:

insert into some_table (polygon_column) values ('(1,1),(2,2),(3,4),(1,1)');

You may also find this question: http://stackoverflow.com/questions/1012504/sql-query-for-point-in-polygon-using-postgres relevant.

bvmou