日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

geotools中的空间关系(Geometry Relationships)和空间操作(Geometry Operations)

發(fā)布時間:2024/1/4 综合教程 21 生活家
生活随笔 收集整理的這篇文章主要介紹了 geotools中的空间关系(Geometry Relationships)和空间操作(Geometry Operations) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

概述:

本文講述geotools中的空間關(guān)系判斷(Geometry Relationships)和空間操作(Geometry Operations)的編碼實(shí)現(xiàn)。

空間關(guān)系(Geometry Relationships):

常見的空間關(guān)系(Geometry Relationships)包括:Disjoint、Intersects、Touches、Crosses、Within、Contains、Overlaps、Relates。

空間操作(Geometry Operations):

常見的空間操作(Geometry Operations)包括:Buffer、Intersection、ConvexHull、Intersection、Union、Difference、SymDifference。


代碼實(shí)現(xiàn):

1、測試數(shù)據(jù)

			String wktPoint = "POINT(103.83489981581 33.462715497945)";
			String wktLine = "LINESTRING(108.32803893589 41.306670233001,99.950999898452 25.84722546391)";
			String wktPolygon = "POLYGON((100.02715479879 32.168082192159,102.76873121104 37.194305614622,107.0334056301 34.909658604412,105.96723702534 30.949603786713,100.02715479879 32.168082192159))";
			String wktPolygon1 = "POLYGON((96.219409781775 32.777321394882,96.219409781775 40.240501628236,104.82491352023001 40.240501628236,104.82491352023001 32.777321394882,96.219409781775 32.777321394882))";

測試數(shù)據(jù)地圖展示如下:

2、空間關(guān)系

			
			GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory( null );
			WKTReader reader = new WKTReader( geometryFactory );
			Point point = (Point) reader.read(wktPoint);
			LineString line = (LineString) reader.read(wktLine);
			Polygon polygon = (Polygon) reader.read(wktPolygon);
			Polygon polygon1 = (Polygon) reader.read(wktPolygon1);
			System.out.println("-------空間關(guān)系判斷-------");
			System.out.println(polygon.contains(point));
			System.out.println(polygon.intersects(line));
			System.out.println(polygon.overlaps(polygon1));

控制臺輸出結(jié)果如下:

3、空間操作

			System.out.println("
-------空間計(jì)算-------");
			WKTWriter write = new WKTWriter();
			Geometry intersection = polygon.union( polygon1 );
			Geometry union = polygon.union( polygon1 );
			Geometry difference = polygon.difference( polygon1 );
			Geometry symdifference = polygon.symDifference( polygon1 );
			System.out.println("	+++++++++++疊加分析+++++++++++");
			System.out.println(write.write(intersection));
			System.out.println("	+++++++++++合并分析+++++++++++");
			System.out.println(write.write(union));
			System.out.println("	+++++++++++差異分析+++++++++++");
			System.out.println(write.write(difference));
			System.out.println("	+++++++++++sym差異分析+++++++++++");
			System.out.println(write.write(symdifference));

控制臺輸出結(jié)果如下:

空間操作的計(jì)算結(jié)果展示如下:

intersect

union

Difference

SymDifference

---------------------------------------------------------------------------------------------------------------

技術(shù)博客

http://blog.csdn.NET/gisshixisheng

在線教程

http://edu.csdn.Net/course/detail/799

Github

https://github.com/lzugis/

聯(lián)系方式

q q:1004740957

e-mail:niujp08@qq.com

公眾號:lzugis15

Q Q 群:452117357(webgis)

337469080(Android)

---------------------------------------------------------------------------------------------------------------

技術(shù)博客

http://blog.csdn.NET/gisshixisheng

在線教程

http://edu.csdn.Net/course/detail/799

Github

https://github.com/lzugis/

聯(lián)系方式

q q:1004740957

e-mail:niujp08@qq.com

公眾號:lzugis15

Q Q 群:452117357(webgis)

337469080(Android)

總結(jié)

以上是生活随笔為你收集整理的geotools中的空间关系(Geometry Relationships)和空间操作(Geometry Operations)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。