Re: [mapserver-users] Point query from Mapserver raster

2021-11-02 Thread Rahkonen Jukka (MML)
Hi,

Yes, it is a useful hack. The same hack works with Geoservers but then 
GetFeatureInfo returns the values that are scaled to 0-255 for GetMaps instead 
of the raw values and that is not especially useful if you have a DEM layer. So 
be warned and stay with Mapserver.
None of the existing OGC standards suits well for point queries from rasters 
but the coming OGC API Coverages standard should support those 
https://github.com/opengeospatial/ogcapi-coverages/issues/112.

-Jukka-

Lähettäjä: MapServer-users 
mailto:mapserver-users-boun...@lists.osgeo.org>>
 Puolesta Carl Godkin
Lähetetty: tiistai 2. marraskuuta 2021 18.04
Vastaanottaja: 
mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>
Aihe: Re: [mapserver-users] Point query from Mapserver raster

Thanks for the quick response, Jukka.

I did not realize that X/Y had been replaced by I/J.  I just tried that instead 
and it still worked (of course) but I still get the warning message.

I had also been trying WMS 1.1.0 and 1.1.1 earlier and I am unable to find any 
combination of versions and other query parameters to quiet the warning message.

Regarding the BBOX range, I opened the range to a full degree in each direction 
and still get the warning.  I think I will stick with the query I posted 
originally (with 1.3.0) since it works and just ignore the messages in the log.

This seems like sort of a hack to me (asking for a box when I want a point, 
etc.) which is why I asked my question in the first place.  But it works fine 
so I'm happy!

Thanks again,

carl

___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Point query from Mapserver raster

2021-11-02 Thread Carl Godkin
Thanks for the quick response, Jukka.

I did not realize that X/Y had been replaced by I/J.  I just tried that
instead and it still worked (of course) but I still get the warning message.

I had also been trying WMS 1.1.0 and 1.1.1 earlier and I am unable to find
any combination of versions and other query parameters to quiet the warning
message.

Regarding the BBOX range, I opened the range to a full degree in each
direction and still get the warning.  I think I will stick with the query I
posted originally (with 1.3.0) since it works and just ignore the messages
in the log.

This seems like sort of a hack to me (asking for a box when I want a point,
etc.) which is why I asked my question in the first place.  But it works
fine so I'm happy!

Thanks again,

carl



On Tue, Nov 2, 2021 at 8:29 AM Rahkonen Jukka (MML) <
jukka.rahko...@maanmittauslaitos.fi> wrote:

