postgis与geotools、qgis对应方法总结

工作中发现postgis相关文档比较清晰, 想要找到需要的方法往往比较容易. 而geotools实现某些功能没有postgis直观, 往往需要好多类协同完成. 所以有必要维护一下postgis与geotools实现某些功能时的对应方法.

持续更新. 纯手工维护, 各位大佬有什么更好的方法欢迎指导.

JTS api 地址: http://locationtech.github.io/jts/javadoc/ GITHUB地址:https://github.com/locationtech/jts

postgis方法geotools方法qgis工具功能描述
ST_LineLocatePointorg.locationtech.jts.linearref.LocationIndexedLine计算点在曲线中的位置(百分比)
ST_SimplifyPreserveTopologycom.vividsolutions.jts.simplify.TopologyPreservingSimplifier使用Douglas-Peucker算法,根据给定的几何对象,返回一个简化版的几何对象。避免创建新的派生的无效的几何对象(特别是多边形)
ST_LineSubstringcom.vividsolutions.jts.linearref.LengthIndexedLine根据传入的起止点的相对位置提取子轨迹
ST_ClosestPointorg.locationtech.jts.linearref.LocationIndexedLine获取点在线对象中的最近点在线中的位置
split with lines道路link相交处打断(This algorithm splits the lines or polygons in one layer using the lines in another layer to define the breaking points. Intersection between geometries in both layers are considered as split points.)
line intersections道路link相交处生成node(This algorithm creates point features where the lines in the Intersect layer intersect the lines in the Input layer.)
Vector general/Split vector layer根据矢量图层中选中字段的不同取值讲矢量图层划分为多个图层,选中字段的相同取值的矢量数据放在同一个图层中(This algorithm takes a vector layer and an attribute and generates a set of vector layers in an output folder. Each of the layers created in that folder contains all features from the input layer with the same value for the specified attribute.The number of files generated is equal to the number of different values found for the specified attribute)
  1. 计算点在曲线中的位置(百分比)
    Geotools demo:

        GeometryFactory factory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING));
    
        LocationIndexedLine indexedLine = new LocationIndexedLine(new LineString(new CoordinateArraySequence(new Coordinate[]{new Coordinate(0,0), new Coordinate(2,2)}), factory));
        // 根据曲线位置获取响应的点坐标
        Coordinate point = indexedLine.extractPoint(new LinearLocation(0,0.7));
        System.out.println(point);
        // 根据给定的点坐标获取其在曲线中的位置
        LinearLocation location1 = indexedLine.indexOf(new Coordinate(1.5,1));
        System.out.println(location1.getSegmentFraction());	 
    
  2. 几何对象简化
    Geotools demo:

    	TopologyPreservingSimplifier.simplify(geometry, 0.001);
    
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值