本文整理了Java中org.locationtech.jts.geom.Geometry.distance()
方法的一些代码示例,展示了Geometry.distance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.distance()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称:Geometry
方法名:distance
[英]Returns the minimum distance between this Geometry
and another Geometry
.
[中]返回此Geometry
与另一个Geometry
之间的最小距离。
代码示例来源:origin: geotools/geotools
public static double distance(Geometry arg0, Geometry arg1) {
if (arg0 == null || arg1 == null) return -1d;
Geometry _this = arg0;
return _this.distance(arg1);
}
代码示例来源:origin: geotools/geotools
@Override
public boolean visit(Geometry value) {
double d = targetValue.distance(value);
if (d < distance) {
distance = d;
nearest = value;
}
return d == 0;
}
代码示例来源:origin: geotools/geotools
public double distance(Geometry g) {
return geometry.distance(g);
}
代码示例来源:origin: geotools/geotools
@DescribeProcess(
title = "Distance",
description =
"Returns the minimum distance between two geometries. Measurement is given in the input units, so geographic coordinates are not recommended."
)
@DescribeResult(description = "Distance between the two input geometries")
public static double distance(
@DescribeParameter(name = "a", description = "First input geometry") Geometry a,
@DescribeParameter(name = "b", description = "Second input geometry") Geometry b) {
return a.distance(b);
}
代码示例来源:origin: locationtech/geowave
@Override
public Double call(Geometry leftGeom, Geometry rightGeom) throws Exception {
return leftGeom.distance(rightGeom);
}
}
代码示例来源:origin: locationtech/geowave
@Override
public boolean apply(Geometry geom1, Geometry geom2) {
return geom1.distance(geom2) <= radius;
}
}
代码示例来源:origin: locationtech/jts
public static double distance(Geometry a, Geometry b) {
return a.distance(b);
}
代码示例来源:origin: geotools/geotools
assertTrue(offset.isValid());
assertTrue(offset.getLength() > 0);
assertEquals(abs(offsetDistance), offset.distance(geom), EPS * abs(offsetDistance));
offset.apply(
new GeometryComponentFilter() {
代码示例来源:origin: locationtech/jts
void testAll(Geometry[] geom)
{
for (int i = 0; i < geom.length; i++ ) {
for (int j = 0; j < geom.length; j++ ) {
double dist = geom[i].distance(geom[j]);
// double dist = SortedBoundsFacetDistance.distance(g1, g2);
// double dist = BranchAndBoundFacetDistance.distance(geom[i], geom[j]);
// double dist = CachedBABDistance.getDistance(geom[i], geom[j]);
}
}
}
代码示例来源:origin: locationtech/jts
void computePairDistance(List geoms, int i, int j)
{
for (int n = 0; n < MAX_ITER; n++ ) {
Geometry g1 = (Geometry) geoms.get(i);
Geometry g2 = (Geometry) geoms.get(j);
double dist = g1.distance(g2);
// double dist = SortedBoundsFacetDistance.distance(g1, g2);
// double dist = BranchAndBoundFacetDistance.distance(g1, g2);
}
}
代码示例来源:origin: org.opengeo/geodb
/**
* Returns the distance between two geometries.
*/
public static double ST_Distance( byte[] wkb1, byte[] wkb2 ) {
if ( wkb1 == null || wkb2 == null ) {
return -1;
}
Geometry g1 = gFromWKB(wkb1);
Geometry g2 = gFromWKB(wkb2);
return g1.distance(g2);
}
代码示例来源:origin: jdeolive/geodb
/**
* Returns the distance between two geometries.
*/
public static double ST_Distance( byte[] wkb1, byte[] wkb2 ) {
if ( wkb1 == null || wkb2 == null ) {
return -1;
}
Geometry g1 = gFromWKB(wkb1);
Geometry g2 = gFromWKB(wkb2);
return g1.distance(g2);
}
代码示例来源:origin: org.opengeo/geodb
/**
* Returns true if the geometries are within the specified distance of one another
*/
public static boolean ST_DWithin( byte[] wkb1, byte[] wkb2, double distance ) {
if ( wkb1 == null || wkb2 == null ) {
return false;
}
Geometry g1 = gFromWKB(wkb1);
Geometry g2 = gFromWKB(wkb2);
return g1.distance(g2) <= distance;
}
代码示例来源:origin: com.orientechnologies/orientdb-lucene
@Override
public double distance(Shape s1, Shape s2) {
Geometry geometry = factory.toGeometry(s1);
Geometry geometry1 = factory.toGeometry(s2);
return geometry.distance(geometry1);
}
代码示例来源:origin: locationtech/jts
public void testDisjointCollinearSegments() throws Exception {
Geometry g1 = reader.read("LINESTRING (0.0 0.0, 9.9 1.4)");
Geometry g2 = reader.read("LINESTRING (11.88 1.68, 21.78 3.08)");
assertEquals(2.23606, g1.distance(g2), 0.0001);
}
代码示例来源:origin: locationtech/jts
public void testDisjointCollinearSegments() throws Exception {
Geometry g1 = reader.read("LINESTRING (0.0 0.0, 9.9 1.4)");
Geometry g2 = reader.read("LINESTRING (11.88 1.68, 21.78 3.08)");
assertEquals(2.23606, g1.distance(g2), 0.0001);
}
代码示例来源:origin: locationtech/jts
public void testEmpty() throws Exception {
Geometry g1 = reader.read("POINT (0 0)");
Geometry g2 = reader.read("POLYGON EMPTY");
assertEquals(0.0, g1.distance(g2), 0.0);
}
代码示例来源:origin: locationtech/jts
public void testEmpty() throws Exception {
Geometry g1 = reader.read("POINT (0 0)");
Geometry g2 = reader.read("POLYGON EMPTY");
assertEquals(0.0, g1.distance(g2), 0.0);
}
代码示例来源:origin: locationtech/jts
public void testEverything() throws Exception {
Geometry g1 = reader.read("POLYGON ((40 320, 200 380, 320 80, 40 40, 40 320), (180 280, 80 280, 100 100, 220 140, 180 280))");
Geometry g2 = reader.read("POLYGON ((160 240, 120 240, 120 160, 160 140, 160 240))");
assertEquals(18.97366596, g1.distance(g2), 1E-5);
g2 = reader.read("POLYGON ((160 240, 120 240, 120 160, 180 100, 160 240))");
assertEquals(0.0, g1.distance(g2), 1E-5);
LineString l1 = (LineString) reader.read("LINESTRING(10 10, 20 20, 30 40)");
LineString l2 = (LineString) reader.read("LINESTRING(10 10, 20 20, 30 40)");
assertEquals(0.0, l1.distance(l2), 1E-5);
}
代码示例来源:origin: locationtech/jts
public void testEverything() throws Exception {
Geometry g1 = reader.read("POLYGON ((40 320, 200 380, 320 80, 40 40, 40 320), (180 280, 80 280, 100 100, 220 140, 180 280))");
Geometry g2 = reader.read("POLYGON ((160 240, 120 240, 120 160, 160 140, 160 240))");
assertEquals(18.97366596, g1.distance(g2), 1E-5);
g2 = reader.read("POLYGON ((160 240, 120 240, 120 160, 180 100, 160 240))");
assertEquals(0.0, g1.distance(g2), 1E-5);
LineString l1 = (LineString) reader.read("LINESTRING(10 10, 20 20, 30 40)");
LineString l2 = (LineString) reader.read("LINESTRING(10 10, 20 20, 30 40)");
assertEquals(0.0, l1.distance(l2), 1E-5);
}
内容来源于网络,如有侵权,请联系作者删除!