Tuesday, March 29, 2011

osgeo4w for impaired networks

There has been some discussion going on about the osgeo download server (http://download.osgeo.org) being not reachable from certain networks (for example Italy's main provider Telecom, but also providers from other countries). This also means that the osgeo4w installer is not working right now, even if there is a mirror server (http://download2.osgeo.org) available that would be reachable from those networks (at least the Italian one).

Thanks to Matt Wilkie, there is now a tested (not as my recent desperate failures) way to get to update the osgeo4w packages. It is a bit less userfriendly, since commandline based, but I am sure many will appreciate. I did. Thanks Matt, also for the following instructions!

First some definitions:

%OSGEO4W_ROOT% refers to the installation folder of osgeo4w. In my case the folder is C:\OSGeo4W, which is the default.

Instructions:

1) download the file: apt.py
and save it to %OSGEO4W_ROOT%\bin\apt.py. If the file already exist, you can skip this step.

2) Create in the same folder as 1) a file named apt.bat, which contains the following line:
@python "%OSGEO4W_ROOT%\bin\apt.py" %*

3) Open the Osgeo4w command shell (it can be found in the program menu under osgeo4w) and inside that run the commands:

3.1) To update the list of packages:
apt --mirror=http://download2.osgeo.org/osgeo4w update

3.2) To get the list of available packages:
apt --mirror=http://download2.osgeo.org/osgeo4w available

3.3) To install a package:
apt --mirror=http://download2.osgeo.org/osgeo4w packagename


Full command options: http://trac.osgeo.org/osgeo4w/wiki/pkg-apt


I really hope that can help someone to get its preferred osgeo4w application until the eembargo is over.


PS: the --mirror instruction is necessary only in the first command run

-----------------------------

TROUBLESHOOTING

There might be a couple of problems:
1) python is not installed in your osgeo4w installation (WHAT, NO PYTHON!!!!!???? Where do you live!?!?!? In a java world!??!?! :) ). In that case you will have to install it and then change the apt.bat to refer to your python installation.
In my case I had a python installation on my pc, but non in the osgeo4w installation, so I changed the apt.bat file to be:
C:\Python27\python "%OSGEO4W_ROOT%\bin\apt.py" %*
After that everything worked flawless.

Another option is the http://code.google.com/p/maphew/wiki/OsgeoFromScratch documentation.


2) If the apt update didn't work, try first to run:
apt --mirror=http://download2.osgeo.org/osgeo4w setup

I can't remember if I ran it or not and now it is too late to tell if that did unlock anythig in the begin.

1 comment:

hendri setiawan said...

Appreciatte your blog post