๋ฐ์ํ
*์ฐธ๊ณ reference : https://postgis.net/docs/ST_Centroid.html
[SQL]
select
ST_ASGEOJSON(ST_CENTROID(ST_TRANSFORM(${geometry์ด}, ${Coordinate})))
from
๋ ์ด์ดํ ์ด๋ธ
where
์กฐ๊ฑด์
[์ฌ์ฉ ๋ฐฉ๋ฒ]
- ST_Centroid (Geometry g1)
cf. ST_PointOnSurface (Geometry g2) ๋ ์์.
[(๋ด๊ฐ ์ดํดํ) ๋ ๋ฉ์๋์ ์ฐจ์ด์ ]
ST_Centroid : MultiPolygon์ ํน์ฑ์ ๊ณ์ฐ์ ํตํด ์ค์ฌ์ ์ ์ก์์ ๊ฒฝ์ฐ ์ค์ Area ์์ญ ์ด์ธ์ Center๊ฐ ์กํ ์ ์์
(์จ์ ํ ๋ค๊ฐํ์ ๋ชจ์์ด ์๋ ๊ฒฝ์ฐ)
ST_PointOnSurface : ์ค์ Area ์์ญ ์ด๋ด์ Center ๊ฐ์ด ์กํ๊ฒ ๋ณด์ ํ๋ ๊ฒ
[์ฐธ๊ณ ]
1. ST_AsGeoJSON(Geometry g1)
- ํ์ฌ Geometry๋ฅผ GeoJson ํํ๋ก ๋ณํํ๋ ํจ์
2. ST_Transform (Geometry g1, Coordinate)
- ํ์ฌ Geometry๋ฅผ Coordinate์ ์ขํ๊ณ๋ก ๋ณํํ ๊ฐ์ ๋ฐํํ๋ ํจ์
๋ฐ์ํ
'๐บ GIS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Geoserver] Java Considerations ๋ถ๋ถ ๋ฒ์ญ (1) | 2019.01.02 |
---|---|
๋ฒ์ ๋ vs ํ์ ๋ (0) | 2018.05.21 |