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();
相关推荐
uppp»20 分钟前
深入理解 Java 反射机制:获取类信息与动态操作
java·开发语言
m0_748256144 小时前
SpringBoot
java·spring boot·后端
阿华的代码王国4 小时前
【从0做项目】Java搜索引擎(3)
java·搜索引擎·项目
Mr.朱鹏4 小时前
针对Feign客户端请求体参数处理问题
java·jvm·spring boot·spring·spring cloud·maven·intellij-idea
涛粒子6 小时前
Spring Bean 生命周期的执行流程
java·后端·spring
刘_sy6 小时前
使用EasyExcel和多线程实现高效数据导出
java·excel·easyexcel·批量导出excel
梦幻通灵7 小时前
IDEA通过Contince接入Deepseek
java·ide·intellij-idea
web150850966417 小时前
SQL 建表语句详解
java·数据库·sql
xiangxiongfly9157 小时前
Java 设计模式之迭代器模式
java·设计模式·迭代器模式
FLZJ_KL7 小时前
【设计模式】【行为型模式】迭代器模式(Iterator)
java·设计模式·迭代器模式