Created
September 6, 2019 03:17
-
-
Save vincentsarago/ae7f6a8e85f341ae335855b44f79b4d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import click | |
import cligj | |
from shapely.geometry import shape, mapping | |
@click.command() | |
@click.pass_context | |
@cligj.features_in_arg | |
@cligj.sequence_opt | |
def centroid(ctx, features, sequence): | |
"""Get Centroid.""" | |
for f in features: | |
geom = shape(f['geometry']) | |
f['geometry'] = mapping(geom.centroid) | |
print(json.dumps(f)) | |
if __name__ == '__main__': | |
centroid() |
Author
vincentsarago
commented
Sep 6, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment