0

I know similar questions have been asked several times, but none of the solutions seems suitable for my problem or don't work..

I computed flowlines using the r.flow tool from GRASS GIS, then I export these using v.out.ogr which gives me the files flowlines.dbf, flowlines.prj, flowlines.shp and flowlines.shx. The image shows the figure in GRASS of my flowlines over a DEM.

enter image description here

Now I need to read this shapefile into python and reproduce that same image in python. To read the file I downloaded the shapefile module, which seems to work fine, but after that I'm lost. I was told to use fiona module by a friend but it doesnt want to install on my ubuntu machine, not sure what's the problem, so a solution without fiona would be great..

Does anyone have good advice?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Sep 1, 2015 at 7:22

1 Answer 1

2

1) you don't need to export a shapefile. With the Python module GDAL (osgeo) you can read directly the layer from the GRASS folders hierarchy (look at GRASS 6 terminology)

from osgeo import ogr
# open the Grass layer shape1
ds = ogr.Open('/Users/grassdata/geol/MNT/vector/shape1/head')
layer = ds.GetLayer(0)
...

2) If you want to read the shapefile, you can use different modules -> look at Is it possible to look at the contents of Shapefile using Python without an ArcMap license?

answered Sep 1, 2015 at 11:29
1

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.