Posts in category gis

GeoMeetup Slides

I've posted slides from my talk at the  GeoMeetup in San Francisco.

The talk was on Python Plugin development for QGIS, get the slides over on  Scribd

NACIS 2009 Opening up

So at the AAG Conference last year, we ran an  OSGeo booth. Some representative from North American Cartographic Information Society ( NACIS) approached and invited us to their conference.(It wasn't the 1st time after one of my talks on FOSS previously I had been asked).

Now the important part, the California Chapter gave a 50 minute, 4 app demo at the NACIS "Practical Cartography Day" to an audience of 150.  Details Take home message - Cartographers want good svg output.

Notes from the rest of the conference, "Open" was actually mentioned a lot. Here's a rough breakdown of the frequency of relevant topics(In presentations):

  • Postgis ++
  • OpenLayers(not by name but showed up in slides and on demo sites) +++
  • mapnik ++
  • GDAL +
  • Modestmaps
  • php +++
  • OpenSource +++++(Even ESRI)
  • Python +++
  • OpenStreetmap ++++
  • Flash/Flex +++++++
  • OGC +
  • Inkscape +
  • GIMP +
  • WMS +

(Maybe I'll post a plot when I get chance)

Next post: Some new public domain datasets people are going to want to get their hands on...

Network analysis using GRASS

I ended up wanting to analyze commute paths on several networks, but instructions on how to properly prepare a network file with new points snapped to it as nodes was a little less than clear. I'm not 100% sure this is right but it is pieced together from the command history  GRASS stored with each layer in my mapset.

#bring the layer in -o dsn="/scratch/congelton/davis_ped_net/ped_net_sep28.shp" output="pednets28" min_area=0.0001 snap=-1

#find the nearest line to a point and create a line that connects them
v.distance -p from="davissubset@PERMANENT" to="pednetsep28" from_type="point" to_type="point,line,area" from_layer=1 to_layer=1 output="ppl2pednet" dmax=-1 upload="dist" column="dist"

#add categories to the distance lines(I think this is required otherwise won't work later, if the cat column is already populated then you can skip this)
v.category input="ppl2pednet" output="ppl2pednetcat" type="point,line,boundary,centroid,area" option="add" cat=1 layer=1 step=1

#patch the distance lines to the to the original points, so you have the nodes for
v.patch input="ppl2pednetcat,pednets28" output="pplpednet"

# patch the distance lines to the network
v.patch input="pplpednet,davissubset" output="pplonpednet"

#I ran a clean before I did the actual command to make sure I dropped things that wouldn't work, outliers
v.clean input="pplonpednet" output="pplonpednetclean3" type="line,point" tool="snap,break" thresh=3,3

#run the network shortest path using the original points as starting points and end points in batch from a csv, the point id is it's cat input="pplonpednetclean3" output="dcommute3" type="line,boundary" alayer=1 nlayer=1 file="pplonpednetclean.csv" dmax=1000

#example of the csv
#autonumber,Start node cat, end node cat
1       1       3000
2       5       3000
3       6       3000
4       7       3000
5       8       3000
6       9       3000
7       10      3000
8       14      3000
9       15      3000
10      25      3000
11      26      3000
12      27      3000
#yes all my people traveled to the same end point

Things to watch out for:

  • A network file should have both lines and points with the same layer number(ie 1_points 1_lines)
  • A network file with no cat column in the points component

Installing Sqlite 3.6.x on Ubuntu Intrepid

I needed sqlite 3.6 or newer for an application I'm working on but Ubuntu Intrepid has 3.5.9, specifically for Rtree spatial indexes. (In order to build and use  Spatialite.

After weighing my options and doing a little research I noticed that the Jaunty packages barely have any dependencies and they are already met by Intrepid.

So I downloaded:

Steps to follow:

  1. Uninstall libsqlite3-dev 3.5.9
  2. Install libsqlite3 3.6.10
  3. Install libsqlite3-dev 3.6.10
  4. Install sqlite3 3.6.10

To test with python(happens to be what I'm developing with)

from pysqlite2 import dpapi2 as sqlite3
print sqlite3.sqlite_version

Grass Syntax Hints

Short Story

 GRASS GIS command line syntax can be a little tricky and none of the graphical interfaces seem to make it easy because there's always some option you need that isn't on the GUI.

Importing a shapefile dsn=/path/to/folder/ layer=nameofshp output=giveitaname

notes: don't put .shp on the layer name, If it complains about not being the right projection but you know it is add a -o (no that's not a zero)

Long Story

I was testing out  QGIS 1.0 and the grass toolbox was having issues, without giving me an useful error message to work from.

So I compiled the latest grass release (6.4 RC2) and tried the new wxpython interface which also failed.

Lucky for me the good ol command line worked once I gave it all the info it wanted in the proper syntax.