Return all data from gis pipe
This commit is contained in:
@@ -69,6 +69,10 @@ def get_pipe_risk_probability_geometries(name: str) -> dict[str, Any]:
|
||||
|
||||
with conn[name].cursor(row_factory=dict_row) as cur:
|
||||
cur.execute(f"select {key_pipeId}, ST_AsGeoJSON(geometry) AS {key_geometry} from gis_pipe")
|
||||
columns = [desc[0] for desc in cursor.description]
|
||||
columns.remove(key_pipeId)
|
||||
columns.remove(key_geometry)
|
||||
|
||||
for record in cur:
|
||||
id = record[key_pipeId]
|
||||
geom = json.loads(record[key_geometry])
|
||||
@@ -78,6 +82,9 @@ def get_pipe_risk_probability_geometries(name: str) -> dict[str, Any]:
|
||||
'end': geom['coordinates'][1]
|
||||
}
|
||||
|
||||
for col_name, value in zip(columns, record):
|
||||
pipe_risk_probability_geometries[id][col_name] = value
|
||||
|
||||
print(len(pipe_risk_probability_geometries))
|
||||
|
||||
return pipe_risk_probability_geometries
|
||||
Reference in New Issue
Block a user