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

Is anyone having an idea about how to get attribute data of a polygon layer by giving Coordinates with in that polygon. Here i have tried with these codes..

SELECT * FROM kar_bbmp_198 WHERE ST_Contains(geom, ST_GeomFromEWKT('SRID=4326;POINT(779322 1440590)'))

SELECT * FROM public.kar_bbmp_198 WHERE ST_Within(geom,ST_PointFromText('POINT(779322 1440590)',32643));

But I am getting an error message like

ERROR: Operation on mixed SRID geometries ********** Error ********** ERROR: Operation on mixed SRID geometries SQL state: XX000

Any idea... I am using PostGIS 2.0 and PostgreSQL 9.1

Thanks in advance...

share|improve this question
What do you get from: SELECT ST_SRID(geom) FROM kar_bbmp_198; ?? – Micha Jul 23 '12 at 16:23
@Micha, Actually i need to get attributes of the polygon, in which the point will falls. (kar_bbmp_198 is a polygon shapefile. If a user specifies a X-Y point; then the query have to run and user have to get the result).. – kishor Jul 24 '12 at 4:07
From the error you posted above, it seems that the kar_bbmp_198 layer is in some other CRS, NOT UTM 43N. Let's determine what CRS we're dealing with first (using the SELECT ST_SRID() I mentioned above). Then you can use the answer posted by rec.thegeom below to construct the exact query you need. – Micha Jul 24 '12 at 7:07
@Micha, As u told, the problem is with the CRS only. So i again created another db and uploaded new shapefile, now its working fine. Thanks for ur valuable suggestions.. – kishor Jul 24 '12 at 9:01
up vote 1 down vote accepted

Based on the point-pair values I'll assume the coordinates are meant to be projected in EPSG:32643. Given your error message I'll assume your stored geometry is EPSG:4326. You can transform the point projection, like:

SELECT * FROM kar_bbmp_198
ST_Transform(ST_GeomFromText('POINT(779322 1440590)',32643),4326), geom
) = TRUE;

You might check out the docs for ST_PointFromText, ST_GeomFromText, ST_Contains, and ST_Within for future reference.

share|improve this answer
Thank u very much.. its working fine.... – kishor Jul 24 '12 at 9:03

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.