Skip to content

Commit

Permalink
write node coords as lat/long in project cards #135
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-sijia committed Apr 18, 2022
1 parent 7aa12da commit f12d591
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/cube/st_paul_test.log
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ L,A,0,3230,3262,999998,5,0,4,0,0,0,0,0,0,0,5,1,0,40,3,1,1,1,0,0.10462,0
L,A,0,3262,3230,999997,5,0,4,0,0,0,0,0,0,0,5,1,0,40,3,1,1,1,0,0.10462,0
L,D,0,3261,131209,281,5,0,4,0,0,0,0,0,0,0,5,1,0,40,3,1,1,1,0,0.10462,0
L,D,0,178775,42542,477533,5,0,4,0,0,0,0,0,0,0,5,1,0,40,3,1,1,1,0,0.10462,0
N,A,0,354388,-93.18389,44.96898,"",1,0,0,0
N,A,0,354388,485498.84,4979520.93,"",1,0,0,0
1 change: 1 addition & 0 deletions lasso/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ def __init__(self, **kwargs):
)
self.output_dir = os.path.join(self.scratch_location)
self.output_epsg = 26915
self.wrangler_epsg = 4269

"""
Create all the possible headway variable combinations based on the cube time periods setting
Expand Down
18 changes: 17 additions & 1 deletion lasso/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,24 @@ def _process_node_additions(node_add_df):
if len(node_add_df) == 0:
WranglerLogger.debug("No node additions processed")
return []

WranglerLogger.info("Reprojecting node coordinates from model CRS to standard CRS")
if 'X' in node_add_df.columns:
node_add_df = gpd.GeoDataFrame(
node_add_df,
geometry = gpd.points_from_xy(
node_add_df['X'],
node_add_df['Y']
),
crs = "EPSG:" + str(self.parameters.output_epsg)
)

# convert to WGS 84
node_add_df = node_add_df.to_crs(epsg=self.parameters.wrangler_epsg)
node_add_df['X'] = node_add_df['geometry'].apply(lambda g: g.x)
node_add_df['Y'] = node_add_df['geometry'].apply(lambda g: g.y)

add_nodes_dict_list = node_add_df.drop(["OPERATION_final"], axis=1).to_dict(
add_nodes_dict_list = node_add_df.drop(["OPERATION_final", "geometry"], axis=1).to_dict(
"records"
)
WranglerLogger.debug("{} Nodes Added".format(len(add_nodes_dict_list)))
Expand Down

0 comments on commit f12d591

Please sign in to comment.