<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Scratching Surfaces &#187; Open Source</title>
	<atom:link href="http://www.surfaces.co.il/category/oss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.surfaces.co.il</link>
	<description>Open Source - GIS - Thoughts</description>
	<lastBuildDate>Wed, 22 May 2013 08:26:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Spatialite GUI on Enterprise Linux 6 systems</title>
		<link>http://www.surfaces.co.il/spatialite-gui-on-enterprise-linux-6-systems/</link>
		<comments>http://www.surfaces.co.il/spatialite-gui-on-enterprise-linux-6-systems/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 17:49:56 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Spatialite]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=1090</guid>
		<description><![CDATA[Continuing my last post on using the spatialite tools and software on EL 6 and clones, here&#8217;s how I got the spatialite_gui to work. The Spatialite collection of software includes the core library, libspatialite, a simple GIS viewer spatialite-gis and a GUI program for managing sqlite based spatial databases: spatialite_gui. The version 2.3.1 is called &#8220;stable&#8221;, [...]]]></description>
				<content:encoded><![CDATA[<p>Continuing my <a href="http://www.surfaces.co.il/?p=1053">last post</a> on using the spatialite tools and software on EL 6 and clones, here&#8217;s how I got the spatialite_gui to work.</p>
<p><span id="more-1090"></span>The Spatialite collection of software includes the core library, <strong>libspatialite</strong>, a simple GIS viewer <strong>spatialite-gis</strong> and a GUI program for managing sqlite based spatial databases: <strong>spatialite_gui</strong>. The version 2.3.1 is called &#8220;stable&#8221;, but 2.4.0 has been out for almost a year now, and 3.0 is already on the horizon. Here we&#8217;re looking at the 2.4.0 version There are binaries in the <a href="http://www.gaia-gis.it/spatialite-2.4.0-4/index.html">downloads</a> website, including for x86_64 systems, but I couldn&#8217;t get them to work since they are, it seems, built against newer versions of the geos and geotiff libraries than come packaged for Enterprise Linux. Keeping with the policy of installing as much as possible thru yum, and doing compiling only when necessary, we&#8217;ll leave the system geos and geotiff alone, and go for a homemade spatialite_gui. I downloaded the sources for three packages from the <a href="http://www.gaia-gis.it/spatialite-2.4.0-4/sources.html">spatialite 2.4.0 download page</a>: spatialite-tools, spatialite_gui and libgaiagraphics.</p>
<p>First comes the requisite libgaiagraphics. Unpack the tarball and drop into its directory. This library needs to find the geotiff header files, so you must have libgeotiff-devel installed through yum. In addition the geotiff  headers on Fedora and EL systems get put into a subdirectory  /usr/include/libgeotiff, so for the configure step to find these needed headers first create a CPPFLAGS environment variable then run the usual compile steps as:<br />
<code>export CPPFLAGS="-I/usr/include/libgeotiff"<br />
./configure<br />
make</code><br />
and as root do<br />
<code>make install</code></p>
<p>Next untar the spatialite_gui package and go into its directory. We&#8217;ll need sqlite headers for this step so be sure you have done yum install sqlite-devel. But here I found one glitch. It seems that the sqlite3 header file, /usr/include/sqlite3.h as installed on EL6 is lacking one #define statement that causes the compilation of spatialte_gui to fail. So as root, edit /usr/include/sqlite3.h and add<br />
<code>#define SQLITE_STMTSTATUS_AUTOINDEX 3</code><br />
after line 5272.<br />
Now you&#8217;re ready to do <code>./configure &amp;&amp; make</code><br />
And running <code> make install </code> as root will drop the new spatialite_gui binary into /usr/local/bin.</p>
<p>Finally open spatialite-tools and go thru the same three configure and compile steps. This worked without issues for me, leaving the suite of tools in /usr/local/bin. If you want an icon for a desktop or menu shortcut, it&#8217;ll be in your download directory under spatialite_gui-1.4.0/icons&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/spatialite-gui-on-enterprise-linux-6-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Get your GPS locations into Spatialite</title>
		<link>http://www.surfaces.co.il/get-your-gps-locations-into-spatialite/</link>
		<comments>http://www.surfaces.co.il/get-your-gps-locations-into-spatialite/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 19:37:51 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Spatialite]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=1053</guid>
		<description><![CDATA[Spatialite, built on the shoulders of the popular sqlite single-file database, offers a broad feature set of GIS analysis tools. Getting data into a spatialite database is a snap when you&#8217;re starting from a shapefile. But what about GPS data. Here&#8217;s a few tips on how to upload data from the standard &#8220;GPX&#8221; format into [...]]]></description>
				<content:encoded><![CDATA[<p>Spatialite, built on the shoulders of the popular sqlite single-file database, offers a broad feature set of GIS <a href="http://www.gaia-gis.it/spatialite-2.4.0-4/spatialite-cookbook/index.html">analysis tools</a>. Getting data into a spatialite database is a snap when you&#8217;re starting <a href="http://www.gaia-gis.it/spatialite-2.1/SpatiaLite-manual.html#t6a">from a shapefile</a>. But what about GPS data. Here&#8217;s a few tips on how to upload data from the standard &#8220;GPX&#8221; format into a spatialite DB.</p>
<p><span id="more-1053"></span>I&#8217;ll present three methods and point out the advantages and drawbacks of each. The first and second for those with &#8220;CLI phobia&#8221;, and the third &#8211; easier in my opinion &#8211; a command line option.</p>
<h4>The QGIS method</h4>
<p>We begin with a straightforward &#8220;copy &#8211; paste&#8221; process right in <a href="http://www.qgis.org/en/download/current-software.html">Quantum GIS</a>. You DO have QGIS installed already, I hope&#8230; First activate the GPS plugin in QGIS (this plugin should get installed automatically with QGIS), and click on the GPS icon to open the GPS Tools window. Go over to the &#8220;Load GPX File&#8221; tab, and browse to find your GPX file. Click &#8220;Open&#8221; and you&#8217;ll see the waypoints or tracks from your GPS on the QGIS canvas.</p>
<p>Now in the QGIS menu, choose &#8220;Layer&#8221;-&gt;&#8221;New&#8221;-&gt;&#8221;New Spatialite Layer&#8221;.  You&#8217;ll need to:</p>
<ul>
<li>Select the spatialite *.db file</li>
<li>Enter a name for the new layer</li>
<li>Be sure the SRID is set to 4326 (The Lon/Lat WGS84 based spatial reference system used by all GPS instruments)</li>
<li>Click to add an autoincrementing primary key</li>
<li>Add any other attribute columns you&#8217;ll need</li>
</ul>
<p>Then click OK to add the new layer into into the Spatialite DB, and into QGIS. Now comes the copy/paste dance: choose the GPX layer in the Table of Contents, and using the Select tool, select all of the features (so that they all appear yellow) and click the &#8220;Copy Features&#8221; button on the edit toolbar. Now Choose from the TOC the new empty spatialite layer, and click the &#8220;Toggle Editing&#8221; button to begin editing this new layer. And finally click the &#8220;Paste Features&#8221; button, again from the editing toolbar, to paste all the selected GPX features into the new spatialite table. Simple and elegant, but&#8230;</p>
<p>&#8230;if you open up the new layer&#8217;s attribute table you&#8217;ll see it&#8217;s emtpy.  &#8221;So what&#8221;, you might ask. Well every GPS captures, along with each point location, at least a waypoint name, and elevation. In the original GPX file these appear as XML elements. If this additional information is not important then the above method should be fine. But if you want to<em> keep the waypoint numbers and elevation</em>, you&#8217;ll need a better method.</p>
<h4>The intermediate CSV method</h4>
<p>For our second try, we need two GUI tools; the <a href="http://www.gaia-gis.it/spatialite-2.4.0-4/binaries.html">spatialite-gui</a> binary and <a href="http://www.gpsbabel.org/download.html">GPSbabel GUI</a>. GPSBabel is traditionally a command line program, but there&#8217;s a &#8220;Front End&#8221; for Windows users. This program reads and writes practically every GPS file format in use on the planet. The steps to importing a GPX file<strong> with attributes</strong> are as follows. Using GPSBabel we convert the original GPX to the &#8220;Universal CSV&#8221; format. Then in Spatialite we create a VirtualTable based on this file. And then, using an SQL insert within spatialite we transfer all the GPS locations to a permanent table, and finally create the requisite Geometry column for this new table. Here are the details:</p>
<p>The GPSBabel command to convert to Universal CSV format reads (assuming the original GPX file is waypoints.gpx):<br />
<code><br />
gpsbabel -w -i gpx -f waypoints.gpx  -o unicsv -F waypoints.csv<br />
</code><br />
Alternatively, Using the GPSBabel GUI should be intuitive, choose the input format as GPX (or whatever format you downloaded from your  GPS), and output format Universal CSV. Select the files and check waypoints or tracks, whichever is appropriate. Then run the conversion.</p>
<p>Now fire up spatialite-gui. On the button bar, locate and click the button &#8220;Virtual CSV/TXT&#8221;. Browse to your waypoints.csv from the previous step and click Open to select the file. In the next &#8220;Creating VIrtual CSV/TXT&#8221; window change the table name to something like  &#8221;waypoints_tmp&#8221;, be sure to <span style="text-decoration: underline;">select &#8220;Comma&#8221; as the Column Separator.</span> and click OK. You now have access to the CSV file from within spatialite. You can examine the table structure by right-clicking on it&#8217;s name and choosing &#8220;Show Columns&#8221;. The data is viewable by right-click and &#8220;Query table&#8221;.</p>
<p>It&#8217;s now time to create a new, permanent table for the waypoints. In the query window type the following:<br />
<code><br />
CREATE TABLE waypoints (</code></p>
<p style="padding-left: 30px;">long DOUBLE,<br />
lat DOUBLE,<br />
elev DOUBLE,<br />
wpt TEXT );</p>
<p>&nbsp;</p>
<p>At this point we want to insert all the rows from the GPX table &#8211; waypoints_tmp &#8211; into the new waypoints table. Here&#8217;s the required SQL.<br />
<code><br />
INSERT INTO waypoints (long, lat,elev, wpt)<br />
SELECT Longitude, Latitude, Altitude, Name FROM waypoints_tmp;<br />
</code><br />
That should leave us with a fully populated, permanent waypoints table. At this point a word of explanation is in order. Why was it necessary to leap-frog over that Virtual CSV/TXT? Why not just import the CSV table directly into a permanent Spatialite table? The reason lies with how numeric columns are recognized by the CSV/TXT importer. If numbers appear as negative values, i.e. preceded by a minus sign (latitudes south of the equator, longitudes west of Greenwich, or below sea level elevations like at the Dead Sea) then these numbers get <span style="text-decoration: underline;">imported as text</span>, and they are then useless for creating the Geometry column. When we hand crafted our permanent waypoints table as above, we set the long,lat,elev types to DOUBLE. Then, when inserting the values from the virtual table, the &#8220;text&#8221; with its minus sign got <strong>coerced</strong> into true numeric values.</p>
<p>We have yet one more step to complete. So far this new table is <strong>NOT</strong> a spatial table. The Longitude and Latitude values appear as attribute columns but we haven&#8217;t yet <a href="http://www.gaia-gis.it/spatialite-2.4.0-4/spatialite-cookbook/html/new-geom.html">added the necessary Geometry column</a>. Two more SQL statements complete the job:<br />
<code><br />
SELECT AddGeometryColumn('waypoints','Geometry',4326,'POINT',2);<br />
UPDATE waypoints SET Geometry=MakePoints(long.lat,4326);<br />
</code><br />
The first Spatialite function adds the additional Geometry column, the metadata and constraints, and the second command populates that column based on the longitude/latitude values. Now we have a spatial table with attribute values, imported from a GPS file.</p>
<p>Yet one additional method is available. For those tired of reading such a long post, don&#8217;t worry, this final one is short.</p>
<h4>The OGR command method</h4>
<p>The ubiquitous GDAL library includes a sometimes overlooked, but powerful tool for handling vector format conversions. It&#8217;s called <a href="http://www.gdal.org/ogr2ogr.html">ogr2ogr</a>. Since OGR can read and write both GPX formatted files and Spatialite database layers, we can concoct a one liner ogr2ogr command to push GPS locations from a GPX file directly into a Spatialite database layer, and <strong>including their attributes</strong>. SO, without further ado here it is:</p>
<p><code> ogr2ogr -append -f "SQLite" \</code></p>
<p style="padding-left: 30px;">-dsco SPATIALITE=yes -dsco INIT_WITH_EPSG=yes -t_srs epsg:4326 \<br />
spatial_data.db waypoints.gpx \<br />
-nln waypoints</p>
<p>Just a few words of explanation: -append allows you to add a table to an existing Spatialite database. Based on <a href="http://groups.google.com/group/spatialite-users/browse_thread/thread/e0b2bedc24f10947/df0acb9bd5968137?hl=en&amp;lnk=gst&amp;q=GDAL%2Fogr#df0acb9bd5968137">this</a> maillist thread, it seems that adding the -dsco (dataset creation options) and the target spatial reference system is a good idea. The -nln parameter is the new layer name &#8211; that is the new Spatialite table. Pay attention to the unusual order of the files on the command line: First is the destination database, and after the source (in this case) GPX file.</p>
<p>That&#8217;s it, the whole procedure distilled into one command. Now who still thinks the CLI is old fashioned or clunky?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/get-your-gps-locations-into-spatialite/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Clipping a raster with GDAL</title>
		<link>http://www.surfaces.co.il/clipping-a-raster-with-gdal/</link>
		<comments>http://www.surfaces.co.il/clipping-a-raster-with-gdal/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 19:50:32 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=1049</guid>
		<description><![CDATA[Tim Sutton&#8217;s  excellent post from last year gives a recipe for creating a professional looking color relief background map from elevation data, and using only GDAL tools. I&#8217;d like to suggest one additional procedure to his step-by-step guide.  One of the popular sources for freely available digital elevation data is NASA&#8217;s SRTM program. These DEM tiles are distributed [...]]]></description>
				<content:encoded><![CDATA[<p>Tim Sutton&#8217;s  <a href="http://linfiniti.com/2010/12/a-workflow-for-creating-beautiful-relief-shaded-dems-using-gdal/">excellent post</a> from last year gives a recipe for creating a professional looking color relief background map from elevation data, and using only <a href="http://www.gdal.org/">GDAL</a> tools. I&#8217;d like to suggest one additional procedure to his step-by-step guide.</p>
<p><span id="more-1049"></span> One of the popular sources for freely available digital elevation data is NASA&#8217;s <a href="http://srtm.csi.cgiar.org/">SRTM</a> program. These DEM tiles are distributed in GeoTiff format (among others) and each tile covers a 5 degree by 5 degree square. Often your area of interest will fall across several tiles. When you complete Tim&#8217;s process, including using a polygon &#8220;cutline&#8221;  your final color relief raster will show the country (or region) of interest with white space around the edges. In many cases this white space can be quite large, making the final tiff file much larger than is necessary. For example, I created a color relief of Burkina Faso. This African country extends from about 2 degrees W to about 6 degrees W. So I needed two SRTM tiles  to cover the E-W extent: one from 0 to 5 degrees W and another from 5-10 degrees W. Also in the N-S direction I needed two 5 degree tiles to cover the country. So I started with four SRTM DEM tiles covering an area about four times the size of the Burkina Faso. After running</p>
<pre>gdalwarp -cutline  ....</pre>
<p>I was left me with a raster hundreds of kilometers larger in each direction than the actual borders. To clip out only the extent I needed required one more application of a GDAL tool: <strong>gdal_translate</strong> with the<strong> -projwin</strong> option. This allowed me to define the upper left and lower right X-Y coordinates of a &#8220;window&#8221; to be clipped out of the original raster thus creating a new GeoTiff file, less than 1/2 the size of the original.</p>
<p>In my case, the invocation of gdal_translate was:</p>
<pre>gdal_translate -projwin -6 15.1 -2.5 8.5 bkf_relief.tif bkf_relief_clipped.tif</pre>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/clipping-a-raster-with-gdal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>GRASS 6.4.1 on Scientific Linux 6.0</title>
		<link>http://www.surfaces.co.il/grass-6-4-1-on-scientific-linux-6-0/</link>
		<comments>http://www.surfaces.co.il/grass-6-4-1-on-scientific-linux-6-0/#comments</comments>
		<pubDate>Sun, 15 May 2011 19:45:15 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[GRASS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=1016</guid>
		<description><![CDATA[The latest stable release of GRASS GIS is 6.4.1. Binaries are already available for several operating systems and distros, but not yet for RHEL 6 or its clones. With the legwork done by the folks at FedoraProject, we can prepare RPMs and install GRASS with little ado also on SL6 We begin, as usual, getting [...]]]></description>
				<content:encoded><![CDATA[<p>The latest stable release of GRASS GIS is 6.4.1. Binaries are <a href="http://grass.osgeo.org/download/software.php">already available</a> for several operating systems and distros, but not yet for RHEL 6 or its clones. With the legwork done by the folks at FedoraProject, we can prepare RPMs and install GRASS with little ado also on SL6</p>
<p><span id="more-1016"></span><br />
We begin, as usual, getting the basic tools for building, the python GUI software and the GIS stack of libraries. The best approach is to configure your system to use the EPEL repository. Here&#8217;s the list of required packages (run as root):</p>
<p><code> yum install geos proj proj-epsg gdal proj-devel geos-devel gdal-devel proj-nad<br />
yum install gcc gcc-c++ gcc-gfortran flex byacc ncurses-devel bison pkgconfig readline-devel blas-devel lapack-devel<br />
yum install wxPython wxPython-devel wxGTK wxGTK-devel swig python-psycopg2 numpy PyQt4 PyQt4-devel sip sip-devel<br />
yum install mesa-libGLU-devel libXmu-devel lesstif lesstif-devel libjpeg-devel<br />
yum install tcl tcl-devel tk tk-devel fftw2 fftw2-devel hdf5<br />
yum install unixODBC postgresql-devel mysql-devel sqlite-devel freetype-devel</code></p>
<p>One of the dependencies for building GRASS:<em> mesa-libGLw</em> and<em> mesa-libGLw-devel</em> is still missing from the Scientific Linux and EPEL repositories. But it&#8217;s available for Fedora, and the Fedora 13 binary seems to install fine. So download both of the above from the <a href="http://koji.fedoraproject.org/koji/buildinfo?buildID=221122">Fedora Project</a> website (be sure to choose the correct package for your architecture). and run<br />
<code>rpm -Uhv mesa-libGLw-*fc15*</code><br />
to get them installed.<br />
Now download the Fedora source rpm for GRASS from <a href="http://kojipkgs.fedoraproject.org/packages/grass/6.4.0/3.fc15/src/grass-6.4.0-3.fc15.src.rpm">here</a> for GRASS 6.4.0 . Yes it&#8217;s currently one minor version behind, but we&#8217;ll fix that presently&#8230;<br />
You can not just install the src rpm, since it&#8217;s configured for a different distro. But all we want it to extract the spec file and patches. Here&#8217;s a simple way to do that (<span style="text-decoration: underline;">no root privileges here</span>):<br />
<code>rpm2cpio grass-6.4.0-3.fc15.src.rpm | cpio -idmv</code><br />
This breaks open the rpm archive and extracts all its files.</p>
<p>OK, time to setup your rpm build environment (See the <a href="http://fedoraproject.org/wiki/PackageMaintainers/CreatingPackageHowTo">Fedora Project wiki</a> for details)<br />
<code>rpmdev-setuptree</code></p>
<p>From the Fedora source rpm that we unpacked a moment ago copy all the *.patch and the grasslogo_vector_small.png into the ~/rpmbuild/SOURCES directory. Also copy the grass.spec file into the ~/rpmbuild/SPECS directory. Next we <a href="http://grass.osgeo.org/grass64/source/grass-6.4.1.tar.gz">download</a> the grass source tarball <strong>for 6.4.1</strong>: Change into the rpmbuild SOURCES directory and get the source:<br />
<code>wget http://grass.osgeo.org/grass64/source/grass-6.4.1.tar.gz</code><br />
Now we must enter one last simple change to the spec file in order to build this latest version. Open ~/rpmbuild/SPECS/grass.spec with your favorite editor and alter the second line to read:<br />
<code>Version: 6.4.1</code><br />
instead of the original 6.4.0</p>
<p>Now we should be ready to roll. Change into the spec directory and issue:<br />
<code>rpmbuild -bb grass.spec</code><br />
Time for a beverage while the computer churns along. When it&#8217;s done, you should have, under the rpmbuild/RPMS directory three grass*.rpm files.<br />
At this point you need to get root privileges again for installing and:<br />
<code>rpm -Uhv rpmbuild/RPMS/grass*.rpm</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/grass-6-4-1-on-scientific-linux-6-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>DBF, Longevity and Logical data</title>
		<link>http://www.surfaces.co.il/dbf-longevity-and-logical-data/</link>
		<comments>http://www.surfaces.co.il/dbf-longevity-and-logical-data/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 20:44:29 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=918</guid>
		<description><![CDATA[The *.dbf single file database format, AKA dBase has been with us now for over 30 years. During this period software giants such as DEC (Digital Equipment Corporation) and Aston Tate have risen and fallen, but the lowly dBase format is still hanging on. What gives this standard its tenacity? And how should we deal [...]]]></description>
				<content:encoded><![CDATA[<p>The *.dbf single file database format, AKA dBase has been with us now for over 30 years. During this period software giants such as DEC (Digital Equipment Corporation) and Aston Tate have risen and fallen, but the lowly dBase format is still hanging on. What gives this standard its tenacity? And how should we deal with DBF files today?</p>
<p><span id="more-918"></span></p>
<p>Since ESRI released the &#8220;shapefile&#8221; geographic data format in the early 1990&#8242;s, using a *.dbf file to hold the geographic feature attributes, the DBF format cemented a grip on a whole new field of computer use. But this was only one late example of successfully applying a simple data storage tool to a much wider scope. Earlier Microsoft&#8217;s Foxpro offered a database application development environment around dbf. And they were preceded by others.</p>
<p>Now, dbf is not without its own quirks and shortcomings:</p>
<ul>
<li>lack of some data types</li>
<li>limited characters in column headers</li>
<li>many SQL functions are not supported</li>
<li>not scalable to large datasets</li>
</ul>
<p>Today the more feature-rich <strong>sqlite</strong> is fast overtaking dbf in many computer applications, and its spatially enabled cousin <strong>spatiallite</strong> from <a href="http://www.gaia-gis.it/spatialite/"> here </a>may well push the ubiqutous shapefile off of its position as industry standard. So how has this irksome DBF stuck around for so long? Those of us who use open source software, and recognize the advantages of open standards are not surprised at all.</p>
<p>Here&#8217;s the story: dBase was <a href="http://en.wikipedia.org/wiki/DBase#Origins">first</a> designed by  C. Wayne Ratliff when he worked at the Jet Propulsion Laboratory as a kind of office wager. A few years later the software &#8220;startup&#8221; Aston Tate chose that format and ported their applications from DOS to UNIX and VMS platforms while advancing from dBase II to dBase III. (As a result Aston Tate grew to be one of the top three software manufacturers in the world at the time) Later still Microsoft entered the arena with FoxPro, and litigation over the rights to dBase ensued. Interestingly, SCO was also involved in the legal battle as well. While the suit waged on, Aston Tate was purchased by Borland, who inherited the whole messy affair. Bottom line: the suit was lost since the whole dBase line actually grew from Ratliff&#8217;s original work that was in the public domain! <a href="http://www.foxprohistory.org/ashton_sues_fox.htm">Here&#8217;s</a> how FoxPro explains it:</p>
<blockquote><p>On December 11, 1990, Judge Hatter issued an order invalidating Ashton-Tate&#8217;s copyrights&#8230;<br />
Ashton-Tate had knowingly deceived the United States Copyright Office&#8230;<br />
Ashton-Tate knew that its programs were derived from JPLDIS, a public domain program developed by the Jet Propulsion Laboratory, it had &#8220;repeatedly failed&#8221; to disclose this fact &#8230;</p></blockquote>
<p>Ah ha! So enforcing the &#8220;open-ness&#8221; of a file format, and refusing to allow copyright law to apply to public domain technologies can insure that those technologies will live a full and fruitful life span!</p>
<p>So here&#8217;s this grand daddy of a database format that we GIS user&#8217;s are &#8220;stuck&#8221; with for now. How do we work with it? Well, traditionally, spreadsheet programs such as LibreOffice (Open Office) Calc have handled dbf quite well. You can open, alter and save dBase III with almost no issues using LibreOffice. Microsoft, in their wisdom, decided to drop support for *.dbf beginning with MS Office 2007. So MS user&#8217;s can either stay with MS Office 2003 or grab a copy of LibreOffice and use Calc for their DBF based shapefiles.</p>
<p>Before closing, here&#8217;s a tip. dBase has support for several data types, one of which is &#8220;Boolean&#8221;. In dBase terms it&#8217;s called &#8220;Logical&#8221;. A column of type Logical appears as either &#8216;T&#8217; and &#8216;F&#8217; or &#8216;Y&#8217; and &#8216;N&#8217;. Opening a DBF in Calc, you&#8217;ll see that each column header has the attribute name (maximum 10 characters) a comma and the attribute type. So text column headers from a DBF will appear in Calc like: LABEL,C,24. That&#8217;s a 24 byte wide text attribute named &#8216;LABEL&#8217;. Or: X_COORD,N,12,6. Which means a 12 byte wide numeric attribute named &#8216;X_COORD&#8217; with 6 decimal places. But whenever you open a dbf in LibreOffice with a <strong>boolean</strong> attribute, the boolean type becomes a one character wide string. If you then save back to dbf, you&#8217;ve lost the boolean type and it turns into single character instead. If you need to <span style="text-decoration: underline;">maintain the column as a boolean</span> (Logical) then do this in Calc:</p>
<ul>
<li> change the column header to look like this: &#8220;UPDATED,L&#8221; which indicates a boolean (Logical) data type named &#8216;UPDATED&#8221;</li>
<li>and replace all the single T&#8217;s with the full word &#8216;TRUE&#8217;, and all the F&#8217;s with the full word &#8216;FALSE&#8221;. Use Calc&#8217;s Search and Replace for this.</li>
</ul>
<p>Now when you save to DBF the column will remain as a &#8216;Logical&#8217; data type. In other words, LibreOffice needs the full strings TRUE and FALSE in order to recognize the cells as boolean values. Then they get saved to the DBF as boolean &#8216;T&#8217; or &#8216;F&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/dbf-longevity-and-logical-data/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Smile, you&#8217;re on candid GPS</title>
		<link>http://www.surfaces.co.il/smile-youre-on-candid-gps/</link>
		<comments>http://www.surfaces.co.il/smile-youre-on-candid-gps/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 22:21:44 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=817</guid>
		<description><![CDATA[Every photograph is taken somewhere. With the advances in miniature GPS chips, equipping cameras with GPS capability, and implanting location data into the images should be a no-brainer. Several manufacturers have indeed come out with GPS enabled cameras.  So , how do you use this new feature to georeference your photos in a FOSS GIS [...]]]></description>
				<content:encoded><![CDATA[<p>Every photograph is taken somewhere. With the advances in miniature GPS chips, equipping cameras with GPS capability, and implanting location data into the images should be a no-brainer. Several manufacturers have indeed come out with GPS enabled cameras.  So , how do you use this new feature to georeference your photos in a FOSS GIS environment?</p>
<p><span id="more-817"></span>At work we recently purchased a Panasonic TZ-10 with an embedded GPS.  I want the photos to pop open when I click on their location on a map. Picasa already does this on Googlemaps with photos that contain location data in their EXIF information header. But we want to implement this feature on <strong>our</strong> maps, with <strong>our</strong> data layers. And using our favorite open source GIS software. The toolkit I suggest includes QGIS together with the highly regarded <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/index.html">ExifTool</a>. Using this method we create a point shapefile of photograph locations. Then, with the &#8220;Actions&#8221; functionality built into QGIS we&#8217;ll call up an image display program to show the pictures at a mouse click.</p>
<p><span style="color: #808080;">(A new, experimental plugin called photo2shape is available from <a href="http://gis-lab.info/index-eng.html">GIS-LAB</a> to extract the photo locations from the exif data  directly into a shapefile. However I couldn&#8217;t get it working, and others have reported bugs, as is expected in early versions. I&#8217;ll report back as the plugin matures)</span></p>
<p><span style="text-decoration: underline;">Installing ExifTool</span></p>
<p>To install ExifTool on linux, first download the installation tarball from <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/Image-ExifTool-8.38.tar.gz">the ExifTool web site</a>. Unzip and untar the package. Then follow <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/install.html#Unix">these</a> straight-forward steps. For Windows users there&#8217;s a <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool-8.38.zip">binary package</a> ready to use. Unzip it into a directory such as C:\Program Files\Exiftool, and as per <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/install.html#Windows">this explanation</a> rename the executable <em>exiftool(k).exe</em> to<em> exiftool.exe</em>.</p>
<p><span style="text-decoration: underline;">Using ExifTool</span></p>
<p>This perl based program has a rich list of command line options including selection of EXIF tags, and output formatting. We&#8217;ll demonstrate a few.  On Windows, the exiftool executable won&#8217;t necessarily be in the PATH, so open a command window and change directory to &#8220;C:\Programs Files\ExifTool&#8221; (if that is where the exiftool.exe lives).  Also you&#8217;ll use the backslash &#8216;\&#8217; character as the Windows directory separator.  Other than that the commands work the same on both platforms.  First try running with the -l option to list all available EXIF tags in your photos:</p>
<pre>micha@hayun-820:~$ exiftool -l /media/data/pix/ExifTool/P1000034.JPG | grep "GPS"
....
GPS Satellites
....
GPS Latitude
GPS Longitude</pre>
<p>So this image contains EXIF tags with GPS data. Now we&#8217;ll have a quick look at the data in these tags:</p>
<pre>micha@hayun-820:~$ exiftool -GPSLongitude -GPSLatitude /media/data/pix/ExifTool/P1000034.JPG
GPS Longitude                   : 35 deg 11' 9.27" E
GPS Latitude                    : 30 deg 36' 51.73" N</pre>
<p>We enter the tag name as -TagName using a dash, and no spaces in the name, for each tag, and exiftool outputs the information. Now check the -c option to format the output of the Lon/Lat coordinates.</p>
<pre>micha@hayun-820:~$ exiftool -c "%.6f" -GPSLongitude -GPSLatitude /media/data/pix/ExifTool/P1000034.JPG
GPS Longitude                   : 35.185908 E
GPS Latitude                    : 30.614369 N</pre>
<p>Formatting follows the conventions of C printf formatting syntax. We also want to extract the date/time of the photo and some exposure information.  The date is formatted with the -d option, and follows the UNIX date formatting, so:</p>
<pre>micha@hayun-820:~$ exiftool -c "%.6f" -d "%d/%m/%Y-%H:%M" -CreateDate -Aperture -ShutterSpeed -GPSLongitude -GPSLatitude /media/data/pix/ExifTool/P1000034.JPG
Create Date                     : 31/10/2010-08:32
Aperture                        : 4.5
Shutter Speed                   : 1/500
GPS Longitude                   : 35.185908 E
GPS Latitude                    : 30.614369 N</pre>
<p>Finally we want to output the details in table form and extract from several photos at once. We will also need the photo filename and path for later use in defining the QGIS action. ExifTool has the -p option for this. This option can take either a list of the tag names, each preceeded by a &#8216;$&#8217;, or a filename which contains the same list of tag names. The way the tag names are listed in the file is the way they are output.  For example, in order to create a CSV (Comma Separated Values) file, we create and use a file like:</p>
<pre>micha@hayun-820:~$ cat /media/data/pix/ExifTool/exif_format.txt
$Filename,$Directory,$CreateDate,$ShutterSpeed,$Aperture,$GPSLongitude ,$GPSLatitude ,$GPSSatellites</pre>
<p>The tag names in the format file are commas-separated, so we get equivalent commas in the output. Now by handing off the above format filename to the -p option, here&#8217;s the result:</p>
<pre>micha@hayun-820:~$ exiftool -c "%.6f" -d "%d/%m/%Y" -p "/media/data/pix/ExifTool/exif_format.txt"  /media/data/pix/ExifTool/*.JPG
P1000032.JPG,/media/data/pix/ExifTool,29/10/2010,1/250,3.9,35.301453 E ,30.806672 N ,4
P1000033.JPG,/media/data/pix/ExifTool,29/10/2010,1/200,4.0,35.301453 E ,30.806672 N ,4
P1000034.JPG,/media/data/pix/ExifTool,31/10/2010,1/500,4.5,35.185908 E ,30.614369 N ,4
3 image files read</pre>
<p>We&#8217;re getting close&#8230;  We need to dump this output into a &#8220;point_locations.csv&#8221; file, but only after entering the tag names as column headers (separated by commas) as the first line of this file. Then re-run the above command but redirect the output to the same point_locations.csv file:</p>
<pre>micha@hayun-820:~$ echo "Filename,Path,Date,Shutter,Aperture,Longitude,Latitude,Satellites" &gt;&gt; point_locations.csv
micha@hayun-820:~$ exiftool -c "%.6f" -d "%d/%m/%Y" -p "/media/data/pix/ExifTool/exif_format.txt"  /media/data/pix/ExifTool/*.JPG  &gt;&gt; point_locations.csv
 3 image files read</pre>
<p>Here&#8217;s the final CSV file:</p>
<pre>micha@hayun-820:~$ cat point_locations.csv
Filename,Path,Date,Shutter,Aperture,Longitude,Latitude,Satellites
P1000032.JPG,/media/data/pix/ExifTool,29/10/2010,1/250,3.9,35.301453 E ,30.806672 N ,4
P1000033.JPG,/media/data/pix/ExifTool,29/10/2010,1/200,4.0,35.301453 E ,30.806672 N ,4
P1000034.JPG,/media/data/pix/ExifTool,31/10/2010,1/500,4.5,35.185908 E ,30.614369 N ,4</pre>
<p>One more important chore. Exiftool gives the Lon/Lat coordinates with the N-E-S or W qualifier. That won&#8217;t work when importing into QGIS. The coordinates have to be pure numbers. So open the CSV file in your favorite editor, and do a search/replace to remove all instances of &#8216; N &#8216; or &#8216; E &#8216;.  Note that in the above formatting step I left a space after the $GPSLongitude and $GPSLatitude entries. This then leaves a space after the Lon and Lat values in the resulting CSV.  Use this trick to make the search/replace easier.  And, of course, if your photos are in the Southern hemisphere, or west of Greenwich, the value followed by an &#8216;S&#8217; or &#8216;W&#8217; must be made <strong>negative</strong>.</p>
<p><span style="text-decoration: underline;">Displaying photos in QGIS</span><a href="http://www.surfaces.co.il/wp-content/uploads/2010/11/Delimited_Text.png"><img class="size-medium wp-image-827 alignright" style="margin: 3px;" title="Delimited_Text" src="http://www.surfaces.co.il/wp-content/uploads/2010/11/Delimited_Text-300x178.png" alt="Delimited text plugin" width="300" height="178" /></a></p>
<p style="text-align: left;">
<p style="text-align: left;">We next fire-up QGIS and start the Delimited Text plugin. Point it to your CSV file, check that it is parsed properly, and click OK to import the photo locations.</p>
<p style="text-align: left;">
<p style="text-align: left;">
<p style="text-align: left;">
<p style="text-align: left;">
<p style="text-align: left;">Once the photo locations are imported, open the layer&#8217;s Properties window and go to the Actions tab. <a href="http://www.surfaces.co.il/wp-content/uploads/2010/11/Action.png"><img class="size-medium wp-image-828 alignleft" style="margin: 3px;" title="Action" src="http://www.surfaces.co.il/wp-content/uploads/2010/11/Action-300x204.png" alt="" width="300" height="204" /></a>Enter a name for the action such as &#8220;Display photo&#8221; and in the Action text box enter the program you want to run to display the photos. On linux systems running Gnome, just enter gthumb or eog (Eye of Gnome).  Windows users can start the &#8220;Windows Picture and Fax Viewer&#8221; with the following command:</p>
<pre style="text-align: left;">rundll32.exe C:\Windows\system32\shimgvw.dll,ImageView_Fullscreen</pre>
<p style="text-align: left;">You might also have an alternate image viewer installed such as Irfanview. In that case the display command will be:</p>
<pre style="text-align: left;">"C:\Program Files\Irfanview\i_view32.exe"</pre>
<p style="text-align: left;">After the program name you&#8217;ll choose the attribute fields &#8220;Path&#8221; and &#8220;Filename&#8221; which hold the full path to each photo. Be sure to enter a slash &#8216;/&#8217; as directory separator between the path and filename. Windows users will of course use the backslash. And another important note for Windows: You must add another &#8216;%&#8217; character <strong>after</strong> the Path and Filename column headers. So the full &#8220;Action&#8221; on a Windows system will look like:</p>
<pre>rundll32.exe C:\Windows\system32\shimgvw.dll,ImageView_Fullscreen %Path%\%Filename%</pre>
<p><a href="http://www.surfaces.co.il/wp-content/uploads/2010/11/Identify.png"><img class="alignright size-full wp-image-840" title="Identify" src="http://www.surfaces.co.il/wp-content/uploads/2010/11/Identify.png" alt="Identify" width="241" height="253" /></a></p>
<p style="text-align: left;">Save the action.  Now using the QGIS information button, click on one of the photo points, and open the Action item at the start of the attribute list. Click on the &#8220;Display photo&#8221; action and the photo should open.</p>
<p style="text-align: left;">
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/smile-youre-on-candid-gps/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>QGIS on Windows with ECW</title>
		<link>http://www.surfaces.co.il/qgis-on-windows-with-ecw/</link>
		<comments>http://www.surfaces.co.il/qgis-on-windows-with-ecw/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 13:29:36 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=793</guid>
		<description><![CDATA[Windows users who need a full featured GIS platform can benefit from the fruits of open source software and choose Quantum GIS.  The latest version, 1.6.0, will be released in a few weeks.  And the preview is already available to download and install. QGIS now offers better labeling, a richer set of map composer tools, [...]]]></description>
				<content:encoded><![CDATA[<p>Windows users who need a full featured GIS platform can benefit from the fruits of open source software and choose <a href="http://qgis.osgeo.org/en/about-qgis/features.html">Quantum GIS</a>.  The latest version, 1.6.0, will be released in a few weeks.  And the preview is already available to <a href="http://www.qgis.org/wiki/Download#OSGeo4W_Installer">download</a> and install.</p>
<p><span id="more-793"></span>QGIS now offers better labeling, a richer set of map composer tools, and easy to use editing of vector layers.  The plugin architecture gives more demanding users access to over 100 python based advanced analysis and support tools.  And new plugins continue popping up like mushrooms after the rain.  Furthermore QGIS supports, by way of the ubiquitous <a href="http://www.gdal.org/">GDAL</a> library, almost the whole gamut of spatial data formats, from the well known shapefile, google&#8217;s *.kml as well as *.gml,  <a href="http://www.openstreetmap.org/">OpenStreetMap</a>&#8216;s *.osm files, and the new kid on the block: spatialite.  The spatially enabled database, PostGIS is fully accessible and managed r<em>ight from within QGIS</em>.  Among the raster formats are of course GeoTiff, ASCII grids, and  ERDAS img files.  The more complex digital elevation model and weather data such as Hierarchical Database Format &#8211; *.hdf &#8211; sometimes used by NASA, the USGS *.dem format, and raw SRTM *.hgt files have support built-in.</p>
<p>What&#8217;s missing? The very popular &#8220;wavelet compression&#8221;  imagery formats, ERDAS ECW and LizardTech&#8217;s MrSid are both proprietary, and their licensing does not allow free redistribution. Thus QGIS cannot have *.ecw support right out of the box.  However ERDAS does offer free download of their Software Development Kit (SDK), which gives readonly access to *.ecw compressed imagery, provided you agree to their licensing.</p>
<p>So to get <strong>QGIS</strong> up and running, <strong>including ECW support</strong>, here&#8217;s what you need to do:</p>
<p>Start by browsing to the <a href="http://downloads.erdas.com/reqdownload.aspx?guid=53e5b5ff-3591-4dcc-ac74-5aa985ab9ffd">ERDAS</a> download site. After accepting their licensing terms (requires responding to an email), you&#8217;ll be able to get the SDK. Follow the straight-forward instructions <a href="http://trac.osgeo.org/osgeo4w/wiki/pkg-gdal17-ecw">here</a> to run the SDK installer, and then copy the required DLL&#8217;s into your \windows\system32 directory.</p>
<p>Now go to the QGIS <a href="http://www.qgis.org/wiki/Download#OSGeo4W_Installer">download </a>page and get the OSGeo4W installer. This installer is <strong>not </strong>a &#8220;next-&gt;next-&gt;next&#8221; standalone installation, but rather a framework for getting (and later updating) lots of GIS software.  Note that it requires an internet connection to bring down all the software. (Although it is possible to download the collection of installations on one internet connected computer then copy the whole installation directory and run it <em>locally on another disconnected</em> machine&#8230;)</p>
<p>Once you start osgeo4w-setup.exe at the first screen be sure to choose &#8220;Advanced Install&#8221;.  There are a few more windows where you set download location, and final installation path. You can leave the defaults. Then, after it gets the list of available packages, you&#8217;ll be presented with a window containing five categories of software. Expand (click the &#8216;+&#8217;) the Desktop category and click on <strong> qgis-dev </strong>(click on the circular arrow symbol to toggle to install)<strong> </strong>as well as  <strong>gpsbabelfe. </strong></p>
<p>Next expand the Libs section. Scroll slowly down the list, and again click on the double arrow symbol to install each of the following (I&#8217;m including several python packages that are required for some plugins you might want later on):</p>
<p>gdal17-ecw<br />
matplotlib<br />
python-rpy<br />
python-rpy2<br />
python-shapely<br />
qgis-grass-plugin<br />
wxpython<br />
psycopg2<br />
pyspatialite</p>
<p>Assuming you don&#8217;t need any of the web applications, click &#8220;Next&#8221; to start the download and installation. The process takes some time, and on completion you&#8217;ll have icons on the desktop to run QGIS (as well as gpsbabel to connect to a GPS, and GRASS for heavy-duty raster and vector analyses).<br />
Startup QGIS, and under the &#8220;Raster&#8221; menu select the &#8220;Information&#8221; tool. Click &#8220;Select&#8221; to browse to a *.ecw file, and then click OK, and you should see in the &#8220;Raster Info&#8221; window the format and CRS details about the selected file.<br />
It&#8217;s worth mentioning that QGIS is under rapid development. You can rerun the osgeo4w-setup.exe any time in the future to identify and install updated packages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/qgis-on-windows-with-ecw/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Fastrack to FOSS GIS</title>
		<link>http://www.surfaces.co.il/fastrack-to-foss-gis/</link>
		<comments>http://www.surfaces.co.il/fastrack-to-foss-gis/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 16:39:56 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=782</guid>
		<description><![CDATA[Most people working in GIS aren&#8217;t computer technicians. Rather than spend time installing, configuring, or compiling software, they just want to get their maps done, and be home in time for dinner. Here&#8217;s a rundown of several of the more popular open source operating systems, focused solely on ease in jump-starting the FOSS GIS stack. [...]]]></description>
				<content:encoded><![CDATA[<p>Most people working in GIS aren&#8217;t computer technicians. Rather than spend time installing, configuring, or compiling software, they just want to get their maps done, and be home in time for dinner. Here&#8217;s a rundown of several of the more popular open source operating systems, focused solely on ease in jump-starting the FOSS GIS stack.</p>
<p><span id="more-782"></span>In almost all distros you will find the basic GIS programs, albeit older versions, available in the standard software repositories. Then in almost all cases adding a special GIS repo will give you access to more software, and newer versions.  Still there are some subtle differences. My ratings are not meant to imply preference for any one distro: it&#8217;s just an evaluation of how easy it is to get up to speed with GIS.</p>
<p style="text-align: left;">I put <strong>Ubuntu</strong> at the top of my list. First you add the Ubuntu GIS repo to your sources.list file as per the instructions <a href="http://trac.osgeo.org/ubuntugis/wiki/QuickStartGuide">here</a> then a few apt-get commands will bring down the whole collection of software.  But Ubuntu offers two additional features not available in other distros (to the best of my knowledge) that win it the trophy. The OSGeo LiveDVD <a href="http://live.osgeo.org/">project</a> has created a full blown GIS workstation installation, based on Xubuntu, and containing over 40 of the best FOSS GIS software. It&#8217;s available either as a Live DVD image (which you can use to make a bootable DVD or USB flash disk) and as a ready to run virtual machine. Secondly, with only a small effort you can add support for spatial file formats that do not necessarily come built-in such as HDF4, HDF5 and the license encumbered MrSID and ECW formats. On most other distros this will require recompiling of GDAL.</p>
<p style="text-align: left;"><strong>OpenSUSE</strong> comes in a very close second.  The Geo repo file to be added to /etc/zypp/repo.d is available <a href="http://download.opensuse.org/repositories/Application:/Geo/openSUSE_11.3/Application:Geo.repo">here</a> then after doing &#8220;sudo zypper update&#8221; you&#8217;ll get access to the latest and greatest GIS programs with &#8220;sudo zypper install &#8230;.&#8221;. I have found the (private) repo of <a href="http://www.teodori.org/repository/viewcategories.html">Francesco Teodori</a> with packages for GRASS and GDAL compiled with ECW support.  Installing R statistics requires addition of yet another repository.  See <a href="http://cran.r-project.org/bin/linux/suse/">details</a> on the CRAN website.</p>
<p style="text-align: left;">Next must come <strong>Debian</strong>. The best, most updated repo for GIS software is <a href="http://debian.gfoss.it">http://debian.gfoss.it</a> with software for both Lenny (stable) and Squeeze (testing). Adding it to the sources.list will get you late versions of GRASS, QGIS, the proj and geos libraries, as well as a fairly recent GDAL, with support for HDF4 and HDF5 (but, alas no ECW&#8230;).  Lenny users will find that they also need to add the <a href="http://backports.debian.org/Instructions/">backports</a> repo in order to get all dependencies.  A long list of precompiled r-* packages are also apt-get-able, so Debian is front and center with spatial analysis almost out of the box.</p>
<p style="text-align: left;">Releases of <strong>Fedora</strong> do come packed with GIS software, but all are older versions.  QGIS is at 1.0, GRASS still back at 6.2, and GDAL at version 1.5.  I haven&#8217;t found a reliable Fedora repo with really recent GIS appications.  So, as far as I know, getting a Fedora machine up to date with the later model GIS programs will require a lot of do-it-yourself compiling from source.  But that&#8217;s Fedora&#8230;</p>
<p style="text-align: left;">The popular server platform, <strong>CentOS</strong>, can be nudged into service as a GIS workstation, but since it&#8217;s a 4 year old OS, many of it&#8217;s base packages (notably python is still at 2.4 on CentOS 5.5) are just too old to be compatible with the newer desktop applications. By adding the Extra Packages for Enterprise Linux <a href="http://fedoraproject.org/wiki/EPEL/FAQ#howtouse">EPEL</a> repo you can  install GRASS with a recent GDAL. PostGIS and Mapserver are also within an easy &#8220;yum install&#8221; command. But don&#8217;t even bother trying QGIS.  Bottom line: CentOS 5 is the correct choice for a GIS database server, but for desktop use, let&#8217;s wait for CentOS 6.</p>
<p style="text-align: left;"><em>[Ammendment: By a gross oversight, I forgot to mention the actual GIS repository for CentOS. Thanks to Peter Hopfgartner for the reminder. EPEL gets you only the dependencies: you need the <strong>Enterprise Linux GIS</strong> repo at <a href="http://elgis.argeo.org/">elgis</a> for the GIS packages. ELGIS differs from EPEL in that it allows <span style="text-decoration: underline;">replacing of base CentOS</span> packages. Explanations on the ELGIS website. The repo offers both a stable branch and a testing branch, with the newest versions.]</em></p>
<p style="text-align: left;">I have no experience with <strong>Mandriva</strong>, but I&#8217;m fairly sure that their software collection includes the GIS stuff. I leave to others  to fill this gap&#8230;</p>
<p style="text-align: left;"><em>[Ammendment: see Markus' comment below for details about Mandriva]</em></p>
<p style="text-align: left;">Take a second and add your vote to the poll at the right. And I&#8217;m interested in any feedback or amendments you care to offer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/fastrack-to-foss-gis/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Fedora 13 and FOSS GIS: new gotchas and workarounds</title>
		<link>http://www.surfaces.co.il/fedora-13-and-foss-gis-new-gotchas-and-workarounds/</link>
		<comments>http://www.surfaces.co.il/fedora-13-and-foss-gis-new-gotchas-and-workarounds/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 12:06:18 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=746</guid>
		<description><![CDATA[With each new version of FOSS operating systems come new possibilities and new problems. Such is the case with Fedora 13. Fedora developers decided to no longer release statically compiled binaries, only dynamically linked. I won&#8217;t pretend to understand all the considerations which lead to this decision. But I&#8217;ve found that it floats to the [...]]]></description>
				<content:encoded><![CDATA[<p>With each new version of FOSS operating systems come new possibilities and new problems. Such is the case with Fedora 13. Fedora developers <a href="http://fedoraproject.org/wiki/Packaging/Guidelines#Packaging_Static_Libraries">decided</a> to no longer release statically compiled binaries, only dynamically linked. I won&#8217;t pretend to understand all the considerations which lead to this decision. But I&#8217;ve found that it floats to the surface some changes when trying to compile the GIS toolkit. So if you want to do the wizardry to setup your freshly installed F13 box as a GIS workstation, then follow the yellow brick road&#8230;</p>
<p><span id="more-746"></span>First off, if you haven&#8217;t yet, get the basic packages for compiling software, etc. (I enter my username into the sudoers file, similar to Ubuntu, so that sudo works, without being &#8216;root&#8217; all the time)</p>
<pre>~$ <strong>sudo yum install gcc gcc-c++ gcc-gfortran flex byacc cmake ccmake \</strong></pre>
<pre><strong>           ncurses-devel bison </strong><strong>wget gsl gsl-devel expat-devel</strong></pre>
<p>Next add the available geospatial packages, as well as several python and Qt libraries that we&#8217;ll need for GRASS and QGIS packages that we can install without compiling:</p>
<pre><strong>~$sudo yum install proj proj-epsg proj-devel geos libgeotiff libgeotiff-devel \
     wxGTK wxGTK-devel swig python-psycopg2 numpy \
     PyQt4 PyQt4-devel sip sip-devel wxPython wxPython-devel</strong></pre>
<p><span style="font-weight: normal;">My goal is to have available in GRASS and QGIS both Spatialite based GIS layers and ECW compressed rasters. These libraries are not available on Fedora, so I&#8217;ll need to add them by hand and then compile GDAL to include support for these formats. Next I&#8217;ll need to work my way up the toolchain, compiling both GRASS and QGIS to use this new GDAL. We begin with spatialite. Get the source:</span></p>
<pre><strong>~$ wget http://www.gaia-gis.it/spatialite-2.3.1/libspatialite-amalgamation-2.4.0.tar.gz
~$ tar xvzf libspatialite-amalgamation-2.4.0.tar.gz
~$ cd libspatialite-amalgamation-2.4.0</strong></pre>
<p>At this point we already bump into a problem with the lack of static binaries in Fedora packaging. Spatialite requires the  geos and proj packages. But it looks for *.la files which are missing from all Fedora libraries now. It seems that libtool reads these *.la text files to find what libraries should be linked. In the absence of a suitable *.la file, when we try to compile spatialite, libtool causes a failure. So here&#8217;s the workaround I used. I just create three text files with the definitions needed, and then spatialite happily compiles. In /usr/lib you&#8217;ll need libgeos_c.la, libgeos.la, and libproj.la. Thanks to Sandro Furieri on the <a href="http://groups.google.com/group/spatialite-users/browse_thread/thread/919283f738293849">SpatiaLite Users Forum</a> for this tip.  They should look like this:</p>
<pre><strong>~$ sudo vi /usr/lib/libgeos_c.la
          dlname='libgeos_c.so'
          library_names='libgeos_c.so'
          inherited_linker_flags=''
          dependency_libs=' -L/usr/lib /usr/lib/libgeos.la'
          weak_library_names=''
          current=7
          age=6
          revision=2
          installed=yes
          shouldnotlink=no
          dlopen=''
          dlpreopen=''
          libdir='/usr/lib'
</strong></pre>
<p>For each of the additional *.la files change the &#8216;dlname=&#8217; and &#8216;library_names=&#8217;  entries as required.<br />
Now go ahead and</p>
<pre><strong>~$./configure
~$make &amp;&amp; sudo make install</strong></pre>
<p>.<br />
Next step is the ECW libraries.  This has been faily well <a href="http://www.qgis.org/wiki/Installation_Guide#Step_2:_compile_and_install_the_ecw_libraries">documented</a> already. First you&#8217;ll have to register on the ERDAS site to download their SDK, then compile and install it. What you will need, after compiling the ECW library, is to add a *.conf file in /etc/ld.so.conf.d so that ldconfig will &#8220;find&#8221; the new library.</div>
<pre style="padding: 0px; margin: 0px;">~$<strong>sudo vi /etc/ld.so.conf.d/gdal.conf</strong></pre>
<pre style="padding: 0px; margin: 0px;"><span style="padding: 0px; margin: 0px;">      <strong> /usr/local/lib</strong>
<strong>~$sudo ldconfig</strong></span></pre>
<p>Now we&#8217;re ready for GDAL, etc.  First download the sources:</p>
<pre><strong>~$wget http://download.osgeo.org/gdal/gdal-1.7.2.tar.gz
~$wget http://grass.osgeo.org/grass64/source/grass-6.4.0RC6.tar.gz</strong></pre>
<p> (or a more recent source from svn) </p>
<pre><strong>~$wget http://download.osgeo.org/qgis/src/qgis_1.5.0.tar.gz</strong></pre>
<p>Unzip each tarball and, beginning with GDAL we trip over the next change in Fedora. Along with the &#8220;no static binaries&#8221; policy, the linker &#8216;ld&#8217; no longer links libraries that are not explicitly listed in the gcc compile statement. Previously, if one binary linked to a second that linked to a third, then there was &#8220;implicit&#8221; linking that brought in the third binary. This is no longer the case. The error that pops up with gdal concerns the pthread library. GDAL doesn&#8217;t use this inherently, but it is used somewhere along the compile chain. Again as a &#8220;quick and dirty&#8221; workaround I stuck in statements to have GDAL explicitly link to pthread as follows:</p>
<pre><strong>~$ cd gdal-1.7.2
~$LIBS="-lpthread" LDFLAGS="-lpthread" ./configure --with-geos=yes --with-sqlite3 --with-ecw=/usr/local --with-python --with-spatialite=/usr/local
~$make
~$sudo make install</strong></pre>
<p>With this done, we&#8217;re ready for a straightforward compile of GRASS and QGIS:</p>
<pre><strong>~$ cd ../grass-6.4.svn_src_snapshot_2010_08_07 </strong></pre>
<p> (or whatever svn snapshot you downloaded&#8230;) </p>
<pre><strong>./configure --prefix=/usr/local/grass-6.4 \
     --with-proj-share=/usr/share/proj \
     --with-postgres --enable-largefile  --with-sqlite \
     --with-freetype  --with-freetype-includes=/usr/include/freetype2 \
     --with-python --with-wxwidgets --with-cxx
make &amp;&amp; sudo make install
sudo ln -s /usr/local/grass-6.4/bin/grass64 /usr/bin/</strong></pre>
<p>You most likely will also want the gdal-grass package:</p>
<pre><strong>~$wget http://download.osgeo.org/gdal/gdal-grass-1.4.3.tar.gz
~$/configure --with-grass=/usr/local/grass-6.4/grass-6.4.0svn --with-gdal=/usr/local/bin/gdal-config 
~#make &#038;&#038; sudo make install</strong></pre>
<p>Before moving on to QGIS, we&#8217;ll get the R statistics package setup.</p>
<pre><strong>~$sudo yum install R-core rpy R-devel xml2 libxml2 libxml2-devel</strong></pre>
<p>I&#8217;ll now add the spatial packages to R. I like to keep all R packages under the system directory /usr/lib/R. However this directory is read only. Since this is my machine, I allow myself to change permissions, and then I can install additional packages without creating a separate R package directory in my home dir.</p>
<pre><strong>~$sudo chgrp -R &lt;my username&gt; /usr/lib/R
~$sudo chmod -R g+w /usr/lib/R</strong></pre>
<p>Now open an R session and run:</p>
<pre><strong>~$R
&gt; install.packages('sp', dependencies='true')
&gt; install.packages('spgrass6', dependencies='true')
&gt;q()</strong></pre>
<p>Next, for the rgdal package. R needs to locate the grass libraries. The R rpm packages which I installed above assume that the grass libs are in /usr/local/lib. But I installed GRASS myself elsewhere, so a quick soft link solves that issue:</p>
<pre><strong>~$sudo ln -s /usr/local/grass-6.4/grass-6.4.0svn/lib/libgrass_* /usr/local/lib
~$wget http://cran.r-project.org/src/contrib/rgdal_0.6-28.tar.gz
~$R CMD INSTALL rgdal_0.6-28.tar.gz -l /usr/lib/R/library/</strong></pre>
<p>and that&#8217;s done.</p>
<p>And finally QGIS:</p>
<pre><strong>~$ cd ../qgis-1.5.0
~$mkdir build; cd build
~$cmake -DCMAKE_INSTALL_PREFIX:PATH="/usr/local/qgis-1.5.0"  -DGRASS_PREFIX:PATH="/usr/local/grass-6.4/grass-6.4.0svn" -L ..</strong></pre>
<p>(Take note of the &#8216;..&#8217; at the end of the cmake line). The -L option to cmake outputs a list of the config options. Scan thru it to make sure everything is located on your system. Then:</p>
<pre><strong>make &#038;&#038; sudo make install
sudo ln -s /usr/local/qgis-1.5.0/bin/qgis /usr/bin</strong></pre>
<p>At this point you should be back in Kansas <img src='http://www.surfaces.co.il/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/fedora-13-and-foss-gis-new-gotchas-and-workarounds/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>GIS Basics with Quantum GIS</title>
		<link>http://www.surfaces.co.il/gis-basics-with-quantum-gis/</link>
		<comments>http://www.surfaces.co.il/gis-basics-with-quantum-gis/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 07:30:11 +0000</pubDate>
		<dc:creator>Micha Silver</dc:creator>
				<category><![CDATA[GIS]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://www.surfaces.co.il/?p=733</guid>
		<description><![CDATA[In several GIS training seminars I&#8217;ve used a collection of spatial data and exercises to demonstrate and practice some basic GIS operations using Quantum GIS. If you&#8217;d like to try out one of the popular open source GIS programs, download this zipped file. (100 MB, and compressed with 7zip). It contains a directory of documents, [...]]]></description>
				<content:encoded><![CDATA[<p>In several GIS training seminars I&#8217;ve used a collection of spatial data and exercises to demonstrate and practice some basic GIS operations using <a href="http://www.qgis.org/">Quantum GIS</a>. If you&#8217;d like to try out one of the popular open source GIS programs, download this <a href="http://www.surfaces.co.il/dl/GIS_Training.7z">zipped file</a>. (100 MB, and compressed with <a href="http://www.7-zip.org/">7zip</a>). It contains a directory of documents, including the list of exercises, a directory of geospatial data, and several presentations.<span id="more-733"></span></p>
<p>Under the Docs directory are, in addition to the exercises, some manuals and other training material in pdf format. The Geodata directory contains spatial data from naturalearthdata.org, Open Street Map, the European Environment Agency, as well as raster tiles from NASA&#8217;s ASTER DEM and the Landsat programs.  Each of the exercises will require loading different data layers.  All data have been clipped to the area of Croatia, and Bosnia-Hercegovina, and all are licensed so as to be freely usable.  Finally, under the Presentations directory are the slides used to explain various aspects of basic cartography and GIS theory.</p>
<p>If you find this learning material worthwhile, or have any comments for improvement, please let me know. I expect that I&#8217;ll continue polishing up the material, adding new presentations, and perhaps additional data sources. So check back.</p>
<p>*Update*</p>
<p>I&#8217;ve posted the tutorial in separate pieces so interested readers can have a preview before downloading the whole 100 MB zipe file. Here are the links:</p>
<ul>
<li>The  <a href="http://www.surfaces.co.il/wp-content/uploads/2010/11/Exercises.pdf">Exercises</a> (160 KB)</li>
<li>The  <a href="http://www.surfaces.co.il/dl/presentations.7z">Presentations</a> (12 MB)</li>
<li>The  <a href="http://www.surfaces.co.il/dl/GIS_Training.7z">Whole package</a> (100 MB)</li>
</ul>
<p>Licensing details:</p>
<p><a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/"><img style="border-width: 0;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png" alt="Creative Commons License" /></a><br />
<span>GIS Training with QGIS</span> by <a rel="cc:attributionURL" href="http://www.surfaces.co.il">Micha Silver</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surfaces.co.il/gis-basics-with-quantum-gis/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>
