에이블스쿨 DX커리큘럼 - GeoPandas(단계구분도를 그려보자 1)
공모전도 나가고, 코딩교육을 받다 보니 지도 관련해서 코딩을 해야하는 상황이 많았습니다.
하지만 교육과정에서는 알려주지 않았기에... 동기 에이블러님께 배운 내용을 공유하고자 합니다.

장훈햄 감사합니다!!

GeoPandas의 경우 geographic과 pandas의 합성어. 컴퓨터 지도구현을 위해 pandas 형태로 만들어진 프로그램입니다.
folium를 구체화하기 위해 꼭 필요한 기능이라고 생각하면 좋겠다.
● 설치
설치 오류 잡는데만 사흘이 걸렸습니다............
(https://codedragon.tistory.com/9556 를 참고했습니다)
꼭! 순서대로 진행해야 합니다!!!
1. python 버전 확인
2. 프로그램 다운로드
3. pyproj 설치
4. Shapely 설치
5. GDALL 설치
6. Fiona 설치
7. Geopandas 설치
1. python 버전 확인
말 그대로 python 버전을 확인합니다. 저는 anaconda prompt에서 python --version을 통해 버전을 확인했습니다.
또한, window x64인지, x32인지 확인이 필요합니다.
이후 설치하는 모든 파일은 python 버전과 window 버전에 맞춰서 설치가 필요합니다.
예시로, python 3.7.1버전이라면 cp37을 받아주시면 됩니다.
2. 프로그램 다운로드
Shapely, GDALL, Fiona, Geopandas
https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely
Archived: Python Extension Packages for Windows - Christoph Gohlke
Archived: Python Extension Packages for Windows - Christoph Gohlke by Christoph Gohlke. Updated on 26 June 2022 at 07:27 UTC. This page provides 32 and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython
www.lfd.uci.edu
https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
Archived: Python Extension Packages for Windows - Christoph Gohlke
Archived: Python Extension Packages for Windows - Christoph Gohlke by Christoph Gohlke. Updated on 26 June 2022 at 07:27 UTC. This page provides 32 and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython
www.lfd.uci.edu
https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona
Archived: Python Extension Packages for Windows - Christoph Gohlke
Archived: Python Extension Packages for Windows - Christoph Gohlke by Christoph Gohlke. Updated on 26 June 2022 at 07:27 UTC. This page provides 32 and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython
www.lfd.uci.edu
https://pypi.org/project/geopandas/#files
geopandas
Geographic pandas extensions
pypi.org
를 버전에 맞게 다운로드합니다.
3 ~ 7 설치
anaconda prompt에서 진행합니다.
C:\User> pip install pyproj
C:\User> pip install Shapely-1.7.1-cp38-cp38-win_amd64.whl
C:\User> pip install GDAL-3.1.4-cp38-cp38-win_amd64.whl
C:\User> pip install Fiona-1.8.18-cp38-cp38-win_amd64.whl
C:\User> pip install geopandas-0.8.1-py2.py3-none-any.whl
이후 파이썬이 잘 돌아가는지 확인합니다.
● 확장자
geopandas 활용 및 이용을 위해선 shp, prj, dbf, shx라는 4가지 파일이 필요합니다.
shp는 shape
prj는 좌표
dbf는 속성데이터
shx는 공간 인덱스 파일
위 파일들은 모두 같은 경로에 설치가 필요합니다. 우리나라의 경우 이러한 파일 정비가 비교적 잘 되어있는 편으로,
국토정보플랫폼 https://map.ngii.go.kr/ms/map/NlipMap.do?tabGb=statsMap
대한민국 최신 행정구역 http://www.gisdeveloper.co.kr/?p=2332
등의 경로에서 파일 다운로드가 가능합니다.
● 좌표계
CRS(Coordinate Reference System)으로, 도대체 왜인지는 모르겠는데 종류가 많습니다.
그래서 공간좌표계를 일치시켜야 하는 경우가 많이 생기는데, 공간좌표계는 다음과 같습니다.
| BESSEL 경/위도 | EPSG:4004, EPSG:4162 |
| WGS84 경/위도 | EPSG:4326, EPSG:4166 |
| 서부원점(GRS80) | EPSG:5185 |
| 중부원점(GRS80) | EPSG:5181, EPSG:5186 |
| 동부원점(GRS80) | EPSG:5187 |
| 동해(울릉)원점(GRS80) | EPSG:5188 |
| UTM-K (GRS80) | EPSG:5179 |
| Google Mercator | EPSG:900913 |
여기서 기준은 ESPG:4326(경위도)이며, 네이버지도의 경우 ESPG:5179, 카카오맵은 ESPG:5181 입니다.
* ESPG정보가 없는 괘씸한 파일들이 간혹 있는데, 변수명.to_crs('ESPG:X')를 통해 X값으로 ESPG설정이 가능합니다.*
1부는 여기까지!