> Hi,
>
>
>
> You do not seem to do anything wrong. Your WMS 1.3.0 EPSG:4326 lat-long
> BBOX=42.94,-122.09,42.95,-122.08& gets converted into long-lat order and
> for some reason the lower and higher values are equal
> {-122.082500,42.942500,-122.082500,42.942500}, thus this is no more a box
> but a point.
>
> GetFeatureInfo with a small bbox and width=2 and height=2 is a trick that
> is certainly not heavily tested because the corresponding GetMap is pretty
> odd despite being valid.  Maybe using slightly bigger BBOX makes Mapserver
> to query the backend raster with a rectangle instead of a point.
>
> BTW X=1 and Y=1 are not valid in WMS 1.3.0, you are supposed to use i= and
> j= instead. That makes me think that maybe you could have a try with a full
> and valid WMS 1.1.0 GetFeatureInfo request with SRS= and BBOX in long-lat
> order and see if it has any effect on the msProjectRect()
>
>
>
> -Jukka Rahkonen-
>
>
>
> *Lähettäjä:* MapServer-users  
> *Puolesta
> *Carl Godkin
> *Lähetetty:* tiistai 2. marraskuuta 2021 17.06
> *Vastaanottaja:* mapserver-users@lists.osgeo.org
> *Aihe:* Re: [mapserver-users] Point query from Mapserver raster
>
>
>
> Hi,
>
>
>
> Following Jukka's advice on my elevation point query, I am trying to use
> WMS GetFeatureInfo,
>
>
>
> I've mostly got it working but have a few more questions.  (I am using
> MS4W 4.0.5 which includes MapServer 7.7.0)
>
>
>
> I added a LAYER to my WMS map file:
>
>
>
>   LAYER
>
> PROCESSING "RESAMPLE=BILINEAR"
>
> NAME SRTM_3_arc-second_grid
>
> METADATA
>
>   "wms_title"   "SRTM - 3 arc-second grid"
>
>   "ows_extent"  "-125 24 -66 50"
>
>   "wms_include_items"   "all"
>
> END
>
>
>
> TYPE RASTER
>
> STATUS ON
>
> TILEINDEX "srtm_3_hgt-index.shp"
>
> TILEITEM "Location"
>
> TEMPLATE "../template.html"
>
> PROJECTION
>
>   "init=epsg:4326"
>
> END
>
>   END
>
>
>
> and an empty template except for the
>
>
>
> 
>
>
>
> line.  Here's my query:
>
>
>
> http://localhost:8080/wms?
>
>   SERVICE=WMS&
>
>   VERSION=1.3.0&
>
>   REQUEST=GetFeatureInfo&
>
>   LAYERS=SRTM_3_arc-second_grid&
>
>   CRS=EPSG:4326&
>
>   BBOX=42.94,-122.09,42.95,-122.08&
>
>   WIDTH=2&
>
>   HEIGHT=2&
>
>   X=1&
>
>   Y=1&
>
>   QUERY_LAYERS=SRTM_3_arc-second_grid
>
>
>
> This works fine and returns the elevation I am expecting.  However, the
> MapServer log complains about a "degenerate rect" every time:
>
>
>
> [Tue Nov  2 07:58:44 2021].66000 msProjectRect(): Warning: degenerate rect
> {-122.082500,42.942500,-122.082500,42.942500}
>
>
>
> What am I doing wrong here?   As I posted originally, I am really only
> interested in a point here.
>
>
>
> Thank you very much,
>
>
>
> carl
>
>
>
>
>
> On Mon, Nov 1, 2021 at 12:58 AM Rahkonen Jukka (MML) <
> jukka.rahko...@maanmittauslaitos.fi> wrote:
>
> Hi,
>
>
>
> The WMS GetFeatureInfo should work and the answer in gis.stackexhange
> seems to contain all the details that you need for making it to work.
>
> With WCS what you did is probably the best you can do with Mapserver. With
> some other servers you may get a single pixel output by using WCS slicing
> (subset=Long(-100)=Lat(22)) or trimming with lowerlimit=upperlimit
> (subset=Long(-100,-100)=Lat(22,22)) but Mapserver does not support
> either. See https://osgeo-org.atlassian.net/browse/GEOS-9553.
>
>
>
> I could not find a link to an answer by Stefan Meissl

Re: [mapserver-users] Point query from Mapserver raster

2021-11-02 Thread Rahkonen Jukka (MML)
Hi,

(Had to clip some text from the bottom because of the size limit of this list)

You do not seem to do anything wrong. Your WMS 1.3.0 EPSG:4326 lat-long 
BBOX=42.94,-122.09,42.95,-122.08& gets converted into long-lat order and for 
some reason the lower and higher values are equal 
{-122.082500,42.942500,-122.082500,42.942500}, thus this is no more a box but a 
point.
GetFeatureInfo with a small bbox and width=2 and height=2 is a trick that is 
certainly not heavily tested because the corresponding GetMap is pretty odd 
despite being valid.  Maybe using slightly bigger BBOX makes Mapserver to query 
the backend raster with a rectangle instead of a point.
BTW X=1 and Y=1 are not valid in WMS 1.3.0, you are supposed to use i= and j= 
instead. That makes me think that maybe you could have a try with a full and 
valid WMS 1.1.0 GetFeatureInfo request with SRS= and BBOX in long-lat order and 
see if it has any effect on the msProjectRect()

-Jukka Rahkonen-

Lähettäjä: MapServer-users 
mailto:mapserver-users-boun...@lists.osgeo.org>>
 Puolesta Carl Godkin
Lähetetty: tiistai 2. marraskuuta 2021 17.06
Vastaanottaja: 
mapserver-users@lists.osgeo.org<mailto:mapserver-users@lists.osgeo.org>
Aihe: Re: [mapserver-users] Point query from Mapserver raster

Hi,

Following Jukka's advice on my elevation point query, I am trying to use WMS 
GetFeatureInfo,

I've mostly got it working but have a few more questions.  (I am using MS4W 
4.0.5 which includes MapServer 7.7.0)

I added a LAYER to my WMS map file:

  LAYER
PROCESSING "RESAMPLE=BILINEAR"
NAME SRTM_3_arc-second_grid
METADATA
  "wms_title"   "SRTM - 3 arc-second grid"
  "ows_extent"  "-125 24 -66 50"
  "wms_include_items"   "all"
END

TYPE RASTER
STATUS ON
TILEINDEX "srtm_3_hgt-index.shp"
TILEITEM "Location"
TEMPLATE "../template.html"
PROJECTION
  "init=epsg:4326"
END
  END

and an empty template except for the



line.  Here's my query:

