Commit a2771370 authored by Nicolas Garcia Ospina's avatar Nicolas Garcia Ospina
Browse files

Commented on Albers equal area projection and csv importer

parent ce399b57
Pipeline #23017 passed with stage
in 4 minutes and 16 seconds
......@@ -28,6 +28,16 @@ logger = logging.getLogger(__name__)
class ImportCSV:
@staticmethod
def csv2postgis(database, csv_filepath, tablename):
"""
Reads a CSV file and inserts it into a given database table with psycopg2.
Args:
database (database.Database): Database instance with credentials and
connection ready to perform data importing.
csv_filepath (str): Path name for the csv file to be imported.
tablename (str): Table name within database for import
"""
with open(csv_filepath, "r") as file:
reader = csv.reader(file)
......
......@@ -176,9 +176,12 @@ class TileProcessor:
)
input_polygon = transform(project.transform, input_polygon)
# Get the bounding box of the polygon and sort latitudes and longitudes
bbox = input_polygon.bounds
minx, maxx = sorted([bbox[0], bbox[2]])
miny, maxy = sorted([bbox[1], bbox[3]])
# Use the resulting coordinates to perform the transformation
project_aea = pyproj.Proj(
"+proj=aea +lat_1={} +lat_2={} +lat_0={} +lon_0={}".format(
miny, maxy, (miny + maxy) / 2.0, (minx + maxx) / 2.0
......
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