Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RESX and RESY for WCS getCoverage #113

Closed
pmlefeuvre-met opened this issue Oct 31, 2023 · 7 comments
Closed

Add RESX and RESY for WCS getCoverage #113

pmlefeuvre-met opened this issue Oct 31, 2023 · 7 comments
Assignees
Milestone

Comments

@pmlefeuvre-met
Copy link

pmlefeuvre-met commented Oct 31, 2023

Hei @eblondel,

I am trying to download a WCS with getCoverage but the service I am trying to reach requires a RESX and RESY. How can I add &RESX=1&RESY=1 to my fetching URL.

Thanks for your help.

<ServiceExceptionReport version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengeospatial.net/wms/1.1.1/OGC-exception.xsd">
<ServiceException code="MissingParameterValue"> parameter WIDTH/RESX is required </ServiceException>
<ServiceException code="MissingParameterValue"> parameter HEIGHT/RESY is required </ServiceException>
<ServiceException code="InvalidParameterValue"> parameter RESX is invalid </ServiceException>
<ServiceException code="InvalidParameterValue"> parameter RESY is invalid </ServiceException>
</ServiceExceptionReport>
@eblondel
Copy link
Owner

Hi @pmlefeuvre-met can you share the WCS server you try to use? and the code you tried? thanks

@pmlefeuvre-met
Copy link
Author

pmlefeuvre-met commented Oct 31, 2023

Yes, ^^

  1. this url is from the provider and delivers a geotiff file
https://wcs.geonorge.no/skwms1/wcs.hoyde-dom-nhm-25833?SERVICE=WCS&REQUEST=GetCoverage&VERSION=1.0.0&COVERAGE=nhm_dom_topo_25833&CRS=EPSG:25833&BBOX=260500,6652500,261500,6653000&RESX=1&RESY=1&FORMAT=GEOTIFF
  1. this one is produced by ows4R (without &RESX=1&RESY=1) and produces the XML error message copied above
https://wcs.geonorge.no/skwms1/wcs.hoyde-dom-nhm-25833?service=WCS&version=1.0.0&coverage=nhm_dom_topo_25833&BBOX=260500,6652500,261500,6653000&CRS=EPSG:25833&format=GeoTIFF&request=GetCoverage 

The R code

WCS <- WCSClient$new("https://wcs.geonorge.no/skwms1/wcs.hoyde-dom-nhm-25833", "1.0.0", logger = "INFO")
caps <- WCS$getCapabilities()
name <- "nhm_dom_topo_25833"
chla <- caps$findCoverageSummaryById(name, exact = T)
cov_data <- chla$getCoverage(crs = "EPSG:25833",gridbaseCRS = "EPSG:25833",
                             bbox=OWSUtils$toBBOX(260500,261500,6652500,6653000),
                             filename = "dom_25833_1.tif")

@eblondel
Copy link
Owner

First thing I see is that your WCS server implements up to WCS 2.0.1. I would recommend to start using this service version, since WCS 1.0 is quite old and one cons was this need to specify these extra parameters. In ows4R, so far i tested the WCS 1.0.0 against Thredds data servers. Do you know which WCS server software is used behind https://wcs.geonorge.no ? Mapserver?

Switchinng to WCS 2.0.1, I also get an issue, different, that i'm now investigating. The response provided by service gives a multipart/related content-type, which is not implemented in ows4R.
The behavior seems related to MapServer/MapServer#6551
Keep digging and let you know if I find a possible patch for ows4R

@eblondel
Copy link
Owner

Ok I now see that it uses ArcGIS WCS server. I will investigate there

@eblondel
Copy link
Owner

eblondel commented Oct 31, 2023

If you stick with WCS 1.0.0, you can always extend getCoverage adding more parameters. I had to fix a minor bug, so please reinstall from Github: remotes::install_github("eblondel/ows4R")

WCS <- WCSClient$new("https://wcs.geonorge.no/skwms1/wcs.hoyde-dom-nhm-25833", "1.0.0", logger = "INFO")
caps <- WCS$getCapabilities()
name <- "nhm_dom_topo_25833"
chla <- caps$findCoverageSummaryById(name, exact = T)
cov_data <- chla$getCoverage(crs = "EPSG:25833",gridbaseCRS = "EPSG:25833",
                             bbox=OWSUtils$toBBOX(260500,261500,6652500,6653000),
                             filename = "dom_25833_1.tif",
                             RESX = 1, RESY = 1)

This will allow to reproduce the GetCoverage you did manually.

This said, I will keep investigating about the above request made with WCS 2.0.1, and will use this WCS server for further tests.

Let me know

@pmlefeuvre-met
Copy link
Author

Thanks Emmanuel! I now uses your last solution that works perfectly for my use!
Thanks for your help!
Cheers,
PiM

@eblondel
Copy link
Owner

eblondel commented Nov 4, 2023

Great to hear @pmlefeuvre-met! thanks for your feedback

@eblondel eblondel self-assigned this Nov 4, 2023
eblondel added a commit that referenced this issue Nov 4, 2023
@eblondel eblondel added this to the 0.3 milestone Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants