简体   繁体   English

com.vividsolutions.jts.geom.Geometry类中的距离单位是多少?

[英]What are the distance units in com.vividsolutions.jts.geom.Geometry class?

Our VB.NET project is using a Java library from Vivid Solutoins (com.vividsolutions.jts.geom.Geometry) to do Geometry calculations. 我们的VB.NET项目使用来自Vivid Solutoins(com.vividsolutions.jts.geom.Geometry)的Java库来进行几何计算。 The help is here: http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html 帮助在这里: http//tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html

What I can't figure out are the units specifically for the Buffer property, or any other distance for that matter. 我无法弄清楚的是具体针对Buffer属性的单位,或者该问题的任何其他距离。 My program is dealing with Nautical Miles, and the documentation gives no indication if the units are degrees, miles, Nautical Miles, Kilometers, inches, etc. 我的程序正在处理Nautical Miles,文档没有说明单位是度,英里,航海里程,公里,英寸等。

Has anyone used this library who knows the answer? 有没有人用这个知道答案的图书馆? Thanks in advance. 提前致谢。

First of all, I don't know this API, I've just browsed the link you've given. 首先,我不知道这个API,我刚刚浏览了你给出的链接。

Judging by the Javadocs for Coordinate , it says: 根据Javadocs for Coordinate判断,它说:

[Coordinate is a] lightweight class used to store coordinates on the 2-dimensional Cartesian plane. [Coordinate是一个]轻量级类,用于存储二维笛卡尔平面上的坐标。 It is distinct from Point, which is a subclass of Geometry. 它与Point不同,Point是Geometry的子类。 Unlike objects of type Point (which contain additional information such as an envelope, a precision model, and spatial reference system information) 与Point类型的对象(包含附加信息,如包络,精度模型和空间参考系统信息)不同

So it would seem that Geometry has no units as such, but Point, its subclass, does, and you can specify them. 因此,Geometry 似乎没有这样的单位,但Point,它的子类,它可以指定它们。

I wouldn't be surprised if the Geometry class doesn't have any units as such, and just represents the concept of a point in space in any particular coordinate system. 如果Geometry类没有任何单位,我不会感到惊讶,只是代表任何特定坐标系中空间点的概念。

This is an old post, but here is the answer for anyone else who is looking, since incredibly the java docs do not state the units returned by the method. 这是一篇很老的帖子,但是对于正在寻找的其他人来说,这是答案,因为令人难以置信的是,java文档没有说明该方法返回的单位。 The distance returned is in central angle degrees. 返回的距离是中心角度。 You can then use any number of formulas to convert to your required unit of measure. 然后,您可以使用任意数量的公式转换为所需的度量单位。 The simplest is to convert to radians. 最简单的是转换为弧度。 1 radian = 180 degrees divided by pi (rad=180deg/pi). 1弧度= 180度除以pi(rad = 180deg / pi)。 From there, you can multiply radians by the average radius of the earth in your choice of units (6371 km for instance) to get distance between two points. 从那里,您可以将弧度乘以您选择的单位(例如6371 km)的地球平均半径,以获得两点之间的距离。 More accurate methods are also available, but you can look them up on the net. 也可以使用更准确的方法,但您可以在网上查找。

I confirmed with one of the author's of the library, and by testing it myself using geospatial files with different projections, that the distance units depend on the source file's CRS. 我与图书馆的一位作者确认,并通过使用具有不同投影的地理空间文件自行测试,距离单位取决于源文件的CRS。 This is covered in their FAQ here: https://locationtech.github.io/jts/jts-faq.html#B5 这在他们的FAQ中有所介绍: https//locationtech.github.io/jts/jts-faq.html#B5

A quick way to find this is to look up the EPSG code at http://epsg.io/ and find the units. 找到这个的快速方法是在http://epsg.io/上查找EPSG代码并找到单位。 For example, EPSG 3347 has units of metres. 例如, EPSG 3347具有米的单位。

As I recently worked on this library ( http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html ) and after investigation I found that the unit distance returned when call some of the methods distance calculation with this api will be in degree unit. 正如我最近在这个库( http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html )上工作并经过调查后我发现调用一些方法时返回的单位距离距离计算这个api将以学位为单位。 To convert it to kilometer, assumes that value returned is d then you need to convert it to radian and multiply with earth radius 6371km. 要将其转换为公里,假设返回的值为d,则需要将其转换为弧度并乘以地球半径6371km。 The formula would be d / 180 * PI * 6371. 公式为d / 180 * PI * 6371。

暂无
暂无

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

相关问题 如何使用休眠会话将oracle空间SDO_GEOMETRY转换为com.vividsolutions.jts.geom.Geometry - how to fectch oracle spatial SDO_GEOMETRY as com.vividsolutions.jts.geom.Geometry using hibernate session 使用GeoTools:com.vividsolutions.jts.geom.Coordinate类中的纬度和经度是什么? - Using GeoTools: What is the Latitude and Longitude in com.vividsolutions.jts.geom.Coordinate class? Geotools com.vividsolutions.jts.geom.TopologyException:侧面位置冲突 - Geotools com.vividsolutions.jts.geom.TopologyException: side location conflict 映射到 com.vividsolutions.jts.geom.Point 无效端标志 - Mapping to com.vividsolutions.jts.geom.Point invalid endian flag 用休眠5保存vividsolutions.jts.geom.Polygonal属性 - Save vividsolutions.jts.geom.Polygonal attribute with hibernate 5 来自vividsolutions JTS的几何图形在创建JSON时失败 - Geometry from vividsolutions JTS fails when creating JSON 将 com.vividsolutions.jts 迁移到 org.locationtech.jts 仍然抱怨缺少 com.vividsolutions package - Migrating com.vividsolutions.jts to org.locationtech.jts still complaining about lack of com.vividsolutions package 如何在JTS中从纬度,经度到经度,纬度交换jts.geom.Geometry对象的坐标 - How to Swap Coordinates of jts.geom.Geometry object from Lat, Long to Long,Lat in JTS 是否有Java的几何库? (不是JTS) - Is there a geometry library for Java? (not JTS) 如何枚举JTS中的Geometry中的顶点? - How to enumerate vertices in Geometry in JTS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM