AW: [mapserver-users] Raster pixel value

Düster Horst Horst.Duester at bd.so.ch
Fri Nov 22 02:57:37 EST 2002


Brian,

I had the same problem like you. We need elevation information from a DEM
stored in ESRI Grid format. I solved it with PostGIS. 

- export Grid to shape file (points)
- import shape file to PostGIS with OGR2OGR with option -with "elev-value >
0" to eliminate all no data records.
- build index 

--> ready :-)

To get the elevation for an arbitrary point at the DEM you need to use PHP:

query:  

//  desired point => $x, $y
//  desired search circle => $search
//  $x+-$search, $y+-$search => $xmin,$ymin ...

  select value,asText(wkb_geometry) as point from dhm_pnt 
  where 
  distance(GeometryFromText('POINT($x $y)',-1),wkb_geometry) <= $search
  and wkb_geometry && 'BOX3D($xmin $ymin, $xmax $ymax)'::box3d;

Now you need to read these some points resulted from query to interpoplate
the desired elevation for the user point with inverse distance weight mean.

Our dhm_pnt table has 2.3 million records but works very very fast. The
advantage of this approach you dont need MapServer. You likewise can get the
coordinates from every other source p.e. HTML <input ...>.

Hope this helps

Horst


-----Ursprüngliche Nachricht-----
Von: Frank Warmerdam [mailto:warmerdam at pobox.com]
Gesendet am: Donnerstag, 21. November 2002 21:55
An: Brian Clark
Cc: mapserver
Betreff: Re: [mapserver-users] Raster pixel value

Brian Clark wrote:
> Is there a way, using Mapserver, to pick a point on a raster and return 
> the pixel value? Such as elevations from a DEM?

Brian,

I don't believe this is possible within mapserver.  The current architecture
for rasters in MapServer is such that pretty much the only API interface
between mapserver and the raster support is the msDrawRasterLayer() call.
This is different than shapefiles where there are mapserver functions to
fetch individual shapes from a shapefile accessable from mapscript.

So, not it isn't available, and it would not be trivial to do so.

Best regards,

-- 
---------------------------------------+------------------------------------
--
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the mapserver-users mailing list