Skip to content

Commit

Permalink
Quieter output, and add option to force regen summary data
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Crocker committed Jan 15, 2019
1 parent 7c32bef commit 4009a59
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion geoutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def get_union(geojson):
if not s.is_valid:
logger.error("Invalid geometry in get_union, failed to fix")
else:
logger.warning("Invalid geometry in get_union. Fixed.")
pass
# logger.warning("Invalid geometry in get_union. Fixed.")
if s and s.is_valid:
#get rid of holes
if type(s) in (MultiPolygon, GeometryCollection):
Expand Down
6 changes: 4 additions & 2 deletions process.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
@click.argument('sources', type=click.Path(exists=True), required=True)
@click.argument('output', type=click.Path(exists=True), required=True)
@click.option('--force', is_flag=True)
def process(sources, output, force):
@click.option('--force-summary', is_flag=True)
def process(sources, output, force, force_summary):
"""Download sources and process the file to the output directory.
\b
Expand Down Expand Up @@ -158,7 +159,8 @@ def process(sources, output, force):
}
catalog_features.append(catalog_entry)

if not read_existing \
if force_summary or \
not read_existing \
or not os.path.exists(outdir) \
or not os.path.exists(os.path.join(outdir, "units.json")) \
or not os.path.exists(os.path.join(outdir, "source.json")):
Expand Down
2 changes: 1 addition & 1 deletion requirements-validate.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
click==5.1
jsonschema==2.5.1
requests==2.8.1
ujson==1.33
ujson==1.35
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def read_json(path):

def write_json(path, data):
with open(path, 'w') as jsonfile:
jsonfile.write(ujson.dumps(data, double_precision=5))
jsonfile.write(ujson.dumps(data, escape_forward_slashes=False, double_precision=5))


def make_sure_path_exists(path):
Expand Down
3 changes: 1 addition & 2 deletions vectorTiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def vectorTiling(output, sources, catalog, min_zoom, max_zoom, layer):
command = (
'tippecanoe -o ' + output +
' ' + " ".join(source_paths) +
' --no-progress-indicator ' +
' --no-polygon-splitting ' +
'--coalesce --reverse --reorder ' + # try really hard to coalesce polygons with the same properties
'--detect-shared-borders ' + # Avoid small gaps between polygons when simplifying
Expand All @@ -60,6 +61,4 @@ def vectorTiling(output, sources, catalog, min_zoom, max_zoom, layer):
subprocess.call(command,shell=True)

if __name__ == '__main__':

vectorTiling()

0 comments on commit 4009a59

Please sign in to comment.