Tag Archive for 'Windows'

GeoDjango on a Windows server

Deploying GeoDjango projects on a Windows server is obviously possible, but not necessarily the most seamless process one can think of. To get started, there are some great tutorials – at the django project site and here, with some more information about the correct PATH settings – available, that guide you step-by-step through a GeoDjango installation.

Below are some things that I did in addition, did differently, or simply couldn’t do because I never got them to work.

The basics: Django and IIS

IIS is was the web server of choice on the Windows machine in question. Serving Django through IIS is of course doable, there is even a dedicated page on the Django project about it. However, I totally failed in getting Django to work well with IIS. It seemed painfull and eventually made me switch the entire web server to Apache. Django integration with WSGI under Apache is a piece of cake compared to PyISAPIe and IIS if you ask me, up and running in less than 10 minutes.

Virtual Environments

Virtual Environments are great when developing with Python. They give you separated Python installations for every project you work on and avoid interferences with dependencies and installed packages across your projects. Virtual environments is something I’ll really miss on Windows, because I never got it to work correctly. Virtualenv basically creates the correct folder structure and activates a Virtual Environment to work in, but for some reason dependencies in my projects were attempting to access the main Python installation. Which obviously defeats the purpose of Virtual Environments.
What I ended up doing was, using one Django installation and being extremely careful about what goes there. Basically I have to manually validate, check and test that new packages for new projects don’t mess with existing once. Painful, I tell ya.

win-psycopg headache

I ran into serious troubles with psycopg 2.2.1 (the PostgreSQL adapter for Python). My project wouldn’t connect to the PostgreSQL database server at all. I found this entry at stackoverflow, which describes exactly the same issue. The posted solution worked for me too: use psycopg 2.0.14 instead of 2.2.1, no problems so far.

Multiple Django projects in one Apache/WSGI instance

This was the most annoying issue: turned out that only one project at a time was working on the server. That might be an option for the iPhone, but it clearly was unacceptable in my case. The problem caused by the “Python for Windows extensions” is documented in this thread, and my solution, similar to the one posted at the end of the thread, was to install pywin32-212 instead of pywin32-214.

Lessons learned

If you have a choice, get a Linux box to deploy GeoDjango. Anything but .NET seems painful to serve on Windows.

Moving ArcGIS to VMware Fusion

After the upgrade to Mac OS 10.5 I decided not to use Boot Camp any longer and switch entirely to a virtualization solution. Mainly because Boot Camp is limited to the primary (internal) hard drive and occupies a lot of disk space which I want to use for some other things now. A virtual machine I can run from an external hard drive too and move it to wherever I want.

My copy of Parallels Desktop (aff link) transfered the existing Windows XP installation from the Boot Camp partition to a new virtual disk image flawlessly. Problems started later when I tried to start the image for the 2nd time. The disk image apparently corrupted and I had to install everything from scratch again. After hours of Windows and ArcGIS installations, the disk image corrupted again when I tried to restart the virtual machine. I wasn’t able to find out what caused the problem, wasn’t in the mood to spend another couple of hours with basic set ups either and started looking for alternative virtualization solutions.

The next version of Parallels Desktop’s main competitor, VMware Fusion (aff link), is currently in beta and until 2nd Oct 2008 they are offering free beta licenses.

Their website lists all new features and enhancements. From my point of view – not doing any benchmarks, just trying to complete basic ArcGIS tasks in Windows – it feels snappy enough and has useful features like unity mode, snapshots, mirrored and shared folders, which you can add to the virtual machine while it’s running.

I didn’t encounter any problems setting up and running ArcGIS in VMware Fusion. Whereas I didn’t do any geoprocessing tasks yet. Geoprocessing worked well in Parallels and I expect it to do so in VMware Fusion too. If not, I’ll post it here.

However, while working with grids I noticed an issue: my ArcGIS workspace was a subfolder within the mirrored Documents directory in Mac OS X. In that environment, an ESRI grid file I was working with wasn’t fully accessible in ArcGIS. After I copied the entire workspace inside the virtual machine, everything worked fine again. Maybe it’s related to HFS, the Mac OS filesystem.

