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();
相关推荐
json{shen:"jing"}4 分钟前
分割回文串
java
workflower26 分钟前
易用性和人性化需求
java·python·测试用例·需求分析·big data·软件需求
小灵不想卷1 小时前
LangChain4 初体验
java·langchain·langchain4j
忍者必须死1 小时前
ConcurrentHashMap源码解析
java
顾北121 小时前
SpringCloud 系列 04:Gateway 断言 / 过滤器 / 限流 一站式落地指南
java·开发语言·数据库
闻哥1 小时前
23种设计模式深度解析:从原理到实战落地
java·jvm·spring boot·设计模式·面试
wuqingshun3141591 小时前
java创建对象的方式
java·开发语言
求知摆渡1 小时前
Spring AI 多模型对话 Demo 实战:OpenAI/Ollama 一套接口、Redis 会话记忆、SSE 流式输出、AOP 日志打点
java·spring
米羊1212 小时前
Struts 2 漏洞(下)
java·后端·struts
HEU_firejef2 小时前
实战篇(一)BitMap实现签到功能
java·redis