从 PostGIS 中的 BBOX 坐标创建多边形几何
Create polygon geometry from BBOX coordinates in PostGIS
我有一个 table mytable
,其坐标表示对象的 Bounding BOX 作为列 geom_bbox
中的文本字符串,如 "548477,6591107,548493,6591121"
。 EPSG3301 中的坐标(以米为单位)。我想创建一个多边形几何体,一个使用这些坐标的矩形几何体。
更多示例坐标:
"548477,6591107,548493,6591121"
"545827,6587929,545864,6588021"
"539646,6586576,539694,6586621"
"549054,6594762,549101,6594811"
"547131,6589014,547182,6589046"
"547131,6589014,547182,6589046"
PostGIS 可以吗?
如果您只有边界框,请使用函数 ST_MakeEnvelope. This function creates a rectangle from 4 coordinates (2 points). First split the text with string_to_array 然后将结果用作坐标:
SELECT ST_MakeEnvelope(arr[1]::double precision,
arr[2]::double precision,
arr[3]::double precision,
arr[4]::double precision,
3301)
FROM (SELECT string_to_array(geom_bbox,',') AS arr FROM mytable) as foo;
我有一个 table mytable
,其坐标表示对象的 Bounding BOX 作为列 geom_bbox
中的文本字符串,如 "548477,6591107,548493,6591121"
。 EPSG3301 中的坐标(以米为单位)。我想创建一个多边形几何体,一个使用这些坐标的矩形几何体。
更多示例坐标:
"548477,6591107,548493,6591121"
"545827,6587929,545864,6588021"
"539646,6586576,539694,6586621"
"549054,6594762,549101,6594811"
"547131,6589014,547182,6589046"
"547131,6589014,547182,6589046"
PostGIS 可以吗?
如果您只有边界框,请使用函数 ST_MakeEnvelope. This function creates a rectangle from 4 coordinates (2 points). First split the text with string_to_array 然后将结果用作坐标:
SELECT ST_MakeEnvelope(arr[1]::double precision,
arr[2]::double precision,
arr[3]::double precision,
arr[4]::double precision,
3301)
FROM (SELECT string_to_array(geom_bbox,',') AS arr FROM mytable) as foo;