VMware Fusion

Steven and Roman brought my attention to Sun’s open source virtualization solution called Virtualbox. I tried that one too – it does a fairly good job, not as advanced as VMware Fusion though, but well documented and highly customizable. If you own a Mac, need Windows (or Solaris, Linux, FreeBSD, etc.) and prefer open source, go with VirtualBox.

Another interesting detail is that VMware Fusion is pretty active on Twitter. At least they are scanning Twitter for Tweets about their products and they even respond to those tweets – clever marketing I guess. Though I don’t how far it goes and if you can use Twitter for quick support questions. Would be very convenient.

EULAs

Parallels is making it around some news sites today, for mainly two reasons:

  1. Parallels 2.5 RC2 is out and brings again some improvements, and
  2. Microsoft’s VISTA EULA forbids running of Windows Vista Home versions in virtualization environments such as Parallels, while allowing an install under BootCamp. Isn’t that weird? Btw, Apple’s EULA apparently contains very similar things about virtualization of Mac OS X…

After the update of my Parallels installation I found out that in Coherence mode I can drag&drop files between Windows Explorer and Mac OS X Finder even from and to external drives not visible in Windows. Pretty cool, didn’t know it before. I always shut down Windows, added the drives to my Parallels Windows set-up and rebooted Windows again to access them.

Poor Rosetta

Interesting: Sean Carruthers did some tests and found out that Adobe Creative Suite 2 running in Boot Camp and Parallels Desktop (aff link) partly performs better than running in Apple’s own PowerPC emulation environment named Rosetta.

Not surprising, since Boot Camp and Parallels can access more or less directly the Intel core while Rosetta must emulate a PowerPC before starting any other tasks. I’m no hardware engineer, but for me it sounds like Rosetta has some more work to do than Parallels or Boot Camp.

However, it leads another time to the question if, along with increasing popularity of emulation environments on the Mac, Mac OS X versions of applications are needed any more

Why not just get your copy of Parallels Desktop, Boot Camp, etc. and run Windows versions on your Mac? Why waiting years for applications to be ported to Mac OS X when you can simply run them in an emulation environment (e.g. OpenOffice)? Perhaps even without any major drawbacks.

Thanks to the latest Parallels update, a combined workflow (coherence mode, drag and drop items) between Windows and Mac OS X has improved significantly. Parallels has done an amazing job during the last months and I guess some major upgrades (e.g. hardware acceleration) can be expected for the near future.

Shell power

Working most of the time in a graphical user interface you tend to forget how easily things can be done by a simple shell command.

Today a colleague asked me about a way to merge a bunch of text files together (on a Windows machine). Considered solutions reached from a quick VB script to even importing the tab separated text files into a database and merging them by a SQL statement.

Yeah, why make things simple when you can make them complicated?

Executing copy in a DOS shell, with a few input and output parameters, was everything needed to get the job done:
<code>C:\>copy file_1.txt + file_2.txt file_merge.txt

PostGIS, ESRI & Windows

PostGIS 0.9.0 released

Beside various new features (e.g. GEOS 2.0) PostGIS now comes along with Klaus Försters AsSVG() functionality, which allows to deliver SVG elements directly out of PostGIS.

ESRI & PostGIS

ESRI released their ArcGIS Data Interoperability Extension, which finally offers a slightly integration of PostGIS into their products. A first review and user experience you can find here.

Windows & PostGIS

For testing PostgreSQL/PostGIS on windows without cygwin I recommend to check out those installers:
PostgreSQL Win32-Installer
PostGIS Win32-Installer
PostgreSQL/PostGIS Win32-Installer
PostgreSQL/PostGIS on Windows Tutorial

Developing the Road Accident Information System

PostgreSQL/PostGIS under Win32

If you are interested in trying PostGIS under Windows, I suggest you follow that thread in the PostGIS-Users mailing list. A Win32 PostgreSQL 7.5/PostGIS snapshot is available for developers.