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

FOSS4G Nashville 2022

For Posterity - here is the schedule for the FOSS4G event In Nashville. It's weird - I finally did some digging and this is the 4th Event I've run. We did one other meeting in Huntsville that I was half way involved in. We were talking last night at Jackelope Brewing...

ESRI’s File Based Geodatabase and QGIS

With QGIS 3.28.1 being released you get this one new thing that I thought I'd never see. Way back in June (2022) this popped up on twitter: Yes - GDAL 3.6 would have the ability to edit ESRI File Based Geodatabases. Back in 2014 GDAL gained the ability to read an ESRI...

Advertising and the Great Tweet

Business. It's complicated. One of the more complicated things I've done has been advertising. How do you advertise a small GIS Consulting Shop? Ads on "The Internet"? Magazine? Direct Mailings? Word of mouth? The answer is "word of mouth". That and Conferences. That...