Posted by & filed under QGIS.

I was using Openlayers to chuck a map up onto a page – but I couldn’t get it to allow other elements to render above it. Since I wanted a full-screen map, you could basically see only the map and nothing else.

What happens here is that Openlayers uses the z-index CSS property for its own internal layer arrangements. By default, it reserves quite a large range of z-indexes for itself, so if you’re using it on a page with anything besides the map on it, the rest of your page would need to be rejigged merely for Openlayers’ benefit. Obviously you’d want to save on the effort if possible.

The basic trick to solve this problem this is explained quite neatly on the Anjalytics blog. Basically, you want to assign the entire Openlayers map element a new z-index. One that fits within the larger scheme of things on your page, hopefully!

So in other words:

div.olMapViewport {
z-index: 0;
}

 

If your z-indexes still don’t work, you may have fallen prey to a bit of a CSS gotcha. You need to assign a position (relative/absolute) to a CSS element before it starts taking orders from your z-index property.

For example:

#element {
position:absolute;
z-index:0;
}

 

See the related question on gis.stackexchange.

Posted by & filed under QGIS.

Its probably folly to stare at download numbers too much, but it has become something of a tradition for me to post them here, so here are the results for the 1.7.0 run (which is now superceded by 1.7.1). With over 100,000 downloads in just over 3 months we are doing well! Note that as before these stats only cover the windows standalone installer.

Cumulative downloads for QGIS 1.7.0

Cumulative downloads for QGIS 1.7.0

 

Download decay graph for QGIS 1.7.0

Download decay graph for QGIS 1.7.0

Posted by & filed under GeoDjango.

We do a lot of django work here at Linfiniti and always use a python virtual environment with each project so that the runtime requirements are isolated to that project. Our typical project looks like this:

 

projectfolder
+-- django_project
   +-- django_app
+-- python
   +-- bin
   +-- include
   +-- lib
   +-- local

 

…with an outer folder containing a python virtual environment and a django project with one or more django apps in it.

This works out great…until you need to change the name of your project. You can simply rename everything like this:

 

newfolder
+-- new_django_project
   +-- django_app
+-- python
   +-- bin
   +-- include
   +-- lib
   +-- local

 

Using mv and git mv. But the problem is that virtualenvs are not portable – they have the filesytem paths hard coded into them. Usually I just destroy the virtualenv and then recreate it, but in our low bandwidth office that takes quite a while. So today I came up with a formula to rename everything without rebuilding. There are four steps:

1) rename the outer project folder e.g.

 

 
mv projectfolder newfolder

 

2) rename the django project e.g.

 

git mv django_project new_django_project

 

3) use the linux ‘rpl’ command to replace all references to the old folder names (run from the root of the newfolder directory:

 

 rpl -R "projectfolder" "newfolder" *
 rpl -R "django_project" "new_django_project" *

 

4) remove all old pyc files:

find . -name "*.pyc" -exec rm -rf {} \;
This last step is the important one – if you don’t do it python binary files will contain stale references to the old directory structure and you will see something like this if you try to do a runserver:
ValueError: bad marshal data (unknown type code)
Needless to say you should create a backup before attempting the above.

Posted by & filed under QGIS.

Looks like they are having some post announcement jitters at apple.com:

Apple.com being evasive....

Apple.com being evasive....

 

Glad its not just me who sometimes gets things screwed up….

Posted by & filed under QGIS.

 

Last week I did a short interview with Gary Sherman (the founder of the Quantum GIS project). I am busy putting together a nice presentation of the human side of the project and I thought I would start with him. Here is the first part (of two parts)  for your viewing pleasure:

Andreas and other Non-flash users can get a copy of the .mov file directly here

Posted by & filed under QGIS.

So QGIS Server didn’t win the performance shootout at FOSS4G2011…sniff. However there is no need to be alarmed – if you hide QGIS Server behind a tilecache you don’t need to let your users wait around for their maps to render. I hadn’t tried QGIS Server with TileCache and was curious to know how well it would work. I was a bit worried about label clipping and duplication as we don’t yet have any directives you can pass to the server to make it aware that we are tiling.  I used TileCache’s metatiling options:

metaTile=True
metaBuffer=256

I was very pleased with the results – here is the Norwegian Trekking map I mentioned the other day delivered via TileCache.

 

