【发布时间】:2021-12-22 05:16:40
【问题描述】:
我在下面发布了数据库表。两列geometryOfCellRepresentativeToTreatment 和geometryOfCellRepresentativeToBuffer 是几何类型。并且它们的值等于列的几何形状fourCornersRepresentativeToTreatmentAsGeoJSON_
和fourCornersRepresentativeToBufferAsGeoJSON 分别。
如何将值作为前列的几何形状插入到后列中
表格:
CREATE TABLE grid_cell_data (
id SERIAL PRIMARY KEY,
isTreatment boolean,
isBuffer boolean,
fourCornersRepresentativeToTreatmentAsGeoJSON text,
fourCornersRepresentativeToBufferAsGeoJSON text,
distanceFromCenterPointOfTreatmentToNearestEdge numeric,
distanceFromCenterPointOfBufferToNearestEdge numeric,
areasOfCoveragePerWindowForCellsRepresentativeToTreatment numeric,
areasOfCoveragePerWindowForCellsRepresentativeToBuffer numeric,
averageHeightsPerWindowRepresentativeToTreatment numeric,
averageHeightsPerWindowRepresentativeToBuffer numeric,
geometryOfCellRepresentativeToTreatment geometry,
geometryOfCellRepresentativeToBuffer geometry)
data_to_be_inserted:
isTreatment = True//boolean
isBuffer = False //boolean
fourCornersRepresentativeToTreatmentAsGeoJSON_ = json.dumps(fourCornersOfKeyWindowAsGeoJSON[i])//string
fourCornersRepresentativeToBufferAsGeoJSON_ = None//string
distanceFromCenterPointOfTreatmentToNearestEdge_ = distancesFromCenterPointsToNearestEdge[i]
distanceFromCenterPointOfBufferToNearestEdge_ = None
areasOfCoveragePerWindowForCellsRepresentativeToTreatment_= areasOfCoveragePerWindow[i]
areasOfCoveragePerWindowForCellsRepresentativeToBuffer_ = None
averageHeightsPerWindowRepresentativeToTreatment_ = averageHeightsPerWindow[i]
averageHeightsPerWindowRepresentativeToBuffer_ = None
geometryOfCellRepresentativeToTreatment_ = //geometry of fourCornersRepresentativeToTreatmentAsGeoJSON_
geometryOfCellRepresentativeToBuffer_ = //geometry of fourCornersRepresentativeToBufferAsGeoJSON_
图片
【问题讨论】:
标签: sql postgresql sql-update postgis