IGN wmts stream: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(Created page with "The french [http://api.ign.fr/services#sig IGN-API] service offers a WMTS (OGC-compliant) stream for GIS-oriented data diffusion. Connecting to this WMTS service requires a p...")
 
(changed pointer to IGN registration page)
 
Line 1: Line 1:
The french [http://api.ign.fr/services#sig IGN-API] service offers a WMTS (OGC-compliant) stream for GIS-oriented data diffusion.
The french [http://api.ign.fr/services#sig IGN-API] service offers a WMTS (OGC-compliant) stream for GIS-oriented data diffusion.


Connecting to this WMTS service requires a preliminary registration. See [http://api.ign.fr/ here] for more information.
Connecting to this WMTS service requires a preliminary registration. See [http://api.ign.fr/licences here] for more information on various licence types.
This AddOn was written as a '''transitory solution''' to fetch french data within GRASS 6.4 where [http://grass.osgeo.org/grass64/manuals/html64_user/r.in.wms.html r.in.wms] module fails. Note that this module was completely rewritten for GRASS 7.0 and now works with IGN web service, except at the present time it does not properly take into account french cartographic systems (nadgrid-based datum shifting). r.in.ign does, and works with GRASS 7.0 too.
This AddOn was written as a '''transitory solution''' to fetch french data within GRASS 6.4 where [http://grass.osgeo.org/grass64/manuals/html64_user/r.in.wms.html r.in.wms] module fails. Note that this module was completely rewritten for GRASS 7.0 and now works with IGN web service, except at the present time it does not properly take into account french cartographic systems (nadgrid-based datum shifting). r.in.ign does, and works with GRASS 7.0 too.


Line 18: Line 18:
*xmlstarlet for capabilities files analysis.
*xmlstarlet for capabilities files analysis.


Moreover, as a reminder, your system should properly handle french cartographic projections. There should be somewhere in you PROJ system directory (usually /usr/share/proj/ on GNU/Linux OS) :
Moreover, as a reminder, your system should properly handle french cartographic projections. There should be somewhere in you PROJ system directory (usually /usr/share/proj/ on GNU/Linux OS):
* the IGNF register, a text file called IGNF;
* the IGNF register, a text file called IGNF;
* the transformation grid called ntf_r93.gsb.
* the transformation grid called ntf_r93.gsb.
Line 25: Line 25:


== Setting up a server connection ==
== Setting up a server connection ==
First thing you need is an access to the server :
First thing you need is an access to the server:


* Create an [http://api.ign.fr/moncompte/creer account];
* Create an [http://professionnels.ign.fr/user/register account];
* And from your [http://api.ign.fr/moncompte/contract account page], you can create a new contract.
* When logged in, from [http://professionnels.ign.fr/api-sig this page] you can create a new contract choosing the free evaluation type ("Tester gratuitement l'API SIG"). IGN reminds you this type of contract should ''not'' be used for any professional purpose, but as a temporary development tool for your web sites or GIS applications.
* Next, you have to provide a login/password. Be cautious with special characters here: r.in.ign may not correctly handle them (unless using escape sequence)...
* Your contract is created after a while, then you can retrieve its apiKey in your orders recap.


From the pulling list named "Type de clé" (Key type), choose "Sig" (GIS). Be cautious with special characters within your Login and Password ; r.in.ign may not correctly handle them...
== Downloading the AddOn and running it ==
Download [https://svn.osgeo.org/grass/grass-addons/grass6/raster/r.in.ign r.in.ign], make sure the file is executable and located in a correct path directory (e.g. /usr/local/grass-addon).


You're done!


== Downloading the AddOn and running it ==
Retrieve [https://svn.osgeo.org/grass/grass-addons/grass6/raster/r.in.ign r.in.ign], make sure the file is executable and located in a correct path directory (e.g. /usr/local/grass-addon).
You're done !
Launch GRASS in your favorite location/mapset.
Launch GRASS in your favorite location/mapset.
Define the region of interest, ''caring for its extent and resolution'' : Whether the current resolution is coarse or fine r.in.ign will request different levels of the server's tilematrix set. First run the command with -c argument to check available layers according to the contract you subscribed:
Define the region of interest, ''caring for its extent and resolution'': Whether the current resolution is coarse or fine r.in.ign will request different levels of the server's tilematrix set. First run the command with -c argument to check available layers according to the contract you subscribed:


<code>
<code>
Line 61: Line 60:
*then reprojects the latter in the target projection system.
*then reprojects the latter in the target projection system.
*It finally runs r.in.gdal and optionnally r.composite.
*It finally runs r.in.gdal and optionnally r.composite.


[[Category:Tutorial]]
[[Category:Tutorial]]
[[Category:Languages/fr]]
[[Category:Languages/fr]]

Latest revision as of 07:49, 15 February 2013

The french IGN-API service offers a WMTS (OGC-compliant) stream for GIS-oriented data diffusion.

Connecting to this WMTS service requires a preliminary registration. See here for more information on various licence types. This AddOn was written as a transitory solution to fetch french data within GRASS 6.4 where r.in.wms module fails. Note that this module was completely rewritten for GRASS 7.0 and now works with IGN web service, except at the present time it does not properly take into account french cartographic systems (nadgrid-based datum shifting). r.in.ign does, and works with GRASS 7.0 too.

Here we expose a simple how-to, hoping it will help users importing raster layers within GRASS GIS. It is based on the use of the r.in.ign AddOn.

Warning

r.in.ign lets you query a dataset via a contract. Beware the conditions that come with it and terms of use that apply to data... It is a quite rough module, true, but all this can be easily adapted to one's personnal needs.

Dependencies

Previously should be installed on your system:

  • gdal-bin (GDALTools);
  • PROJ4 and its binary tools;
  • awk or gawk;
  • wget;
  • xmlstarlet for capabilities files analysis.

Moreover, as a reminder, your system should properly handle french cartographic projections. There should be somewhere in you PROJ system directory (usually /usr/share/proj/ on GNU/Linux OS):

  • the IGNF register, a text file called IGNF;
  • the transformation grid called ntf_r93.gsb.

Learn more here for a fine tuning of this aspect.


Setting up a server connection

First thing you need is an access to the server:

  • Create an account;
  • When logged in, from this page you can create a new contract choosing the free evaluation type ("Tester gratuitement l'API SIG"). IGN reminds you this type of contract should not be used for any professional purpose, but as a temporary development tool for your web sites or GIS applications.
  • Next, you have to provide a login/password. Be cautious with special characters here: r.in.ign may not correctly handle them (unless using escape sequence)...
  • Your contract is created after a while, then you can retrieve its apiKey in your orders recap.

Downloading the AddOn and running it

Download r.in.ign, make sure the file is executable and located in a correct path directory (e.g. /usr/local/grass-addon).

You're done!

Launch GRASS in your favorite location/mapset. Define the region of interest, caring for its extent and resolution: Whether the current resolution is coarse or fine r.in.ign will request different levels of the server's tilematrix set. First run the command with -c argument to check available layers according to the contract you subscribed:

r.in.ign -c apikey=YourPersonalApiKey user=YourLogin password=YourPassword

The -m flag in the next example allows to output 3 separate-band rasters rather than a composite RGB raster:

r.in.ign -m apikey=YourPersonalApiKey user=YourLogin password=YourPassword output=orthoign wmtslayer=ORTHOIMAGERY.ORTHOPHOTOS

How it works

r.in.ign performs the following operations:

  • detects the current location's projection system;
  • turns the region extent into pseudo-Mercator projection system coordinates (epsg:3857);
  • calculates the set of tiles to query (tilematrixset, rows & cols);
  • retrieves tiles from the server;
  • georeferences each tile;
  • merges them all into a single image;
  • then reprojects the latter in the target projection system.
  • It finally runs r.in.gdal and optionnally r.composite.