http://localhost:8080/wms?
  SERVICE=WMS&
  VERSION=1.3.0&
  REQUEST=GetFeatureInfo&
  LAYERS=SRTM_3_arc-second_grid&
  CRS=EPSG:4326&
  BBOX=42.94,-122.09,42.95,-122.08&
  WIDTH=2&
  HEIGHT=2&
  X=1&
  Y=1&
  QUERY_LAYERS=SRTM_3_arc-second_grid

This works fine and returns the elevation I am expecting.  However, the 
MapServer log complains about a "degenerate rect" every time:

[Tue Nov  2 07:58:44 2021].66000 msProjectRect(): Warning: degenerate rect 
{-122.082500,42.942500,-122.082500,42.942500}

What am I doing wrong here?   As I posted originally, I am really only 
interested in a point here.

Thank you very much,

carl

___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Point query from Mapserver raster

2021-11-02 Thread Carl Godkin
Hi,

Following Jukka's advice on my elevation point query, I am trying to use
WMS GetFeatureInfo,

I've mostly got it working but have a few more questions.  (I am using MS4W
4.0.5 which includes MapServer 7.7.0)

I added a LAYER to my WMS map file:

  LAYER
PROCESSING "RESAMPLE=BILINEAR"
NAME SRTM_3_arc-second_grid
METADATA
  "wms_title"   "SRTM - 3 arc-second grid"
  "ows_extent"  "-125 24 -66 50"
  "wms_include_items"   "all"
END

TYPE RASTER
STATUS ON
TILEINDEX "srtm_3_hgt-index.shp"
TILEITEM "Location"
TEMPLATE "../template.html"
PROJECTION
  "init=epsg:4326"
END
  END

and an empty template except for the

line. Here's my query:

http://localhost:8080/wms? SERVICE=WMS& VERSION=1.3.0&
REQUEST=GetFeatureInfo& LAYERS=SRTM_3_arc-second_grid& CRS=EPSG:4326& BBOX=
42.94,-122.09,42.95,-122.08& WIDTH=2& HEIGHT=2& X=1& Y=1&
QUERY_LAYERS=SRTM_3_arc-second_grid
This works fine and returns the elevation I am expecting. However, the
MapServer log complains about a "degenerate rect" every time:

[Tue Nov  2 07:58:44 2021].66000 msProjectRect(): Warning: degenerate rect
{-122.082500,42.942500,-122.082500,42.942500}

What am I doing wrong here?   As I posted originally, I am really only
interested in a point here.

Thank you very much,

carl


On Mon, Nov 1, 2021 at 12:58 AM Rahkonen Jukka (MML) <
jukka.rahko...@maanmittauslaitos.fi> wrote:

