Skip to content

Commit

Permalink
Allow multiple geoms on destinations
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerrecneps committed May 23, 2020
1 parent 8252b61 commit 71649d9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pybna/destinationcategory.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ def __init__(self,config,db_connection_string,workspace_schema=None):
id_column = self.get_pkid_col(table,schema=schema)

if "geom" in config:
geom_col = config.geom
if isinstance(config.geom, str):
geom_col = sql.Identifier(config.geom)
else:
cols = [sql.Identifier(c) for c in config.geom]
geom_col = sql.SQL("COALESCE(") \
+ sql.SQL(",").join([sql.Identifier(c) for c in config.geom]) \
+ sql.SQL(")")
else:
geom_col = "geom"
geom_col = sql.SQL("geom")

if "filter" in config:
filter = sql.SQL(config.filter)
Expand All @@ -81,7 +87,7 @@ def __init__(self,config,db_connection_string,workspace_schema=None):
}

if config["method"] == "count":
self.sql_subs["destinations_geom_col"] = sql.Identifier(geom_col)
self.sql_subs["destinations_geom_col"] = geom_col
elif config["method"] == "percentage":
self.sql_subs["val"] = sql.Identifier(config["datafield"])
else:
Expand Down

0 comments on commit 71649d9

Please sign in to comment.