Skip to content

Commit

Permalink
Adds info subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
freespace committed Dec 15, 2018
1 parent 7781567 commit e43e939
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions shputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ def list_fields(shp_file):
ftype_desc_tab[ftype],
flen))

@shp_util.command()
@click.argument('shp_file', type=click.Path(dir_okay=False))
def info(shp_file):
"""
Prints metadata about the shp_file.
"""
with shapefile.Reader(shp_file) as sf:
print('Shape type:', sf.shapeTypeName)
print('Number of records:', len(sf))

if __name__ == '__main__':
import sys
Expand Down

0 comments on commit e43e939

Please sign in to comment.