Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm testing spatial database performance on a dataset. Spatial objects in this dataset (stored as WKT in a flat text file) are random valid polygons which have vertex coordinates (x,y) where 100,000> x >0 and same for y.

Currently I'm having problem with inserting these data into PostGIS which has a geometry constraint check and I got an error like "violates check constraint "enforce_srid_polygon ".

So, how can I find/create a srid for my dataset ?

BTW: the polygons are valid polygons which are extracted from images by segmenting objects.

share|improve this question
Thanks for the answers. But the problems for me is I have to create a table in PostGIs and write the AddGeometryColumn, and so far I tried 4326 which didn't work for my dataset (stored as WKT in a flat file). – ablimit Dec 4 '12 at 3:16
Can you show us the first few lines of the WKT? – BradHards Dec 4 '12 at 8:59
Example WKT: Polygon((40298 27160, 40299 27160, 40300 27160, 40301 27160, 40302 27160, 40303 27160, ..........................)) – ablimit Dec 4 '12 at 21:36
What is just before the closing bracket? – BradHards Dec 5 '12 at 2:58

You can query it with Find_SRID. So if your table looks something like:

  id integer NOT NULL,
  geom geometry(Polygon,4326),

then use:

postgis=# SELECT Find_SRID('', 'ply', 'geom');
(1 row)
share|improve this answer

If I am not wrong, I think SRID is same as WKID in ESRI parlance.
You can get a list of WKIDs from the following URLs:
Projected Coordinate Systems WKID List
Geographic Coordinate Systems WKID List


share|improve this answer
Thanks. But which one is appropriate for my dataset ? – ablimit Dec 4 '12 at 3:21
That will depend on whats the extent of your test data. Do you know the corordinate bound for your data? – ujjwalesri Dec 4 '12 at 3:28
right srid is one which data is in. Knowing what you have is phase 1 , after that you can start to think converting it to something more suitable for you. – simplexio Dec 4 '12 at 8:00
yes. The coordinate bounds are 0< x < 100K, 0 < y <100k – ablimit Dec 4 '12 at 21:33

The SRID if the polygon you are inserting has to match the SRID specified for that geometry column. So whatever you used in the srid argument of AddGeometryColumn is what you need for the INSERT.

Note that random vertices aren't necessarily going to give you valid polygons.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.