[GRASS-SVN] r51379 - grass-addons/grass6/raster/r.in.ign

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 11 11:26:10 EDT 2012


Author: vincent
Date: 2012-04-11 08:26:10 -0700 (Wed, 11 Apr 2012)
New Revision: 51379

Modified:
   grass-addons/grass6/raster/r.in.ign/r.in.ign
   grass-addons/grass6/raster/r.in.ign/r.in.ign.html
Log:
fundamental modification of token handling

Modified: grass-addons/grass6/raster/r.in.ign/r.in.ign
===================================================================
--- grass-addons/grass6/raster/r.in.ign/r.in.ign	2012-04-11 14:34:58 UTC (rev 51378)
+++ grass-addons/grass6/raster/r.in.ign/r.in.ign	2012-04-11 15:26:10 UTC (rev 51379)
@@ -30,6 +30,13 @@
 #%end
 
 #%option
+#% key:apikey
+#% type: string
+#% description: personal apiKey
+#% required : yes
+#%end
+
+#%option
 #% key: output
 #% type: string
 #% gisprompt: new,cell,raster
@@ -107,6 +114,10 @@
 	if [ -d "$GIS_MAP_PATH/.tmp/inspire" ]; then
 		rm -r "$GIS_MAP_PATH"/.tmp/inspire/
 	fi
+	# release token if exists
+	if [ "$token" ]; then
+		wget -q "http://jeton-api.ign.fr/releaseToken?gppkey=$token" -O -
+	fi
 }
 
 Cleanexit()
@@ -155,6 +166,12 @@
 #---------------------------------------------
 
 #---------------------------------------------	
+# requesting a token for the user's personal apiKey 
+token=`wget -q "http://jeton-api.ign.fr/getToken?key=${GIS_OPT_APIKEY}&output=raw" -O -`
+
+#---------------------------------------------	
+
+#---------------------------------------------	
 # loop downloading tiles
 for i in `seq 0 "$iterx"`; do
 	xk1=$(( xi + i * pas ))
@@ -163,7 +180,8 @@
 		xk2=$(( xk1 + pas ))
 		yk2=$(( yk1 + pas ))
 		# in the next request, LAYERS parameter is set to orthoimagery. Should be adjustable in a future release
-		wget "http://127.0.0.1:10001/wmsc?LAYERS=ORTHOIMAGERY.ORTHOPHOTOS&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=IGNF:GEOPORTALFXX&BBOX=$xk1,$yk1,$xk2,$yk2&WIDTH=256&HEIGHT=256&TILED=true" -O "$GIS_MAP_PATH"/.tmp/inspire/insp"$i$j".jpg
+		#wget "http://127.0.0.1:10001/wmsc?LAYERS=ORTHOIMAGERY.ORTHOPHOTOS&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=IGNF:GEOPORTALFXX&BBOX=$xk1,$yk1,$xk2,$yk2&WIDTH=256&HEIGHT=256&TILED=true" -O "$GIS_MAP_PATH"/.tmp/inspire/insp"$i$j".jpg
+		wget -q "http://wxs.ign.fr/inspire/wmsc?gppkey=$token&LAYERS=ORTHOIMAGERY.ORTHOPHOTOS&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=IGNF:GEOPORTALFXX&BBOX=$xk1,$yk1,$xk2,$yk2&WIDTH=256&HEIGHT=256&TILED=true" -O "$GIS_MAP_PATH"/.tmp/inspire/insp"$i$j".jpg
 		# georeferencing tile
 		gdal_translate -gcp 0 0 "$xk1" "$yk2" -gcp 256 256 "$xk2" "$yk1" -gcp 256 0 "$xk2" "$yk2" "$GIS_MAP_PATH"/.tmp/inspire/insp"$i$j".jpg "$GIS_MAP_PATH"/.tmp/inspire/insp"$i$j".tif
 		gcps2wld.py "$GIS_MAP_PATH"/.tmp/inspire/insp"$i$j".tif>"$GIS_MAP_PATH"/.tmp/inspire/insp$i$j.tfw

Modified: grass-addons/grass6/raster/r.in.ign/r.in.ign.html
===================================================================
--- grass-addons/grass6/raster/r.in.ign/r.in.ign.html	2012-04-11 14:34:58 UTC (rev 51378)
+++ grass-addons/grass6/raster/r.in.ign/r.in.ign.html	2012-04-11 15:26:10 UTC (rev 51379)
@@ -4,15 +4,15 @@
 
 <h2>NOTES</h2>
 <p><em>r.in.ign</em> lets you query a dataset via a contract. Beware the conditions that come with it and terms of use that apply to data.</p><p>It is yet a very rough module: right now it only works on the orthoimagery layer, at the finest scale (1/2000 i.e. resolution=0.5 m), and for data over french metropole only (i.e. data in GEOPORTALFXX coordinate system) -- all this being easily adaptable to one's personnal needs.</p><p>
-Connecting to the WMS-C streams of Géoportail is not straight, in cause a restricted access protected by a GeoDRM process. The module works behind a proxy configured with a personal apiKey that comes with your contract. See practical details concerning registration on the <a href="http://api.ign.fr/geoportail/api/doc/index.html">official website</A>.
+Connecting to the WMS-C streams of Géoportail is not straight, in cause a restricted access protected by a GeoDRM process. The module handles token request according to a personal apiKey that comes with your contract. See practical details concerning registration on the <a href="http://api.ign.fr/geoportail/api/doc/index.html">official website</A>.
 </p>
 
 
 <h2>EXAMPLE</h2>
 
-This command imports orthoimagery from IGN wms-c server to the raster map <em>orthoign</em>:
+This command imports orthoimagery from IGN wms-c server, with apiKey XXX, to the raster map <em>orthoign</em>:
 <p><tt> 
-r.in.ign -c output=orthoign
+r.in.ign -c apikey=XXX output=orthoign
 </tt></p>
 
 <h2>SEE ALSO</h2>
@@ -23,4 +23,4 @@
 
 Vincent Bain, Toraval, France
 
-<p><i>Last changed: $Date$</i>
\ No newline at end of file
+<p><i>Last changed: $Date: 2012-04-11$</i>
\ No newline at end of file



More information about the grass-commit mailing list