Geotools系列说明之JTS空间几何介绍

JTS介绍

The JTS Topology Suite is a Java API that implements a core set of spatial data operations
using an explicit precision model and robust geometric algorithms. It provides a complete
model for specifying 2-D linear Geometry. Many common operations in computational
geometry and spatial data processing are exposed in a clear, consistent and integrated API.
JTS is intended to be used in the development of applications that support the validation,
cleaning, integration and querying of spatial datasets.

This document is intended for developers who would like to use JTS to accomplish their
spatial data processing requirements. It describes common uses of the JTS API and gives
code examples
官方说它是一个java的api用来计算几何空间的操作工具
源码地址文档在doc目录下
在这里插入图片描述

JTS在Geotools中的使用

下载Geotoos的源码我们可以看到GeoTools使用了JTS的类
在这里插入图片描述
即Geotools依赖JTS的包
在这里插入图片描述
根据上述依赖关系可以知道Geomerty是所有图形的父类

  1. 创建Point点
GeometryFactory geometryFactory = new GeometryFactory();
        Point point = geometryFactory.createPoint(transform(new Coordinate(113.549006,22.388645), 4490, 3857)); //可以将4490坐标系进行转换成3857
  1. 创建线段
  /**
     * 生成线段
     * @param wkt
     * @return
     * @throws ParseException
     */
    public static LineString createLineString(String wkt) throws ParseException {
   
        WKTReader reader = new WKTReader( geometryFactory );
        return (LineString) reader.read(wkt);
    }

    /**
     * 生成线段
     * @param coords
     * @return
     */
    public static LineString createLineString(Coordinate[] coords) {
   
        GeometryFactory geometryFactory = new GeometryFactory(new 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

stayhungerstayflush

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值