This is related to a previous question I've asked: Create filled contour map with GRASS
I've created a point layer using OpenStreetMap data and pgRouting's driving_distance() function, where the points contain a cost attribute which contains the walking distance from a school. I've used QGIS and the contour plugin to create what I want:
However I'd now like to do this programmatically for a web app, and in addition result in polygons rather than a raster. I've got something working using GRASS, however it is quite slow, around 30 secs on my machine versus less than 1 sec using QGIS and the contour plugin. Here the short version (or see Python version):
# read file and set resolution and bounds v.in.ogr dsn=cost_points.shp output=cost_points g.region vect=cost_points rows=256 cols=256 # interpolate points and make bands of 0.4km increments v.surf.rst input=cost_points elev=interp zcolumn=cost r.mapcalc res='int(interp/0.4)' # convert to polygons and write out file r.to.vect -s input=result output=polys feature=area v.out.ogr -c input=polys dsn=polys.shp type=area
Are there other GRASS functions I should use? r.surf.rst takes the majority of the time, so perhaps it is too robust for my needs, but even then the results aren't smooth enough for my liking. Are there other open source libraries I should be considering for this?
If you'd like to know more about my overall goals, see this page.