com.vividsolutions.jts.geom.Geometry.distance()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中com.vividsolutions.jts.geom.Geometry.distance()方法的一些代码示例,展示了Geometry.distance()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.distance()方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:distance

Geometry.distance介绍

[英]Returns the minimum distance between this Geometry and another Geometry.
[中]返回此Geometry与另一个Geometry之间的最小距离。

代码示例

代码示例来源:origin: com.vividsolutions/jts

/**
  * Computes the distance between two {@link Geometry} items,
  * using the {@link Geometry#distance(Geometry)} method.
  * 
  * @param item1 an item which is a Geometry
  * @param item2 an item which is a Geometry
  * @return the distance between the geometries
  * @throws ClassCastException if either item is not a Geometry
  */
 public double distance(ItemBoundable item1, ItemBoundable item2) {
  Geometry g1 = (Geometry) item1.getItem();
  Geometry g2 = (Geometry) item2.getItem();
  return g1.distance(g2);    
 }
}

代码示例来源:origin: org.geotools/gt-main

static public double distance(Geometry arg0,Geometry arg1)
{
   if (arg0 == null || arg1 == null) return -1d;
   Geometry _this = arg0;
   return _this.distance(arg1);
}

代码示例来源:origin: org.geotools/gt2-main

static public double distance(Geometry arg0,Geometry arg1)
{
   Geometry _this = arg0;
   return _this.distance(arg1);
}

代码示例来源:origin: org.orbisgis/h2spatial

/**
   * @param a Geometry instance or null
   * @param b Geometry instance or null
   * @return the 2-dimensional minimum Cartesian distance between two geometries
   * in projected units (spatial ref units)
   */
  public static Double distance(Geometry a,Geometry b) {
    if(a==null || b==null) {
      return null;
    }
    return a.distance(b);
  }
}

代码示例来源:origin: org.orbisgis/h2gis-functions

/**
   * @param a Geometry instance or null
   * @param b Geometry instance or null
   * @return the 2-dimensional minimum Cartesian distance between two geometries
   * in projected units (spatial ref units)
   */
  public static Double distance(Geometry a,Geometry b) {
    if(a==null || b==null) {
      return null;
    }
    return a.distance(b);
  }
}

代码示例来源:origin: org.orbisgis/h2gis

/**
   * @param a Geometry instance or null
   * @param b Geometry instance or null
   * @return the 2-dimensional minimum Cartesian distance between two geometries
   * in projected units (spatial ref units)
   */
  public static Double distance(Geometry a,Geometry b) {
    if(a==null || b==null) {
      return null;
    }
    return a.distance(b);
  }
}

代码示例来源:origin: org.geotools/gt-render

public double distance(Geometry g) {
  return geometry.distance(g);
}

代码示例来源:origin: aseldawy/spatialhadoop2

@Override
public double distanceTo(double x, double y) {
 return this.geom.distance(geom.getFactory().createPoint(new Coordinate(x, y)));
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

public static Double distance(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.distance(g2);
}

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

@Override
  public double distance(ItemBoundable item1, ItemBoundable item2) {
    NearFeature s1 = (NearFeature) item1.getItem();
    NearFeature s2 = (NearFeature) item2.getItem();
    return s1.location.distance(s2.location);
  }
});

代码示例来源:origin: org.teiid/teiid-engine

public static Double distance(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.distance(g2);
}

代码示例来源:origin: teiid/teiid

public static Double distance(GeometryType geom1, GeometryType geom2) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.distance(g2);
}

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

@Override
  public double distance(ItemBoundable item1, ItemBoundable item2) {
    NearFeature s1 = (NearFeature) item1.getItem();
    NearFeature s2 = (NearFeature) item2.getItem();
    return s1.location.distance(s2.location);
  }
});

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

@Override
  public double distance(ItemBoundable item1, ItemBoundable item2) {
    Geometry s1 = (Geometry) item1.getItem();
    Geometry s2 = (Geometry) item2.getItem();
    return s1.distance(s2);
  }
});

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

@Override
  public double distance(ItemBoundable item1, ItemBoundable item2) {
    Hub s1 = (Hub) item1.getItem();
    Hub s2 = (Hub) item2.getItem();
    return s1.location.distance(s2.location);
  }
});

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

@Override
  public double distance(ItemBoundable item1, ItemBoundable item2) {
    NearFeature s1 = (NearFeature) item1.getItem();
    NearFeature s2 = (NearFeature) item2.getItem();
    return s1.location.distance(s2.location);
  }
});

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

@Override
  public double distance(ItemBoundable item1, ItemBoundable item2) {
    NearFeature s1 = (NearFeature) item1.getItem();
    NearFeature s2 = (NearFeature) item2.getItem();
    return s1.location.distance(s2.location);
  }
});

代码示例来源:origin: BaseXdb/basex

@Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  return Dbl.get(checkGeo(0, qc).distance(checkGeo(1, qc)));
 }
}

代码示例来源:origin: deegree/deegree3

@Override
public Measure getDistance( Geometry geometry, Unit requestedUnit ) {
  // TODO respect unit
  double dist = getJTSGeometry().distance( getAsDefaultGeometry( geometry ).getJTSGeometry() );
  return new Measure( Double.toString( dist ), null );
}

代码示例来源:origin: mapplus/spatial_statistics_for_geotools_udig

@Override
  public double distance(ItemBoundable item1, ItemBoundable item2) {
    SimpleFeature s1 = (SimpleFeature) item1.getItem();
    SimpleFeature s2 = (SimpleFeature) item2.getItem();
    Geometry g1 = (Geometry) s1.getDefaultGeometry();
    Geometry g2 = (Geometry) s2.getDefaultGeometry();
    return g1.distance(g2);
  }
});

相关文章