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 have a tiff raster in my PostGIS 2.0 database. I want to get the value of the raster at a specified lat/lon point.

I have:

  • postgresql-9.1
  • postgis-2.0-svn with raster support
  • a raster imported into PostGIS its SRID is 3035

How can i do this? Thanks in advance!

share|improve this question
up vote 9 down vote accepted

You can transform the lat/lon point to raster CRS on the fly using ST_Transform(). Combined, the query looks like this:

ST_Value(your_raster, ST_Transform(ST_SetSRID(ST_MakePoint(lon,lat),4326),3035))
share|improve this answer
So the ST_Transform() function returns the Point geometry in the raster's SRID, and ST_Value() returns the value of the corresponding cell/pixel for the given raster? – monkut Apr 11 '12 at 8:23
Yes, that's the idea. – underdark Apr 11 '12 at 14:26
Thanks! for the clarification. – monkut Apr 12 '12 at 1:27
@underdark You dropped a ) there. – Brad Koch May 7 '13 at 17:57
@BradKoch Yes, I did :) – underdark May 7 '13 at 18:04

The function ST_value:

returns a raster value given a point in either x,y or lat,lon.

share|improve this answer
it works, but in this page the examples forces you to input your query in EPSG:3035, and i want to query in lat lon points.. – avances123 Sep 24 '11 at 15:49

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.