本文整理了Java中com.mapbox.geojson.Point.type()
方法的一些代码示例,展示了Point.type()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Point.type()
方法的具体详情如下:
包路径:com.mapbox.geojson.Point
类名称:Point
方法名:type
[英]This describes the TYPE of GeoJson geometry this object is, thus this will always return Point.
[中]这描述了该对象的GeoJson几何体类型,因此它将始终返回点。
代码示例来源:origin: mapbox/mapbox-java
@Test
public void fromJson() throws IOException {
final String json = loadJsonFixture(SAMPLE_POINT);
Point geo = Point.fromJson(json);
assertEquals(geo.type(), "Point");
assertEquals(geo.longitude(), 100.0, DELTA);
assertEquals(geo.latitude(), 0.0, DELTA);
assertEquals(geo.altitude(), Double.NaN, DELTA);
assertEquals(geo.coordinates().get(0), 100.0, DELTA);
assertEquals(geo.coordinates().get(1), 0.0, DELTA);
assertEquals(geo.coordinates().size(), 2);
assertFalse(geo.hasAltitude());
}
代码示例来源:origin: mapbox/mapbox-java
@Test
public void testLineDistanceWithGeometries() throws IOException, TurfException {
Point pt = (Point) Feature.fromJson(loadJsonFixture(PT)).geometry();
FeatureCollection pts = FeatureCollection.fromJson(loadJsonFixture(PTS));
List<Point> pointList = new ArrayList<>();
for (Feature feature : pts.features()) {
pointList.add((Point) (feature.geometry()));
}
Point closestPt = TurfClassification.nearestPoint(pt, pointList);
Assert.assertNotNull(closestPt);
Assert.assertEquals(closestPt.type(), "Point");
Assert.assertEquals(closestPt.longitude(), -75.33, DELTA);
Assert.assertEquals(closestPt.latitude(), 39.44, DELTA);
}
}
内容来源于网络,如有侵权,请联系作者删除!