Hi all,

attached to this message is a simple perl script which queries a WMS server 
('GetCapabilities') and build a GDAL XML file.  You need to have perl and the 
modules HTTP::Lite, Getopt::Long and XML::Simple.  On debian/ubuntu, just say 
'sudo apt-get install perl-base libxml-simple-perl' to install the two latter 
packets.  For HTTP::Lite which is not (yet) part of the disto, say 'sudo perl 
-MCPAN -e shell' and enter 'install HTTP::Lite'.


Then just run the script without args to get a usage info.


To get a layers list, call the script with the arg '--base=<url>'.  Note: enter 
the URL *without* the terminating '?'.

Example: German Federal State Nordrhein-Westfalen 
(<http://www.geoserver.nrw.de/gbdaten.html>), DGK5:

  ./make-gdal-wms.pl --base=http://www.wms.nrw.de/geobasis/adv_dgk5

prints the list of available layers.


To create an XML file, specify the layer name, and the size of one pixel in m:

  ./make-gdal-wms.pl --base=http://www.wms.nrw.de/geobasis/adv_dgk5 
--layer=adv_dgk5 --size=0.5

creates an XML file which can be loaded in QLGT.


The script is *far* from perfect.  Here are some known issues:

- The script calls proj as to calculate the width and height of the map 
rectangle by converting the lat/lon corners to Gauss-Krüger coordinates.  
Sometimes, this failes, no idea why...  maybe someone who knows the details of 
how to actually call proj can help me to fix this (line 106/107).

- The calculated width x height, together with the pixel size, is used to 
calculate the size of the data window.  As to get a images with a proper aspect 
ratio, some WMS servers seem to need the same value for SizeX and SizeY, others 
need the 'real' rectangle.  I have no clue what I should set there.  Just edit 
the XML file and play with these values.  Again, and insight would be 
appreciated.

- The XML::Simple seems to have issues regarding the proper interpretation of 
utf8/iso-8859 characters.  If characters are missing in the output, pipe it 
through iconv (e.g. the example above through 'iconv -f latin1 -t utf8').  More 
a cosmetic issue...


Any comment, suggestion or improvement/patch will be appreciated!

Best,
Albrecht.

Attachment: make-gdal-wms.pl
Description: Perl program

Attachment: pgpX20TzQKJtp.pgp
Description: PGP signature

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Qlandkartegt-users mailing list
Qlandkartegt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qlandkartegt-users

Reply via email to