Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pvt_offset = 0
mrf_dom = build_mrf_dom(tile_matrices, target_extents, tile_size, proj)
with open(os.path.join(output_path, mrf_prefix) + '.mrf', 'w+') as f:
f.write(mrf_dom.toprettyxml())
spatial_dbs = []
source_schemas = []
# Dump contents of shapefile into a mutable rtree spatial database for faster searching.
for input_file in input_file_path:
print 'Processing ' + input_file
with fiona.open(input_file) as shapefile:
try:
spatial_db = rtree.index.Index(
rtree_index_generator(list(shapefile), filter_list))
except rtree.core.RTreeError as e:
print 'ERROR -- problem importing feature data. If you have filters configured, the source dataset may have no features that pass. Err: {0}'.format(
e)
sys.exit()
spatial_dbs.append(spatial_db)
source_schema = shapefile.schema['geometry']
source_schemas.append(source_schema)
if debug:
print 'Points to process: ' + str(
spatial_db.count(spatial_db.bounds))
# Build tilematrix pyramid from the bottom (highest zoom) up. We generate tiles left-right, top-bottom and write them
# successively to the MRF.
for i, tile_matrix in enumerate(reversed(tile_matrices)):
z = len(tile_matrices) - i - 1
for idx, spatial_db in enumerate(spatial_dbs):