|
|
@ -2,14 +2,17 @@
|
|
|
|
Converts .csv files to .shape files
|
|
|
|
Converts .csv files to .shape files
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
from fiona.crs import from_epsg
|
|
|
|
import click
|
|
|
|
import fiona
|
|
|
|
import fiona
|
|
|
|
from shapely.geometry import Point, mapping
|
|
|
|
|
|
|
|
from fiona import collection
|
|
|
|
|
|
|
|
import pandas as pd
|
|
|
|
import pandas as pd
|
|
|
|
import os
|
|
|
|
from fiona.crs import from_epsg
|
|
|
|
|
|
|
|
from shapely.geometry import Point, mapping
|
|
|
|
|
|
|
|
|
|
|
|
def sites_csv_to_shp(input_csv='.\data\interim\sites.csv', output_shp='.\data\interim\sites.shp'):
|
|
|
|
|
|
|
|
|
|
|
|
@click.command()
|
|
|
|
|
|
|
|
@click.argument('input_csv')
|
|
|
|
|
|
|
|
@click.argument('output_shp')
|
|
|
|
|
|
|
|
def sites_csv_to_shp(input_csv, output_shp):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Converts our dataframe of sites to .shp to load in QGis
|
|
|
|
Converts our dataframe of sites to .shp to load in QGis
|
|
|
|
:param input_csv:
|
|
|
|
:param input_csv:
|
|
|
@ -34,5 +37,12 @@ def sites_csv_to_shp(input_csv='.\data\interim\sites.csv', output_shp='.\data\in
|
|
|
|
}
|
|
|
|
}
|
|
|
|
output.write({'geometry': mapping(point), 'properties': prop})
|
|
|
|
output.write({'geometry': mapping(point), 'properties': prop})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@click.group()
|
|
|
|
|
|
|
|
def cli():
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sites_csv_to_shp()
|
|
|
|
cli.add_command(sites_csv_to_shp)
|
|
|
|
|
|
|
|
cli()
|
|
|
|