dxf转geojson后,使用java代码找出dxf每个图层中的标志性图标(三角形、四边形等等)

本文介绍如何通过Java代码分析GeoJSON数据结构,查找DXF转GeoJSON后图层中的特定几何形状,如三角形。首先理解GeoJSON的Point、LineString、Polygon等类型,然后用Java操作JSON获取所需图层信息,接着根据三角形由三条相交线段定义的特点编写查询代码,最终提供完整实现思路。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

第一步:先熟悉geojson的数据结构

geojson将所有的地理要素分为Point、MultiPoint、LineString、MultiLineString、Polygon、MultiPolygon、GeometryCollection。

感觉有篇博文讲的挺好,大家可以去看一下geojson数据结构讲解

第二步:试图使用Java代码去获取json里面你想要的图层里面的数据

我之前写过一篇根据Java代码获取json数据的文章,大家可以去看一下java操作json文件

第三步:开始分析你想要找的图标有什么特点

//这代表一个三角形
{
   
		"geometry": {
   
			"geometries": [{
   
				"coordinates": [
					[19776.669056702118, 32717.534270796306, 9.181425E-9],
					[20103.606839973643, 32717.534325811146, 9.181425E-9]
				],
				"type": "LineString"
			}, {
   
				"coordinates": [
					[19776.669056702118, 32717.534270796306, 9.181425E-9],
					[19940.13805881275, 32417.534298303737, 9.181425E-9]
				],
				"type": "LineString"
			}, {
   
				"coordinates": [
					[19940.13805881275, 32417.534298303737, 9.181425E-9],
					[20103.606839973643, 32717.534325811146, 9.181425E-9]
				],
				"type": "LineString"
			}, {
   
				"coordinates": [
					[19834.25117925165, 32717.534280485826, 9.181425E-9],
					[19834.251181033436, 32706.94559757729, 9.181425E-9]
				],
				"type": "LineString"
			}, 
			。。。。。。。。	
			, {
   
				"coordinates": [
					[19940.138027930516, 32601.05878631602, 9.181425E-9],
					[19940.138045748416, 32495.171957236857, 9.181425E-9]
				],
				"type": "LineString"
			}, {
   
				"coordinates": [
					[20046.02483741, 32717.53431612164, 9.181425E-9],
					[20046.02483919179, 32706.945633213105, 9.181425E-9]
				],
				"type": "LineString"
			},  {
   
				"coordinates": [19940.138045748416, 32495.171957236857, 9.181425E-9],
				"type": "Point"
			}, {
   
				"coordinates": [19940.138010112612, 32706.945615395198, 9.181425E-9],
				"type": "Point"
			}],
			"type": "GeometryCollection"
		},
		"type": "Feature",
		"properties": {
   
			"ExtendedEntity": null,
			"SubClasses": "AcDbEntity:AcDbBlockReference",
			"Text": null,
			"EntityHandle": "3DA17",
			"Linetype": null,
			"Layer": "I-POWER"
		}
	}, 

这是一个三角形在json文件中的数据结构,我找了几个对比了一下,发现每个三角形的三个边都是三条线组成

{
   
				"coordinates": [
					[
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值