라벨이 java인 게시물 표시

[GeoTools]GridCoverage Statistics

GeoTools 에서 GridCoverage(Raster)의 단순통계를 계산하는 Java 샘플 코드입니다.  - JAI의 RectIter 인터페이스를 이용하여 계산  - AWT의 RenderedImage인터페이스를 이용하여 계산  - 단일 밴드에 대한 샘플입니다. ▣ Code Snippet import java . awt . image . Raster ; import java . awt . image . RenderedImage ; import java . text . DecimalFormat ; import javax . media . jai . PlanarImage ; import javax . media . jai . iterator . RectIter ; import javax . media . jai . iterator . RectIterFactory ; import org . geotools . coverage . grid . GridCoverage2D ; import org . geotools . coverage . grid . GridEnvelope2D ; ■ JAI(Java Advanced Imaging): RectIter Interface static void calculateStatistics1(GridCoverage2D inputGc) { int count = 0 ; double minVal = Double . MAX_VALUE ; double maxVal = Double . MIN_VALUE ; double sumOfVals = 0.0 ; double sumOfSqrs = 0.0 ; double noDataValue = ( Double ) inputGc . getProperty ( "GC_NODATA" ) ; PlanarImage renderedImage = ...

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...

SQLite 개요 및 사용

이미지
SQLite는 단일 파일 기반이면서 SQL92를 지원하는 경량의 DB ▣ SQLite 공식사이트  - http://www.sqlite.org  - 버전 : 2010년 6월 30일 현재 3.6.23.1 ▣ Features Of SQLite  * Transactions are atomic, consistent, isolated, and durable ( ACID ) even after system crashes and power failures.   * Zero-configuration - no setup or administration needed.  * Implements most of SQL92. (Features not supported)  * A complete database is stored in a single cross-platform disk file.  * Supports terabyte-sized databases and gigabyte-sized strings and blobs. (See limits.html.)  * Small code footprint: less than 300KiB fully configured or less than 180KiB with optional features omitted.  * Faster than popular client/server database engines for most common operations.  * Simple, easy to use API.  * Written in ANSI-C. TCL bindings included. Bindings for dozens of other languages available separately.  * Well-commented source code with 100% branch test coverage.  * Available...

JTS Topology Suite - Geometry Engine

이미지
현 Java 기반 Open Source GIS에서 거의 대부분 사용하고 있는 Geometry Engine은 JTS( JTS Topology Suite - Java API for geometric operations)입니다. JTS는 C++ 포팅버전인 GEOS(Geometry Engine - Open Source) , .NET C# 버전 NTS(Net Topology Suite) 의 전신이기도 합니다. 현재(2010년 3월 1일 기준) 1.11 버전이 Release되어 있으며 다음의 URL에서 최신버전이나 정보를 확인할 수 있습니다. ▣ JTS Topology Suite  - Tsusiat Software  - Martin Davis's Blog  : Lin.ear th.inking  - VIVID Solutions 특히 Martin Davis의 Blog Title이 정말 멋집니다... Lin.ear th.inking - Because the shortest distance between two thoughts is a straight line ▣ JTS를 활용하는 Open Source GIS 및 JTS의 위상 <그림출처: http://www.osgeo.org/files/tyler/images/siglibre_foss_sig_relacion.png>