> Hi,
>
>
>
> The WMS GetFeatureInfo should work and the answer in gis.stackexhange
> seems to contain all the details that you need for making it to work.
>
> With WCS what you did is probably the best you can do with Mapserver. With
> some other servers you may get a single pixel output by using WCS slicing
> (subset=Long(-100)=Lat(22)) or trimming with lowerlimit=upperlimit
> (subset=Long(-100,-100)=Lat(22,22)) but Mapserver does not support
> either. See https://osgeo-org.atlassian.net/browse/GEOS-9553.
>
>
>
> I could not find a link to an answer by Stefan Meissl about why Mapserver
> does not support slicing but it was about dimensions. A raster image can be
> considered to be two dimensional even when it has only one pixel, but by
> the WCS standard each trim is removing one dimension. Slicing DEM with two
> axes must return a zero dimensional result and raster formats do not
> support that. I still think that subsets with lower=upper limits should
> works and return a single pixel output but that does not work with either
> Mapserver or Geoserver. See also
> https://www.mail-archive.com/search?l=mapserver-users%40lists.osgeo.org=subject:%22%5C%5Bmapserver%5C-users%5C%5D+WCS+GetCoverage+request+one++by+one+pixel%22=newest=1
>
>
>
>
>
> -Jukka Rahkonen-
>
>
>
>
>
> *Lähettäjä:* MapServer-users  
> *Puolesta
> *Carl Godkin
> *Lähetetty:* lauantai 30. lokakuuta 2021 2.10
> *Vastaanottaja:* mapserver-users@lists.osgeo.org
> *Aihe:* [mapserver-users] Point query from Mapserver raster
>
>
>
> Hi,
>
> Now that I have my WMS and WCS servers working well (thanks, list!!), I
> have one more thing I would like to figure out how to do.
>
>
>
> I want to do point queries on [Lat,Lon] points for their elevation from
> the terrain layer I have.
>
>
>
> I have done some searching and come across various ideas such as Raster
> Query (https://mapserver.org/input/raster.html#raster-query) and a query
> template  (
> https://gis.stackexchange.com/questions/167239/mapserver-raster-picking-elevation-data)
> but haven't found enough information for either to implement it.
>
>
>
> I came up with a solution that works fine, but might be considered as
> going "All Around the Barn"   What works is to add an ASCII output format
> to my map file that serves terrain like this:
>
>
>
> OUTPUTFORMAT
>
>   NAME XYZ
>
>   DRIVER "GDAL/XYZ"
>
>   MIMETYPE "text/plain"
>
>   IMAGEMODE FLOAT32
>
>   EXTENSION "txt"
>
> END
>
>
>
> and then use GetCoverage on a small rectangle whose lower-left corner
>
> is the point whose elevation I want:
>
>
>
>
> http://localhost:8080/wcs?SERVICE=WCS=2.0.1=GetCoverage=SRTM_3_arc-second_grid=XYZ=Lat(42.948,42.958)=Lon(-122.086,-122.076)
>
>
>
> and then take the first line of the returned output file.
>
>
>
> What would Mapserver best practice be for a problem like this?
>
>
>
> Thanks very much,
>
>
>
> carl
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Point query from Mapserver raster

2021-11-01 Thread Carl Godkin
Hi Jukka,

Thank you for  your reply.  I will play around with WMS + GetFeatureInfo
and see if I can make that work.

I'm still pretty new to this stuff and WCS seemed the more natural service
for this.

Thanks,

carl


On Mon, Nov 1, 2021 at 12:58 AM Rahkonen Jukka (MML) <
jukka.rahko...@maanmittauslaitos.fi> wrote:

> Hi,
>
>
>
> The WMS GetFeatureInfo should work and the answer in gis.stackexhange
> seems to contain all the details that you need for making it to work.
>
> With WCS what you did is probably the best you can do with Mapserver. With
> some other servers you may get a single pixel output by using WCS slicing
> (subset=Long(-100)=Lat(22)) or trimming with lowerlimit=upperlimit
> (subset=Long(-100,-100)=Lat(22,22)) but Mapserver does not support
> either. See https://osgeo-org.atlassian.net/browse/GEOS-9553.
>
>
>
> I could not find a link to an answer by Stefan Meissl about why Mapserver
> does not support slicing but it was about dimensions. A raster image can be
> considered to be two dimensional even when it has only one pixel, but by
> the WCS standard each trim is removing one dimension. Slicing DEM with two
> axes must return a zero dimensional result and raster formats do not
> support that. I still think that subsets with lower=upper limits should
> works and return a single pixel output but that does not work with either
> Mapserver or Geoserver. See also
> https://www.mail-archive.com/search?l=mapserver-users%40lists.osgeo.org=subject:%22%5C%5Bmapserver%5C-users%5C%5D+WCS+GetCoverage+request+one++by+one+pixel%22=newest=1
>
>
>
>
>
> -Jukka Rahkonen-
>
>
>
>
>
> *Lähettäjä:* MapServer-users  
> *Puolesta
> *Carl Godkin
> *Lähetetty:* lauantai 30. lokakuuta 2021 2.10
> *Vastaanottaja:* mapserver-users@lists.osgeo.org
> *Aihe:* [mapserver-users] Point query from Mapserver raster
>
>
>
> Hi,
>
> Now that I have my WMS and WCS servers working well (thanks, list!!), I
> have one more thing I would like to figure out how to do.
>
>
>
> I want to do point queries on [Lat,Lon] points for their elevation from
> the terrain layer I have.
>
>
>
> I have done some searching and come across various ideas such as Raster
> Query (https://mapserver.org/input/raster.html#raster-query) and a query
> template  (
> https://gis.stackexchange.com/questions/167239/mapserver-raster-picking-elevation-data)
> but haven't found enough information for either to implement it.
>
>
>
> I came up with a solution that works fine, but might be considered as
> going "All Around the Barn"   What works is to add an ASCII output format
> to my map file that serves terrain like this:
>
>
>
> OUTPUTFORMAT
>
>   NAME XYZ
>
>   DRIVER "GDAL/XYZ"
>
>   MIMETYPE "text/plain"
>
>   IMAGEMODE FLOAT32
>
>   EXTENSION "txt"
>
> END
>
>
>
> and then use GetCoverage on a small rectangle whose lower-left corner
>
> is the point whose elevation I want:
>
>
>
>
> http://localhost:8080/wcs?SERVICE=WCS=2.0.1=GetCoverage=SRTM_3_arc-second_grid=XYZ=Lat(42.948,42.958)=Lon(-122.086,-122.076)
>
>
>
> and then take the first line of the returned output file.
>
>
>
> What would Mapserver best practice be for a problem like this?
>
>
>
> Thanks very much,
>
>
>
> carl
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Point query from Mapserver raster

2021-11-01 Thread Rahkonen Jukka (MML)
Hi,

The WMS GetFeatureInfo should work and the answer in gis.stackexhange seems to 
contain all the details that you need for making it to work.
With WCS what you did is probably the best you can do with Mapserver. With some 
other servers you may get a single pixel output by using WCS slicing 
(subset=Long(-100)=Lat(22)) or trimming with lowerlimit=upperlimit 
(subset=Long(-100,-100)=Lat(22,22)) but Mapserver does not support 
either. See https://osgeo-org.atlassian.net/browse/GEOS-9553.

I could not find a link to an answer by Stefan Meissl about why Mapserver does 
not support slicing but it was about dimensions. A raster image can be 
considered to be two dimensional even when it has only one pixel, but by the 
WCS standard each trim is removing one dimension. Slicing DEM with two axes 
must return a zero dimensional result and raster formats do not support that. I 
still think that subsets with lower=upper limits should works and return a 
single pixel output but that does not work with either Mapserver or Geoserver. 
See also 
https://www.mail-archive.com/search?l=mapserver-users%40lists.osgeo.org=subject:%22%5C%5Bmapserver%5C-users%5C%5D+WCS+GetCoverage+request+one++by+one+pixel%22=newest=1


-Jukka Rahkonen-


Lähettäjä: MapServer-users  Puolesta 
Carl Godkin
Lähetetty: lauantai 30. lokakuuta 2021 2.10
Vastaanottaja: mapserver-users@lists.osgeo.org
Aihe: [mapserver-users] Point query from Mapserver raster

Hi,
Now that I have my WMS and WCS servers working well (thanks, list!!), I have 
one more thing I would like to figure out how to do.

I want to do point queries on [Lat,Lon] points for their elevation from the 
terrain layer I have.

I have done some searching and come across various ideas such as Raster Query 
(https://mapserver.org/input/raster.html#raster-query) and a query template  
(https://gis.stackexchange.com/questions/167239/mapserver-raster-picking-elevation-data)
 but haven't found enough information for either to implement it.

I came up with a solution that works fine, but might be considered as going 
"All Around the Barn"   What works is to add an ASCII output format to my map 
file that serves terrain like this:

OUTPUTFORMAT
  NAME XYZ
  DRIVER "GDAL/XYZ"
  MIMETYPE "text/plain"
  IMAGEMODE FLOAT32
  EXTENSION "txt"
END

and then use GetCoverage on a small rectangle whose lower-left corner
is the point whose elevation I want:

http://localhost:8080/wcs?SERVICE=WCS=2.0.1=GetCoverage=SRTM_3_arc-second_grid=XYZ=Lat(42.948,42.958)=Lon(-122.086,-122.076)

and then take the first line of the returned output file.

What would Mapserver best practice be for a problem like this?

Thanks very much,

carl








___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Point query from Mapserver raster

2021-10-29 Thread Scott
If you're using postgres/postgis it's easy using the raster version of 
st_intersection. It returns lat/lon/value or more precisely 
geometry/value. See more here:


https://postgis.net/docs/RT_ST_Intersection.html

Then it's just WFS.


On 10/29/21 4:09 PM, Carl Godkin wrote:

Hi,
Now that I have my WMS and WCS servers working well (thanks, list!!), I 
have one more thing I would like to figure out how to do.


I want to do point queries on [Lat,Lon] points for their elevation from 
the terrain layer I have.


I have done some searching and come across various ideas such as Raster 
Query (https://mapserver.org/input/raster.html#raster-query 
) and a query 
template  
(https://gis.stackexchange.com/questions/167239/mapserver-raster-picking-elevation-data 
) 
but haven't found enough information for either to implement it.


I came up with a solution that works fine, but might be considered as 
going "All Around the Barn"   What works is to add an ASCII output 
format to my map file that serves terrain like this:


OUTPUTFORMAT
NAME XYZ
DRIVER "GDAL/XYZ"
MIMETYPE "text/plain"
IMAGEMODE FLOAT32
EXTENSION "txt"
END

and then use GetCoverage on a small rectangle whose lower-left corner
is the point whose elevation I want:

http://localhost:8080/wcs?SERVICE=WCS=2.0.1=GetCoverage=SRTM_3_arc-second_grid=XYZ=Lat(42.948,42.958)=Lon(-122.086,-122.076) 



and then take the first line of the returned output file.

What would Mapserver best practice be for a problem like this?

Thanks very much,

carl









___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users