[gdal-dev] How I get a list of CRS supported for a WMS service with gdal?

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Mon Feb 15 06:08:45 PST 2021


Hi,

GDAL is not made to build a CRS list. See
https://gdal.org/drivers/raster/wms.html
"[CRS] Image projection (optional, defaults to EPSG:4326, WMS version 1.3.0
or above only)"

You can get the full list from GetCapabilities that you fetch by other means
and write one of the supported codes into CRS element. Then GDAL will use
that CRS in the GetMaps that it is sending. I believe that then also the
DataWindow must be edited to have numbers that match with the selected CRS
but I am not sure about that. You are lucky because the server you are
playing with seems to advertise bounding boxes also for the other CRSs.

GDAL is using the configured CRS when it sends GetMaps and reprojects image
data if needed into other CRS. If you configure GDAL to use the same CRS
that you want for the output you will avoid reprojection and the quality is
probably better.

-Jukka Rahkonen-




Elena Ruiz wrote
> Hello, when I run the next command:
> gdalinfo
> "WMS:http://wms.mapa.es/wms/wms.aspx?service=WMS&request=GetCapabilities"
> 
> the request is:
> 
> Driver: WMS/OGC Web Map Service
> Files: none associated
> Size is 512, 512
> Subdatasets:
>  
> SUBDATASET_1_NAME=WMS:http://wms.mapama.gob.es/wms/wms.aspx?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetMap&LAYERS=ARBOLES&SRS=EPSG:4326&BBOX=-18.1705,27.6374,4.3169,43.7722
>   SUBDATASET_1_DESC=Arboles
>  
> SUBDATASET_2_NAME=WMS:http://wms.mapama.gob.es/wms/wms.aspx?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetMap&LAYERS=RECINTO&SRS=EPSG:4326&BBOX=-18.1705,27.6374,4.3169,43.7722
>   SUBDATASET_2_DESC=Recintos
>  
> SUBDATASET_3_NAME=WMS:http://wms.mapama.gob.es/wms/wms.aspx?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetMap&LAYERS=PARCELA&SRS=EPSG:4326&BBOX=-18.1705,27.6374,4.3169,43.7722
>   SUBDATASET_3_DESC=Parcelas
>  
> SUBDATASET_4_NAME=WMS:http://wms.mapama.gob.es/wms/wms.aspx?SERVICE=WMS&VERSION=1.1.0&REQUEST=GetMap&LAYERS=ORTOFOTOS&SRS=EPSG:4326&BBOX=-18.1705,27.6374,4.3169,43.7722&TRANSPARENT=FALSE
>   SUBDATASET_4_DESC=Ortofotos
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,  512.0)
> Upper Right (  512.0,    0.0)
> Lower Right (  512.0,  512.0)
> Center      (  256.0,  256.0)
> 
> But if you put
> http://wms.mapa.es/wms/wms.aspx?service=WMS&request=GetCapabilities, in a
> explorer the request is:
> ...
> <Title>
> Sigpac
> </Title>
> <CRS>
> EPSG:4326
> </CRS>
> <CRS>
> EPSG:4258
> </CRS>
> <CRS>
> EPSG:32627
> </CRS>
> <CRS>
> EPSG:32628
> </CRS>
> <CRS>
> EPSG:32629
> </CRS>
> <CRS>
> EPSG:32630
> </CRS>
> <CRS>
> EPSG:32631
> </CRS>
> <CRS>
> EPSG:25827
> </CRS>
> <CRS>
> EPSG:25828
> </CRS>
> <CRS>
> EPSG:25829
> </CRS>
> <CRS>
> EPSG:25830
> </CRS>
> <CRS>
> EPSG:25831
> </CRS>
> <CRS>
> EPSG:3857
> </CRS>
> <EX_GeographicBoundingBox>
> <westBoundLongitude>
> -22.729594
> </westBoundLongitude>
> <eastBoundLongitude>
> 5.836872
> </eastBoundLongitude>
> <southBoundLatitude>
> 25.912170
> </southBoundLatitude>
> <northBoundLatitude>
> 45.945160
> </northBoundLatitude>
> </EX_GeographicBoundingBox>
> <BoundingBox CRS="EPSG:4326" minx="-18.1705" miny="27.6374" maxx="4.3169"
> maxy="43.7722"/>
> <BoundingBox CRS="EPSG:4258" minx="-18.1621" miny="21.8992" maxx="6.2892"
> maxy="45.2862"/>
> <BoundingBox CRS="EPSG:32627" minx="690000" miny="3000000" maxx="2780000"
> maxy="5000000"/>
> <BoundingBox CRS="EPSG:32628" minx="100000" miny="3000000" maxx="740000"
> maxy="3258000"/>
> <BoundingBox CRS="EPSG:32629" minx="396060.71" miny="4008012.13"
> maxx="849792.29" maxy="4847198.99"/>
> <BoundingBox CRS="EPSG:32630" minx="150207.79" miny="3902217.2"
> maxx="841149.7" maxy="4836742.49"/>
> <BoundingBox CRS="EPSG:32631" minx="158850.34" miny="4278426.36"
> maxx="692667.7" maxy="4747696.68"/>
> <BoundingBox CRS="EPSG:25827" minx="690000" miny="3000000" maxx="2780000"
> maxy="5000000"/>
> <BoundingBox CRS="EPSG:25828" minx="100000" miny="3000000" maxx="740000"
> maxy="3258000"/>
> <BoundingBox CRS="EPSG:25829" minx="396060.71" miny="4008012.13"
> maxx="849792.29" maxy="4847198.99"/>
> <BoundingBox CRS="EPSG:25830" minx="150207.79" miny="3902217.2"
> maxx="841149.7" maxy="4836742.49"/>
> <BoundingBox CRS="EPSG:25831" minx="158850.34" miny="4278426.36"
> maxx="692667.7" maxy="4747696.68"/>
> <BoundingBox CRS="EPSG:3857" minx="-2100000" miny="3000000" maxx="500000"
> maxy="5600000"/>
> ...
> Therefore, when I use GDAL only get the first CRS that this WMS service
> support, but in the web this service offers 13 differents CRS, How I get a
> list of the CRS of this service that really supports?
> 
> Thanks you, and regards
> 
> 
> ________________________________
> 
> [https://www.aplitop.com/descargas/firma1.jpg]
> 
> 
> Elena Ruiz
> Sofware Development & Technical Support
> Tel. +34 952 43 97 71

> eruiz@

> Sumatra, 9 - 29190 M?laga (Spain)
> www.aplitop.com
> 
> [cid:SocialLink_Facebook_32x32_a745adb8-c250-4372-8480-e77f503dad3d.png]<https://www.facebook.com/AplitopSL/>  
> [cid:SocialLink_Twitter_32x32_858247f6-9d4a-4740-a6b3-9b5ebfd98a97.png]
> <https://twitter.com/aplitop>   
> [cid:SocialLink_Linkedin_32x32_154d63de-bf68-468f-9eb0-ffed102fac77.png]
> <https://www.linkedin.com/company/aplitop>   
> [cid:SocialLink_Youtube_32x32_0dea15dd-3774-4086-be9d-f62560b70c86.png]
> <https://www.youtube.com/user/aplitop>
> 
> 
> In accordance with the provisions of the European Regulation of Data
> Protection 2016/679 (Reglamento Europeo de Protecci?n de Datos 2016/679),
> we inform you that the data and the information you provide us through
> this medium will be used by APLITOP, S.L., with C.I.F. B-92543396 and with
> address at C / Sumatra, 9, Malaga, 29190, in order to answer your
> questions and inform you about our products. The data provided will be
> kept as long as it does not request its cessation and will not be
> transferred to third parties except in cases where there is a legal
> obligation. You have the right to access your personal data, correct
> inaccurate data or request its deletion when the data is no longer
> necessary for the purposes that were collected, as well as any rights
> recognized in the RGPD 2016/679
> 
> <https://www.aplitop.com/Event/en/358/intergeo-2019>
> 
> 
> _______________________________________________
> gdal-dev mailing list

> gdal-dev at .osgeo

> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 
> SocialLink_Facebook_32x32_a745adb8-c250-4372-8480-e77f503dad3d.png (502
> bytes)
> <http://osgeo-org.1560.x6.nabble.com/attachment/5457355/0/SocialLink_Facebook_32x32_a745adb8-c250-4372-8480-e77f503dad3d.png>
> SocialLink_Twitter_32x32_858247f6-9d4a-4740-a6b3-9b5ebfd98a97.png (850
> bytes)
> <http://osgeo-org.1560.x6.nabble.com/attachment/5457355/1/SocialLink_Twitter_32x32_858247f6-9d4a-4740-a6b3-9b5ebfd98a97.png>
> SocialLink_Linkedin_32x32_154d63de-bf68-468f-9eb0-ffed102fac77.png (642
> bytes)
> <http://osgeo-org.1560.x6.nabble.com/attachment/5457355/2/SocialLink_Linkedin_32x32_154d63de-bf68-468f-9eb0-ffed102fac77.png>
> SocialLink_Youtube_32x32_0dea15dd-3774-4086-be9d-f62560b70c86.png (1K)
> <http://osgeo-org.1560.x6.nabble.com/attachment/5457355/3/SocialLink_Youtube_32x32_0dea15dd-3774-4086-be9d-f62560b70c86.png>





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list