geotools 解析GeoJson

Maven:

XML 复制代码
<dependency>
  <groupId>org.geotools</groupId>
  <artifactId>gt-geojson</artifactId>
  <version>${geotools.version}</version>
</dependency>

Here is a small example from the test cases:

java 复制代码
GeometryJSON gjson = new GeometryJSON();
// be sure to strip whitespace
String json = "{'type':'Point','coordinates':[100.1,0.1]}";

Reader reader = new StringReader(json);
Point p = gjson.readPoint( reader );

Working with Features is also supported:

java 复制代码
FeatureJSON fjson = new FeatureJSON();
StringWriter writer = new StringWriter();

fjson.writeFeature(feature(1), writer);

String json = writer.toString();
相关推荐
刀法如飞5 小时前
AI时代:DDD领域驱动建模与Ontology语义建模的区别
java·设计模式·架构
jeffer_liu5 小时前
Spring AI 生产级实战:工具调用
java·人工智能·后端·spring·ai编程
比昨天多敲两行5 小时前
linux 线程概念与控制
java·开发语言·jvm
8Qi85 小时前
LeetCode 75:颜色分类(荷兰国旗问题)—— Java 题解 ✅
java·算法·leetcode·指针·排序
zzhongcy6 小时前
@Transactional 同类内部调用失效 + 两种自代理解决方案
java
AutumnWind04206 小时前
【Intelij IDEA使用手册】
java·ide·intellij-idea
就叫_这个吧7 小时前
Java注解、元注解、自定义注解定义及应用
java·开发语言·注解
Sam_Deep_Thinking7 小时前
聊聊Java中的of
java·开发语言·架构
NE_STOP8 小时前
Docker--管理监控平台的应用
java
爱吃羊的老虎9 小时前
【JAVA】python转java:Spring Boot 入门
java·spring boot·python