简体   繁体   English

如何使 GML/JTS 几何在 Java 中有效?

[英]How to make GML / JTS Geometry valid in Java?

I am using the JTS library for manipulating with some Geometry objects that arise from GML files.我正在使用 JTS 库来处理由 GML 文件产生的一些 Geometry 对象。 Some of the Geometry objects that I obtain are (however) invalid.我获得的一些 Geometry 对象(但是)无效。 I recall that the .NET class SqlGeometry has a MakeValid method for this purpose.我记得 .NET 类 SqlGeometry 具有用于此目的的 MakeValid 方法。 Similarly, I know that PostGIS and many relational databases (like PostgreSQL and SQL Server) have built-in functionality for validating GMLs or Geometry structures.同样,我知道 PostGIS 和许多关系数据库(如 PostgreSQL 和 SQL Server)具有用于验证 GML 或几何结构的内置功能。 Sadly I have not been able to find any equivalent functionality in JTS or in the Java world in general.遗憾的是,我一直无法在 JTS 或 Java 世界中找到任何等效的功能。 The closest thing I came across was the Geometry#buffer() method (from JTS) with 0 as an argument, but it does not seem to solve my problem.我遇到的最接近的是Geometry#buffer()方法(来自 JTS),以0作为参数,但它似乎并没有解决我的问题。 Does anyone know a proper MakeValid functionality in some Java library?有谁知道某些 Java 库中的正确 MakeValid 功能?

Unfortunately JTS does not yet have a MakeValid equivalent.不幸的是,JTS 还没有 MakeValid 等价物。 Hopefully that can be contributed at some point.希望这可以在某个时候做出贡献。 For now buffer(0) is the best option, although it can have issues with "figure-8" polygons.现在buffer(0)是最好的选择,尽管它可能有“figure-8”多边形的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM