whosonfirst / py-mapzen-whosonfirst-export

Export tools for the Who's On First documents
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Add opt_parser.add_option to wof-exportify to update all records in given directory #5

Closed stepps00 closed 8 years ago

stepps00 commented 8 years ago

Currently, the wof-exportify tool updates a single record based on the given ID. It would be helpful to add an additional opt_parser.add_option function to the wof:exportify tool that updates all .geojson records in a given directory or folder. This would be useful in cases where we create a new alt-geometry.geojson that needs Exportifying.

Currently, the command to Exportify the main .geojson file in the /whosonfirst-data/data/858/373/17 directory would look like:

wof-exportify -s /usr/local/mapzen/whosonfirst-data/data/ -i 85837317

To update all .geojson files (main and alt-geometry files), a possible new command could look something like:

wof-exportify -s /usr/local/mapzen/whosonfirst-data/data/ -a 85837317

https://github.com/whosonfirst/py-mapzen-whosonfirst-export/blob/master/scripts/wof-exportify#L37

stepps00 commented 8 years ago

Should substitute line 37 with:

if options.alt: feature = mapzen.whosonfirst.utils.load(source, id, alt=options.alt) else: feature = mapzen.whosonfirst.utils.load(source, id)

And add the following to line 20:

opt_parser.add_option('-a', '--alt', dest='alt', action='store', default=None, help='')

nvkelso commented 8 years ago

Looks like this can be closed now?

dphiffer commented 8 years ago

Yeah, I think so! Please reopen if the alt geometry option gives you any trouble, @stepps00.

stepps00 commented 8 years ago

Will do!