Archive for the 'linux' Category

A year of anniversaries and change

So, it’s 5 years since OSGeo was formed- that’s pretty cool! Spurred on by this post, I thought I would say a little bit about my involvement with OSGeo, and also rather clumsily segue this into an announcement about my impending change of job. It’s true- after years of not really thinking of myself as an archaeologist any longer, but rather ‘someone who works in an archaeological unit”, I’ve finally gone and got myself a real job. Anyhow, more on that later.

5 years ago, I was playing around with mapserver, because I wanted a way of serving data and some shiny web maps and we had no money to do it with. I sucked at it big time, with no programming experience, and barely any command line experience. My only linux knowledge consisted of messing around with a Sharp Zaurus (the best pda I’ve ever had), and I only really equated open source with “free as in beer”. I remember the excitement on the mapserver mailing list when OSGeo was announced, along with the open sourcing of MapGuide, and I also remember quite fancying the idea of a whole conference about this cool new stuff when FOSS4G was announced.

Since then, there have been so many lightbulb moments for me, such as getting the real “point” of open source, getting more involved with OSGeo via starting the UK chapter, breakthrough moments when I have really started to understand a particular program or language, getting over my fear of public speaking by talking about open source at conferences, teaching colleagues and strangers how to use this software, and getting consultancy jobs designing applications that use it.

Through that time, I’ve seen (heck, we’ve all seen) OSGeo go from strength to strength, and become a truly global organisation. More importantly though, it’s a great global community.

I should also say that my new job, as Web GIS Specialist/Lead Consultant at Astun Technology, could only have happened through the experience I’ve gained over the last five years, so thanks to everyone that’s helped with that. I’m sad to be leaving Oxford Archaeology, but massively looking forward to my new role, which I hope will allow me to keep up my involvement with OSGeo, and in particular the UK chapter.

Will I keep blogging? Yes, and hopefully more often as I learn lots of new and exciting stuff (new to me- I’m a recent very enthusiastic convert to Python-years after everyone else). Will I still be doing open source stuff? Hell, yes! Will I change the name of the blog? Pehaps…

Sunday Tip Day: Convert a shapefile to text with linux

Never apologise for delayed posts… this is a Sunday Tip Day post, not a Thursday! Anyhow…

I just found a super little cross-platform utility that takes shapefiles and dumps them to a variety of text-based formats. Download it here, and simply unzip it to use it.

There isn’t much documentation, but basically your options are to download to gpx or spreadsheet. The following gives you a simple delimited text file with the coordinates and values from your attribute table:

./shp2text -–spreadsheet /path/to/your/shapefile.shp > /path/to/output.txt

Bob is indeed your mother’s brother.

Slightly belated Thursday Tip Day: Find and replace text in multiple files

Apologies for the delay- it’s been a roller-coaster week at Archaeogeek Towers due to family health issues. Hopefully it’s getting sorted now though.

In the process of preparing Portable GIS, I needed to change a string in multiple files of multiple formats within multiple folders. I looked at various windows- based options, most of which had a charge associated with them, but one of my colleagues suggested a linux approach.

“Sed” is the command that you need, found in most linux systems. In windows you can install it as part of the unxutils toolkit. The following command in linux works recursively through the folders in a root directory changing string1 for string2 (be careful with those single quotes if copy and pasting as wordpress likes to restyle them):

find ./ -type f -exec sed -i ’s/string1/string2/’ {} \;

With a large number of files this might take some time to work (a usb stick took an hour to work through on my ubuntu server vm but maybe that’s not a fair benchmark).

Thursday Tip Day: On USB keys at the linux command line

How to mount a USB stick in Ubuntu server using the command prompt only:

Do a sudo tail -f /var/log/syslog and plug the usb drive in.
Look for lines like these:
Feb 18 12:58:32 shuchi kernel: [17192272.616000] sda: assuming drive cache: write through
Feb 18 12:58:32 shuchi kernel: [17192272.616000] sda: sda1

Make a directory in /media named usbdrive.
Mount it like this: sudo mount /dev/sda1 /media/usbdrive

To unmount before ejecting:
sudo umount /media/usbdrive

If you get a message saying that the device is busy you can find out what process is using it using with the fuser command, with the -u parameter to see which user it is:

fuser -u /media/usbdrive

This will give you a number which refers to a process, and a user, then run ps -A to list all the processes and see which one it is. If you need to kill that process (USE WITH CAUTION) then run:

sudo kill -9 yourprocessnumber

You should then be able to safely unmount your USB drive

Next Page »