I am relatively new to coding, but I am using fiona within python and would like to print the coordinates that make up the points of the polygon to later add to a separate list. However I am having a hard time printing just the coordinates, I do not wish to print the id, type, properties etc... My current code prints the points as well as the type, I would like it to print without the type. Is there a simple way to do this?

output_polygons = []  
with fiona.open(input_shp) as polygons:  
    for polygon in polygons:  

Try print polygon['geometry']['coordinates'] instead of pprint.pprint(polygon['geometry'])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.