Commit 6628652f authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

compact geojson files reducing float precision

parent 72da942b
Pipeline #1795 passed with stages
in 147 minutes and 34 seconds
......@@ -4,9 +4,11 @@
"""
import argparse
import io
import ujson as json
from pathlib import Path
import sqlite3
from pathlib import Path
import ujson as json
import metrics_common as mc
GEOJSON_HEADER = """
......@@ -40,7 +42,6 @@ def compute_description(row, met_cursor):
def manage_geom(geo_string):
""" return geometry data """
# decode
return json.loads(geo_string)
......@@ -60,7 +61,7 @@ def output_feature(fd, row, metrics_cursor):
'geometry': manage_geom(row['coords']),
}
fd.write(json.dumps(feature_data, ensure_ascii=False, indent=2, sort_keys=True))
fd.write(json.dumps(feature_data, ensure_ascii=False, sort_keys=True, double_precision=2))
def generate_geojson_file(category, conn, geojson_filepath: Path):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment