- Release plans recap for the road to QGIS 1.0
- New version of eVis
- Contour Lines in Qgis
- QGIS and Google Summer of Code
- Quantum GIS Graduates OSGeo Incubation
- Paolo Cavallini Named to QGIS Project Steering Committee
- Nominations for QGIS PSC Open
- Capturing map coordinates in a stand alone app...
- Tutorial 7 - Creating spatial datasets with the QGIS API
- Html Image Plugin 0.2
Contour Lines in Qgis
Submitted by spacedman on Sat, 2008-04-26 12:12.What with the GSoC project and all the other general discussion about analysis tools in QGis, I got somehow sidetracked into pondering how to do contour maps in QGis. There's the hard way: writing a bunch of C++ code to implement a contouring algorithm, then hooking that into QGis and into the GUI for raster drawing properties. Ah, no.
So quick hackery time. Take a raster data set into R, use R's contour() function to get a list of contour lines and heights, then convert that into a SpatialLinesDataFrame using functions in the "sp" package, then convert that to a shapefile of lines using functions in the "rgdal" package. Load resulting shapefile into QGis and look at the pretty contour lines. Style to taste. See attached screenshot (if it uploads ok).
It's far from perfect - when R draws contour plots it puts the labels on the contour lines in a very nice way. Fiddling with line labelling in QGis couldn't get me that effect. Eventually I might package this up as a plugin, but for now I'll just have to leave you to bash your own code together to do this!
It did get me thinking about other "transformative" plugins though - from polygons to point-centroids, from points to voronoi polygons and so forth. Maybe these can be done via GRASS, but it might interesting to implement them using Shapely...
Okay I think that qualifies as rambling enough...
| Attachment | Size |
|---|---|
| contours.png | 68.37 KB |
- spacedman's blog
- Add new comment
- 3471 reads

Recent comments
1 day 11 hours ago
1 day 13 hours ago
1 day 16 hours ago
1 day 17 hours ago
3 days 9 hours ago
2 weeks 1 day ago
3 weeks 1 day ago
3 weeks 1 day ago
4 weeks 5 days ago
4 weeks 6 days ago