라벨이 SpatiaLite인 게시물 표시

SpatiaLite and Java

이미지
오늘은 SQLite 및 SpatiaLite 3번째로 초간단 SpatiaLite 사용법 및 이를 Java 클래스에서 사용하는 방법을 알아보도록 합니다. 우선 아래 두 링크를 확인/설치 후 진행하도록 하세요. 그리고 아래 샘플데이터 받아서 테스트하시면 됩니다. 1. SQLite 개요 및 사용 2. SpatiaLite 개요 및 사용 3. SpatiaLite and Java 3.1 SpatiaLite 사용법 ▣ SQLite Command SpatiaLite Extension을 사용하기 위해서는 다음 command나 query를 이용하면 된다. 만약 라이브러리를 찾을 수 없다고 나오면 해당 파일이 설치되어 있는지 확인 또는 환경변수에 설치된 폴더를 Path에 등록, 이것도 귀찮으면 SQLite 및 SpatiaLite 관련 라이브러리를 윈도우즈 시스템 폴더에 복사하면 된다. .load 'libspatialite-2.dll'  또는 SELECT load_extension('libspatialite-2.dll') ▣ SpatiaLite Command SQLite Command와 같은 환경이면서 extension 을 따로 load할 필요 없다. 아래 그림 참조... ※ SpatiaLite Quick Tutorial은 여기( A quick tutorial to SpatiaLit e)서 참고 ▣ SpatiaLite GUI 및 GIS SpatiaLite GUI 에서 Shapefile을 Load하는 방법은 다음과 같다. [Files] - [Advanced] - [Load Shapefile] 메뉴 실행 후 Shapefile 선택하면 아래 등록 창 표시 SRID(좌표체계, 아래 4326은 WGS84 경위도좌표체계) 및 Charset Encoding(아래처럼 CP949 선택하면 됨) 선택 후 OK 눌러 Load. ※ 샘플 데이터  - continent polygon 및 earthquake point dataset sample...

SpatiaLite 개요 및 사용

이미지
PostgreSQL 에 PostGIS 가 있다면 SQLite 에는 SpatiaLite 가 있습니다. PostGIS와 마찬가지로 Geometry Engine은 GEOS(3.2.0), 좌표변환은 PROJ.4(4.7.0) 를 사용하고 있습니다.  PostGIS보다 경량이면서 속도면에서는 빠르군요.. PostGIS를 사용해본 사람이라면 금방 익숙해질 수 있을 것 같네요 . 단, PG와는 Spatial Function 이름들이 약간씩 다릅니다.(ST_가 없으나 2.4버전 이후로는 OGC ST_ 이름을 지원합니다). 라이센서는 각각의 프로그램마다 다릅니다. ▣ SpatiaLite 공식 사이트  - http://www.gaia-gis.it/spatialite/  - 2010년 6월 30일 현재 버전 2.4.0 ▣ 주요 기능  *  SQLite is a popular DBMS, simple, robust, easy to use and really lightweight   * each SQLite database is simply a file; you can freely copy it, compress it, send it on a LAN or WEB with no complication at all  They are also portables; the same database file will work on Windows, Linux, MacOs etc  * the SpatiaLite extension enables SQLite to support spatial data too [aka GEOMETRY], in a way conformant to OpenGis specifications    o supports standard WKT and WKB formats    o implements SQL spatial functions such as AsText(), Geom...