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'])

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

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.