空间数据模型
(1)、JTS Geometry model
(2)、ISO Geometry model (Geometry Plugin and JTS Wrapper Plugin)
GeoTools has two implementations of these interfaces:
Geometry Plugin a port of JTS 1.7 to the ISO Geometry interfaces
JTS Wrapper Plugin an implementation that delegates all the work to JTS
JTS包结构
系(linearref包)、计算交点(noding包)、几何图形操作(operation包)、平面图(planargraph包)、多边形化(polygnize包)、精度(precision)、工具(util包)
重点理解JTS Geometry model
(1) JTS提供了如下的空间数据类型
Point
MultiPoint
LineString
LinearRing 封闭的线条
MultiLineString 多条线
Polygon
MultiPolygon
GeometryCollection 包括点,线,面
(2) 支持接口
Coordinate
Coordinate(坐标)是用来存储坐标的轻便的类。它不同于点,点是Geometry的子类。不像模范Point的对象(包含额外的信息,例如一个信包,一个精确度模型和空间参考系统信息),Coordinate只包含纵座标值和存取方法。
Envelope(矩形)
一个具体的类,包含一个最大和最小的x 值和y 值。
GeometryFactory
GeometryFactory提供一系列的有效方法用来构造来自Coordinate类的Geometry对象。支持接口
importorg.geotools.geometry.jts.JTSFactoryFinder;importcom.vividsolutions.jts.geom.Coordinate;importcom.vividsolutions.jts.geom.Envelope;importcom.vividsolutions.jts.geom.Geometry;importcom.vividsolutions.jts.geom.GeometryCollection;importcom.vividsolutions.jts.geom.GeometryFactory;importcom.vividsolutions.jts.geom.LineString;importcom.vividsolutions.jts.geom.LinearRing;importcom.vividsolutions.jts.geom.Point;importcom.vividsolutions.jts.geom.Polygon;importcom.vividsolutions.jts.geom.MultiPolygon;importcom.vividsolutions.jts.geom.MultiLineString;importcom.vividsolutions.jts.geom.MultiPoint;importcom.vividsolutions.jts.io.ParseException;importcom.vividsolutions.jts.io.WKTReader;/*** Class GeometryDemo.java
* Description Geometry 几何实体的创建,读取操作
* Company mapbar
* author Chenll E-mail: Chenll@mapbar.com
* Version 1.0
* Date 2012-2-17 上午11:08:50*/
public classGeometryDemo {private GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory( null);/*** create a point
*@return
*/
publicPoint createPoint(){
Coordinate coord= new Coordinate(109.013388, 32.715519);
Point point=geometryFactory.createPoint( coord );returnpoint;
}/*** create a rectangle(矩形)
*@return
*/
publicEnvelope createEnvelope(){
Envelope envelope= new Envelope(0,1,0,2);returnenvelope;
}/*** create a point by WKT
*@return*@throwsParseException*/
public Point createPointByWKT() throwsParseException{
WKTReader reader= newWKTReader( geometryFactory );
Point point= (Point) reader.read("POINT (109.013388 32.715519)");returnpoint;
}/*** create multiPoint by wkt
*@return
*/
public MultiPoint createMulPointByWKT()throwsParseEx