<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Charles/List,<br>
<br>
<blockquote
cite="mid:20170319114850.Horde.FJmIB6uJ4FiOzzMqdw3cnS2@c-geogrqca.aserv.co.za"
type="cite">
Hi list
<br>
<br>
I am in the process of teaching myself some python programming.
Now I need to move into real development of scripts for automation
which I hope to donate to Open Source initiatives if possible. If
anyone has ideas for repetitive tasks in any field please kindly
assist. Your intellectual contribution will be considered.
<br>
</blockquote>
<br>
Good for you.<br>
"Repetitive tasks" is not really something that everyone has a
finite list of, but rather ends up being pertinent to some of the
problems you may be dealing with at any moment.<br>
<br>
Also, there are many ways to skin a cat, so, List, feel free to flay
my thoughts or better still to add to them - but I think that as a
community let's take this opportunity to help someone get started,
and to also learn as a collective.<br>
<br>
A couple of thoughts:<br>
<ul>
<li>Python v2.7 or v3? <br>
Obviously, start with the newer - but be aware that some
products whose libraries you might want to use, might not yet be
available for v3.<br>
(GDAL? QGIS? - keep google as your closest friend)</li>
<li>Python.<br>
You mentioned "...donate to Open Source..."<br>
CPython is suggested in article at
<a class="moz-txt-link-freetext" href="http://docs.python-guide.org/en/latest/starting/which-python/">http://docs.python-guide.org/en/latest/starting/which-python/</a><br>
List: How definitive is above article?)</li>
<li>My gut feel (not knowledge or experience, but gut feel) is to
use Python as a glue to join together other library routines
(written in faster languages) rather than create complicated
numerical processing in python code. Whilst most of the things
you might use Python for will run faster than your fingers can
type, there will come a time when the relative speed of your
programme/process is more important than the absolute speed.<br>
So, why not start learning by being aware of the performance
implications of the code you are writing.<br>
</li>
</ul>
List: Chime in please - let's make this a community effort.<br>
<br>
So, to your (Charles's) query:<br>
As a kick-off, you might find that far too often when you start a
job/contract, you are given a pile of orthos, and told to "use
these" - only to later find out that (for example) they do not cover
your area of interest.<br>
So a useful routine might be to create something that will visually
show you the coverage of the orthos that may be in a folder.<br>
<br>
The cynical may say "Just load them into QGIS", but I say: "I've
just received a HD of 38526 orthos from NGI - I wonder which ones I
don't have?" :-) <br>
<br>
As a first exercise perhaps try this:<br>
<blockquote>pick a pile of orthos <u>that you know are on the same
CRS</u>, and write a python script that:<br>
</blockquote>
<ul>
<li>lists the folder(s) containing your orthos</li>
<li>Uses gdal python bindings to interrogate the ortho for its
geographic extents (and confirms the CRS)</li>
<li>Using these extents write a WKT file that creates a polygon
(box) with an attribute as the file-name of the ortho.</li>
</ul>
You can then read this WKT file with QGIS and visually see the
coverage of the ortho extents.<br>
<br>
I suggest staying in one CRS so that you don't have the extra hassle
of re-projecting your extents.<br>
<br>
Hope this helps,<br>
Kind regards,<br>
Zoltan<br>
PS: <br>
Yes, there are many other ways to achieve the goals of this example,
but this method will allow one to learn how to dive out of Python
into the OS to list a directory, link to external libraries, and
output a text file for input to another system.<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
===========================================
Zoltan Szecsei PrGISc [PGP0031]
Geograph (Pty) Ltd.
GIS and Photogrammetric Services
P.O. Box 7, Muizenberg 7950, South Africa.
Mobile: +27-83-6004028
Fax: +27-86-6115323 <a class="moz-txt-link-abbreviated" href="http://www.geograph.co.za">www.geograph.co.za</a>
===========================================</pre>
</body>
</html>