Distance Bands and GRASS GIS

Jul 21, 2015 | GIS, GRASS, postgis

Invariably when you’re using Open Source GIS you end up with those questions – How good is it? What can you do? It’s free…it can’t be that good…can it? Well – I’ve been working hard with Open Source GIS in it’s every form. PLUS – I don’t have all those nice extensions for the other piece of software. In this case – Network Analyst.

So the client had points. The client needed to know distance bands from those points. I had been experimenting with about everything – Postgis, grass, qgis…..whatever. I had decided I could do it in postgis…and I probably could….but I would require more “learning” of sql.

GRASS.  I remember when I started using ArcINFO back in the 90’s someone would ask “what do you do?” – I explain. Then they would go -  “I used GRASS in College”. We would laugh. This joke continues constantly until a few years ago. Well – if you haven’t taken a look – Grass is now up to Version 7. You also get GRASS when you install QGIS.

GRASS is a bit different than QGIS. You import the data into your workspace and you work with vector or raster data. In this case I found a tutorial. You can create networks with Grass. You can make isochrones.  You also have command line options for everything and menus – so the point and clickers are good also.  You have an entire set of menus devoted to networking.

So the very short story will be (since I linked to the tutorial) – you can network your data. You can develop different versions of this process from distance to time to shortest paths. GRASS 7 is almost “plugged into” qgis. So this will be a bit easier soon – but it’s doable now. I will also skip over a few things:

You start with this: roads and POI (Points of Interest)

Selection_193

  1. Open GRASS.
  2. Import your vector data into GRASS by going to File -> Import Vector Data -> Common import formats. Import the data you want to network and the point data.
  3. I’m going to use the command line version of the commands. Grass has a very nice interface to either click, search, type, or use python for your commands.
  4. Build the network: v.net –overwrite –verbose input=roads@rjhale points=POI@rjhale output=network operation=connect thresh=100 .   Simple. The one thing you need to know is that thresh makes sure your points connect to your road network – anything that is 100 feet or less will snap. Also notice you’ve created a new layer called network.
  5. Look at your network metadata: v.category network op=report  .   Notice you have x number of POIs. I just use this for a sanity check. Hopefully you know how many POIs you have.
  6. Run the command: v.net.iso –overwrite –verbose input=network output=network_iso@rjhale ccats=1-7 costs=200,500,600,800 . So here you are making a new network with breaks and categories for each of the distances. For me cost was distance in this example.

Finally – because this is all going to end up in QGIS – I exported it out and symbolized the data.

Selection_194

I talk a lot about open source software. The killer on this one – it’s not *really* tied into QGIS…or PostGIS….it’s in GRASS and people will at times run the other way. GRASS is older software – it’s capable software but the interface is a bit of a throwback to a more fun time in GIS. Network Analyst is sexier – BUT – does that really matter if you need an answer.

Things you need to worry about:

  • snap your data – make sure everything is connected. I didn’t the first time and I had a lot of breaks and oddness in the grass analysis. Grass is a topological piece of software. It likes for things to be snapped and clean.
  • This data had originally went from File based geodatabase to postgis into grass. I *sinned* at the end and went to shapefile.
  • Give yourself time – GRASS is different than what you are used to – but it works and it’s fast.

Anyway – that ends a short discussion on networking in Grass. I may talk about isochrones next. So if you’re a small group of emergency service providers and you are scraping together cash to buy a Geographic Information System……hopefully by me putting emergency service and GIS in there you will stumble upon this and save your self some money and maybe increase your aggravation just a hair. It’s doable though – and you might just do something very fun and cool with some free software. Selection_195

You may also like

First install of the new TN 911 Database

First install of the new TN 911 Database

If you're just tuning in I built a postgis database for the TN NG 911 project. What this has turned into is "small counties who can't/don't want to run with an ESRI solution". I posted the code up on github (and I realize every day I suck at github). So what did I...

QGIS2Web and the Hunt for Bike Lanes

QGIS2Web and the Hunt for Bike Lanes

I was teaching a QGIS class a while back and at one point the discussion drifted into "So this OpenStreetMap thing" and I discussed how I enjoy making edits. Eventually it turned to "I'm trying to get Chattanooga's Bike Lanes into it in my spare time". One thing led...

Training Classes for January 2024

Training Classes for January 2024

So I have 3 classes coming up in Mid January that I should have been talking about sooner but....December was a bit hectic. Exploring QGIS, Model Designer, and Tips and Tricks are happening. Jump over to the Support page and you'll see the info with links. I'm pretty...