Advanced WMS-C use

Introduction

Although the APIs handle the Geoportal's cache access, it might be necessary to get connected to it by another mean.

This clause does not cover the rights management aspect (GeoDRM}) for accessing the Geoportal's WMS-C.

Forging a WMS-C request

The Geoportal's cache is a pyramid of images for each covered territory whom resolutions can be found there. Each pyramid's level is made up by tiles of 256 by 256 pixels size. Each level point of origin is at (0, 0) expressed in the GEOPORTALxxx projection for large to small scales (xxx being the territory code, See API ad territories) or MILLER (for very small scales).

A WMS-C request is just a WMS request for which the bounding box parameter MUST be equal to a tile's extent within the pyramid. In addition, the request must add a TILED=true parameter.

How to retrieve a tile knowing a point expressed in geographical coordinates ?

The first step is to transform the geographical coordinates into the targetted SRS (GEOPORTALxxx for the large to small scales), MILLER (for the very small scales). One can use the cs2cs software from PROJ.4 or the Geoportal API that is built upon a port of PROJ.4, PROJ4JS. The source code of these libraries gives the needed algorithms for these projections, and, therefore, can be used with any other programming language.

The initial coordinates are, for instance : 2°28'44.1", 48°48'20.3" in sexagecimal degrees, which is 2.478917, 48.805639 in decimal degrees.

The IGNF:GEOPORTALFXX coordinates are (189952.67, 5433018.88) :

$ cs2cs -f "%.2f" +init=epsg:4326 +to +init=IGNF:GEOPORTALFXX
2.478917    48.805639
189952.67   5433018.88 -0.00

The IGNF:MILLER coordinates are (275951.78, 5910061.78) :

$ cs2cs -f "%.2f" +init=epsg:4326 +to +init=IGNF:MILLER
2.478917    48.805639
275951.78   5910061.78 0.00
Simplified formulas

If installing PROJ.4 is not possible, one can use the following simplified formula for the GEOPORTALxxx projection (lon being the longitude expressed in radians, lat being the latitude expressed in radians) :

X= Kx * lon
Y= Ky * lat

Knowing that the parameters Kx, Ky depend upon the chosen territory, one can use the values below :

Territory codeKxKy
ANF6160807.25190996378137.0000000
ASP5026040.54397696378137.0000000
CRZ4430626.25498426378137.0000000
FXX4390419.78835166378137.0000000
GUF6362600.17883206378137.0000000
KER4142268.62663256378137.0000000
MYT6238759.40370156378137.0000000
NCL5913705.64861506378137.0000000
PYF6160807.25190996378137.0000000
REU5954503.86071766378137.0000000
SPM4349878.97425396378137.0000000
WLF6188679.07270286378137.0000000

In the MILLER projection case, the formula is as follows (lon being the longitude expressed in radians, lat being the latitude expressed in radians) :

X= 6378137.0000000 * lon
Y= 6378137.0000000 * log(tan(pi/4 + lat * .4)) * 1.25

The special case of TERA50STEREO is handled through to following formulas (lon being the longitude expressed in radians, lat being the latitude expressed in radians) :

X'= 1.9140939076700438*tan( 0.5*(pi/2 - lat) )/( ( (1.0+0.08199188997902919*sin(lat)) / (1.0-0.08199188997902919*sin(lat)) )^0.040995944989514595 )

X= (X' * sin(lon-2.443460952792061))*6378388.0 + 300000.0
Y= (X' * cos(lon-2.443460952792061))*6378388.0 - 2299363.482
Computation of the extent (lower left and upper right corners) :

In order to find out the tile containing this point at 1:2000 scale (1 pixel is worth 50 m x 50 m), one has to compute the lower left corner of the tile, knowing that a tile is 256 x 256 pixels :

  1. 256 x 0.5 = 128 meters width/height for the tile at the targetted resolution ;
  2. the 189952.67 abscissa gives us the total number of tiles from the origin of the tiles grid (0): 189952.67/128 = 1484.0052344 ;
  3. the integral part is then : 1484 ;
  4. which is 1484 x 128 = 189952 meters ;
  5. the 5433018.88 ordinate gives us the total number of tiles from the origin of the tiles grid (0): 5433018.88/128 = 42445.4600000 ;
  6. the integral part is then : 42445 ;
  7. which is 42445 x 128 = 5432960 meters ;
  8. the lower left corner coordinates are then : (189952, 5432960) ;
  9. one just needs to add the width and height of a tile in meters to get the upper right corner coordinates : 189952 + 128 = 190080, 5432960 + 128 = 5433088.

The extent of the searched tile at 0.50 m resolution est then :

(189952, 5432960), (190080, 5433088)

The same process applies for the world resolution (1 : 156 543 000 scale) :

  1. 256 x 39135.75 = 10018752
  2. abscissa : 275951.78/10018752 = 0.02754353, then 0 ;
  3. ordinate : 5910061.78/10018752 = 0.5899000, then 0 ;
  4. lower left corner : 0 + 10018752
  5. upper right corner : 0 + 10018752

finally, the extent is :

(0, 0), (10018752, 10018752)

What are the available layers for the Geoportal WMS-C (LAYERS parameter) ?

They are defined there.

Examples of WMS-C requests for getting tiles covering the (2°28'44.1", 48°48'20.3") location :

  • At Road level, zoom 17 (1 pixel equals 0.50 m x 0.50 m) for aerial photographies layer :
    http://wxs.ign.fr/geoportail/wmsc?LAYERS=ORTHOIMAGERY.ORTHOPHOTOS&
      EXCEPTIONS=text/xml&FORMAT=image/jpeg&
      SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&
      SRS=IGNF:GEOPORTALFXX&BBOX=189952,5432960,190080,5433088&
      WIDTH=256&HEIGHT=256&TILED=true&
  • At world level, zoom 0 (1 pixel equals 39135.75m x 39135.75m) for maps layer :
    http://wxs.ign.fr/geoportail/wmsc?LAYERS=GEOGRAPHICALGRIDSYSTEMS.MAPS&
      EXCEPTIONS=text/xml&FORMAT=image/jpeg&
      SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&
      SRS=IGNF:MILLER&BBOX=0,0,10018752,10018752&
      WIDTH=256&HEIGHT=256&TILED=true&