1 of 28

3차원 공간 질의 오픈소스 라이브러리 개발을 위한 몸부림

류형규

hgryoo@pnu.edu, @hg_ryoo

부산대학교

OSGeo 한국어지부 5월 기술워크샵

2018-05-26

2 of 28

2

3 of 28

3

4 of 28

3D GIS 오픈소스 소프트웨어 스택

  • 3차원 공간 데이터�
  • 3차원 공간 연산, 분석 도구
  • 3차원 공간 데이터 처리, 변환 및 저장 도구
  • 3차원 공간 데이터의 공유를 위한 도구�
  • 3차원 데이터 가시화 도구

4

GeoTools 3D

GeoServer WFS 3D

5 of 28

GeoTools / GeoServer

5

FeatureSource

DataStore

Data

Type

Query

Feature

FeatureType

Filter

Function

Expression

WFS

6 of 28

6

DBMS/File

GeoTools

GeoServer

Services/Applications

OS

Cesium/NASA World Wind/QGIS

Ubuntu/CentOS

Oracle/PostGIS

FeatureStore

(Well defined)

GML/ShapeFile...

I/O Plugins

[GeoJSON, ShapeFIle…]

DataStores

[JDBCDataStore/FileDataStore]

Query/Filter

(JTS Only)

WPS Process

(JTS Only)

SQLDialect

Data Management

[Vector, DB]

Services

[WFS, WCS, WPS, WMS]

Web Administration UI

Oracle

PostGIS

SFCGAL Extension

New DataStores

(uses ISO Geometry)

New SQLDialect, I/O Plugin

(type mapping to ISO Geometry)

New FilterFactory,

(uses SFCGAL query evaluation)

WPS Process

(new proc using ISO geometry)

GeoServer 3D Extension

XML Binidng

(JTS Only)

XML Binding

(uses ISO geometry)

WFS 1.1 Service

(uses ISO geometry)

7 of 28

7

2D

3D

8 of 28

SFCGAL (Simple Feature CGAL)?

8

공간정보표준(ISO 19017, OGC Simple Feature) 기반으로

3차원 기하연산을 지원하는 C++ 라이브러리

(http://www.sfcgal.org/)

SFCGAL

9 of 28

SFCGAL (Simple Feature CGAL)?

9

  • OGC WKT reading and writing
  • 2D and 3D intersection and union
  • 2D and 3D boolean operation
  • Convex hull
  • Tessellation
  • Extrusion
  • Area, Distance, Volume computation
  • Minkovski sums, Contour offsets, Straight skeleton

10 of 28

SFCGAL4J [Java wrapper for Simple Feature CGAL(SFCGAL)]

10

C++ Native

SFCGAL4J

Geometry, Algorithm Wrapper

Shared library (*.so)

JNI

libSFCGAL.so

libCGAL.so

Other shared libraries

JavaCPP

(https://github.com/bytedeco/javacpp)

설치

생성

11 of 28

SFCGAL4J 설치 (Ubuntu 16.04)

  • CMake >= 2.8.6, MPFR >= 2.2.1, GMP >= 4.2
    • sudo apt-get install cmake libmpfr-dev libgmp-dev -y
  • ./cppbuild.sh install
    • Boost, CGAL, SFCGAL이 자동으로 다운로드 빌드, 설정됨
  • mvn clean install
    • JavaCPP가 SFCGAL과 링크하기 위한 공유 라이브러리를 생성함

11

12 of 28

GeoTools에 연결해볼까?

12

SFCGAL4J

13 of 28

13

JTS - GeoTools/GeoServer에서 2차원 연산만을 지원하는 이유

  • JTS 라이브러리의 기하는 z 좌표는 저장할 수 있음
  • 입체(Solid) 기하와 3차원 공간 연산은 지원하지 않음

OGC::Simple Feature Access

based on

<Java Class>

JTS::Geometry

14 of 28

14

ISO 19107 spatial schema 기반 인터페이스

<Java Interface>

ISO 19107 Spatial Schema

<Java Class>

ISO 19107 Geometries

Implementation

gt-geometry

  • GeoTools에서 미지원 모듈로 ISO 19107 기하의 인터페이스와 구현을 제공함
  • 3차원 공간 연산은 지원하고 있지 않음

15 of 28

15

GeoTools 3D 기하 모듈

GeoTools 3D�ISO Geometry

Geometry

DirectPosition

Point

Curve

...

SFCGAL Converter

SFCGAL

for Java

Geometry

Algorithm

Native

shared libraries

16 of 28

16

17 of 28

17

18 of 28

18

19 of 28

Andrea Aime - 갓 오브 GeoTools 가라사대

  • ISO 19107 기하 모델… (나같아도 안쓴다.)
  • 사용자들 "C++ 네이티브 라이브러리를 싫어해" 충격!

19

C++ Native

SFCGAL4J

Java classes

Shared library (*.so)

JNI

libSFCGAL.so

libCGAL.so

Other shared libraries

JavaCPP

.jar

20 of 28

GeoTools의 지원 포맷들

20

21 of 28

21

22 of 28

그래서 실제로 3차원 공간 데이터는 어디에?

22

23 of 28

23

속성

(Attributes)

기하

(Geometry)

식별자

(Identifier)

GeoTools/GeoServer에서 표현하는

Feature

(Simple Feature)

3차원 공간 데이터에서 필요한 표현

(Complex Feature)

24 of 28

24

25 of 28

25

3D

Web Feature Service

GetFeature!

26 of 28

26

developer

developer-user

deployer

end-user

Life cycle of

Open source software

27 of 28

27

28 of 28

28