[advanced_iframe securitykey=”da39a3ee5e6b4b0d3255bfef95601890afd80709″ src=”http://utno.linfiniti.com/tilecache.html” height=”300″]

Note that the cache is not pre-seeded, so if you are the first to visit an AOI of interest, it will take a little longer to render.

Posted by & filed under QGIS.

Lately I have been delving deeper into the (aweful) world of Microsoft Windows – specifically looking to be able to better support Windows users trying to get to grips with running FOSSGIS on that platform. I have mentioned before on this blog how dependent I am on GDAL for my daily work. GDAL is also one of the pillars of any FOSSGIS stack (especially if you ‘belong to the c-tribe’), so being able to build it yourself on a given platform os always useful. In my case I wanted to include openjpeg V2.0 support in my Windows builds of QGIS (and hence in my windows build of GDAL).

There are several options for building GDAL under windwos yourself (ranked from insane to mindless):

  • Build all the dependencies yourself from scratch and then download GDAL from SVN and build against those dependencies.
  • Download and install OSGEO4W including the developer packages it provides, and then build GDAL against that.
  • Download an SDK created by a very fine fellow by the name of Tamas Szekeres (thanks to the folks on #gdal IRC channel for putting me on to this).
Tamas’ SDK is available in various forms – for different MSVC versions and different versions of GDAL. Also he provides two options:
  • GDAL and its dependencies provided as pre-built runtimes without.libs  and headers (around 20mb) – this is most useful if you want up to date versions of the GDAL command line tools and don’t need to compile and link against the GDAL library.
  • A complete build it yourself environment with GDAL and Mapserver source code and all the dependencies needed to build them (around 60mb).
The runtime packages are available as nightly builds so you can use bleeding edge versions of GDAL like that if you want to. The SDK is provided as a simple .zip file which you can unpack and then run the following command (you need to have MSVC installed) in order to build GDL:
nmake gdal

Simply wait a few minutes and you will have  a fresh build of the stable GDAL created in the directory called release-1500 (if you are using MSVC2008). If you want to build GDAL Trunk, I could’t find a download on Tamas’ site that directly supports that so I switched the gdal checkout inside his SDK to use trunk:

cd gdal
svn switch https://svn.osgeo.org/gdal/trunk/gdal

If may take a few minutes or longer to do the switch if you are on a slow connection like I have. After that step is done, go back up a level in the directory tree and rebuld GDAL:

cd ..
nmake gdal

Once again, go have a cup of fine South African Rooibos Tea while you wait because it may take a few minutes….

When it is finished compiling you will have a shiney new gdal19dev.dll binary build under release-1500-bin and a gdal_i.lib under release-1500/lib. Next you can build QGIS against this binary. To do so, simply follow the standard QGIS INSTALL  process for windows, but during the cmake-gui step substitute the following variables (I build GDAL using Tamas’ SDK in c:\dev\cpp\gdal-sdk\):

Replace:

GDAL_INCLUDE_DIR   : C:/OSGeo4W/include/
 GDAL_LIBRARY      : C:/OSGeo4W/lib/gdal_i.lib

With

GDAL_INCLUDE_DIR   :  C:/dev/cpp/gdal-sdk/release-1500/include
GDAL_LIBRARY       :  C:/dev/cpp/gdal-sdk/release-1500/lib/gdal_i.lib

Then generate and configure and build QGIS as per the documentation. One last thing you need to remember  : all the SDK binaries need to be copied into your QGIS runtime directory otherwise it will complain about missing GDAL.

Tamas’ work to create a GDAL SDK for Windows takes away a lot of the pain of developing ‘C-tribe’ applications under Microsoft Windows and is well worth using if you are stuck in MS land. Thanks Tamas for your efforts!

 

 

Posted by & filed under QGIS.

I’ve just been chatting to Aaron Racicot and Pirmin Kalberer on IRC to hear how things went during their workshops at FOSS4G in Denver. Aaron and co-conspirator Greg Corradini have put together a really nice training resource on building python plugins in QGIS which is available at www.qgisworkshop.org. The source of their workshop notes can be forked over at github : https://github.com/cugos/qgisworkshop_org. It sounds like their workshop was well attended and well received so I’ll be looking out for lots of new plugins to arrive in the QGIS plugin repository shortly :-)

Pirmin’s talk on ‘whats new in QGIS’ also generated some buzz on twitter and he got to show off some of the cool power user features in QGIS 1.7. The notes from his talk are available here: www.sourcepole.ch/foss4g/