本文整理了Java中org.locationtech.jts.geom.GeometryFactory.createPoint()
方法的一些代码示例,展示了GeometryFactory.createPoint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.createPoint()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.GeometryFactory
类名称:GeometryFactory
方法名:createPoint
[英]Creates a Point using the given Coordinate. A null Coordinate creates an empty Geometry.
[中]使用给定坐标创建点。空坐标将创建空几何体。
代码示例来源:origin: prestodb/presto
private static Point readPoint(SliceInput input)
{
Coordinate coordinates = readCoordinate(input);
if (isNaN(coordinates.x) || isNaN(coordinates.y)) {
return GEOMETRY_FACTORY.createPoint();
}
return GEOMETRY_FACTORY.createPoint(coordinates);
}
代码示例来源:origin: graphhopper/graphhopper
void finish() {
Stop stop = gtfsFeed.stops.get(stopTime.stop_id);
stops.add(new Trip.Stop(stop.stop_id, stop.stop_name, geometryFactory.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat)),
updatedArrival.map(Date::from).orElse(Date.from(arrivalTimeFromHopEdge)), Date.from(arrivalTimeFromHopEdge),
updatedArrival.map(Date::from).orElse(null), isArrivalCancelled(stopSequence), null,
null, null, isDepartureCancelled(stopSequence)));
for (Trip.Stop tripStop : stops) {
logger.trace("{}", tripStop);
}
}
代码示例来源:origin: graphhopper/graphhopper
Optional<Instant> updatedDeparture = getDepartureDelay(stopSequence).map(delay -> plannedDeparture.plus(delay, SECONDS));
Stop stop = gtfsFeed.stops.get(stopTime.stop_id);
stops.add(new Trip.Stop(stop.stop_id, stop.stop_name, geometryFactory.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat)),
null, null, null, isArrivalCancelled(stopSequence),
updatedDeparture.map(Date::from).orElse(Date.from(plannedDeparture)), Date.from(plannedDeparture),
Optional<Instant> updatedDeparture = getDepartureDelay(stopTime.stop_sequence).map(delay -> plannedDeparture.plus(delay, SECONDS));
Stop stop = gtfsFeed.stops.get(stopTime.stop_id);
stops.add(new Trip.Stop(stop.stop_id, stop.stop_name, geometryFactory.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat)),
updatedArrival.map(Date::from).orElse(Date.from(arrivalTimeFromHopEdge)), Date.from(arrivalTimeFromHopEdge),
updatedArrival.map(Date::from).orElse(null), isArrivalCancelled(stopSequence),
代码示例来源:origin: graphhopper/graphhopper
for (Vertex vertex : (Collection<Vertex>) tin.getVertices(true)) {
JsonFeature feature = new JsonFeature();
feature.setGeometry(geometryFactory.createPoint(vertex.getCoordinate()));
HashMap<String, Object> properties = new HashMap<>();
properties.put("z", vertex.getZ());
代码示例来源:origin: geoserver/geoserver
Integer.valueOf(1),
new Double(1.1),
gf.createPoint(new Coordinate(1, 1))
},
"fid.1"));
Integer.valueOf(2),
new Double(2.2),
gf.createPoint(new Coordinate(2, 2))
},
"fid.2"));
Integer.valueOf(3),
new Double(3.3),
gf.createPoint(new Coordinate(3, 3))
},
"fid.3"));
代码示例来源:origin: geotools/geotools
/**
* Creates an empty Point
*
* @return an empty Point
*/
public Point point() {
return geomFact.createPoint(createCS(new double[0], 2));
}
代码示例来源:origin: geotools/geotools
/**
* Creates a 2D Point.
*
* @param x the X ordinate
* @param y the Y ordinate
* @return a Point
*/
public Point point(double x, double y) {
return geomFact.createPoint(createCS(new double[] {x, y}, 2));
}
代码示例来源:origin: geotools/geotools
/**
* Creates a 3D Point.
*
* @param x the X ordinate
* @param y the Y ordinate
* @param z the Z ordinate
* @return a Point
*/
public Point pointZ(double x, double y, double z) {
return geomFact.createPoint(createCS(new double[] {x, y, z}, 3));
}
代码示例来源:origin: geotools/geotools
/**
* Creates a 1D Point.
*
* @param x the X ordinate
* @return a Point
*/
public Point point(double x) {
return geomFact.createPoint(createCS(new double[] {x}, 1));
}
代码示例来源:origin: hibernate/hibernate-orm
event.setId( 1L);
event.setName( "Hibernate ORM presentation");
Point point = geometryFactory.createPoint( new Coordinate( 10, 5 ) );
event.setLocation( point );
代码示例来源:origin: geotools/geotools
/**
*
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated modifiable
*/
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
CoordinateSequence coordinates =
(CoordinateSequence) node.getChildValue(KML.coordinates.getLocalPart());
return geometryFactory.createPoint(coordinates.getCoordinate(0));
}
代码示例来源:origin: geotools/geotools
/**
* Tests if a specified {@link Point2D}is inside the boundary of the <code>Shape</code>.
*
* @param p a specified <code>Point2D</code>
* @return <code>true</code> if the specified <code>Point2D</code> is inside the boundary of the
* <code>Shape</code>; <code>false</code> otherwise.
*/
public boolean contains(Point2D p) {
Coordinate coord = new Coordinate(p.getX(), p.getY());
Geometry point = geometry.getFactory().createPoint(coord);
return geometry.contains(point);
}
代码示例来源:origin: geotools/geotools
/**
* Tests if a specified {@link Point2D} is inside the boundary of the <code>Shape</code>.
*
* @param p a specified <code>Point2D</code>
* @return <code>true</code> if the specified <code>Point2D</code> is inside the boundary of the
* <code>Shape</code>; <code>false</code> otherwise.
*/
public boolean contains(Point2D p) {
Coordinate coord = new Coordinate(p.getX(), p.getY());
Geometry point = geometry.getFactory().createPoint(coord);
return geometry.contains(point);
}
代码示例来源:origin: geotools/geotools
private Point makeSamplePoint(final GeometryFactory geomFac) {
Coordinate c = new Coordinate(xCenter - 14.0d, yCenter - 14.0d);
Point point = geomFac.createPoint(c);
return point;
}
代码示例来源:origin: geotools/geotools
protected void setUp() throws Exception {
super.setUp();
type = DataUtilities.createType("default", "name:String,*geom:Geometry");
GeometryFactory fac = new GeometryFactory();
geom = fac.createPoint(new Coordinate(10, 10));
SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] {"original", geom}, null);
ds = new MemoryDataStore(new SimpleFeature[] {f1});
}
代码示例来源:origin: geotools/geotools
public void testSetNonSequential() throws Exception {
GeometryFactory gf = new GeometryFactory();
builder.set("float", new Float(2.0));
builder.set("point", gf.createPoint(new Coordinate(0, 0)));
builder.set("integer", Integer.valueOf(1));
SimpleFeature feature = builder.buildFeature("fid");
assertNotNull(feature);
assertEquals(3, feature.getAttributeCount());
assertTrue(gf.createPoint(new Coordinate(0, 0)).equals(feature.getAttribute(0)));
assertEquals(Integer.valueOf(1), feature.getAttribute(1));
assertEquals(new Float(2.0), feature.getAttribute(2));
}
代码示例来源:origin: geotools/geotools
private LineString circleArcInBounds(
double x, double y, double radius, ReferencedEnvelope bounds) {
Point center = gf.createPoint(new Coordinate(x, y));
Polygon buffered = (Polygon) center.buffer(radius, 64);
Polygon mask = JTS.toGeometry(bounds);
Geometry intersection = buffered.getExteriorRing().intersection(mask);
return (LineString) intersection;
}
代码示例来源:origin: geotools/geotools
@Test
public void testDecimate3DPoint() throws Exception {
Point p = gf.createPoint(csf.create(new double[] {0, 1, 2}, 3));
Decimator d = new Decimator(identity, new Rectangle(0, 0, 5, 5), 0.8);
d.decimateTransformGeneralize(p, identity);
assertEquals(1, p.getNumPoints());
assertEquals(2, p.getCoordinateSequence().getDimension());
}
代码示例来源:origin: geotools/geotools
/** Tests encoding for X, Y, Z, M ordinates number */
@Test
public void testEncodeZM() throws Exception {
GeometryFactory gf = new GeometryFactory();
Point pointM = gf.createPoint(new CoordinateXYZM(1, 1, 2, 4));
CoordinateSequence seq = pointM.getCoordinateSequence();
Document doc = encode(seq, GML.pos);
checkPosOrdinates(doc, 4);
}
}
代码示例来源:origin: geotools/geotools
protected void addFeature(SimpleFeatureType featureType, JDBCFeatureStore features)
throws Exception {
SimpleFeatureBuilder b = new SimpleFeatureBuilder(featureType);
b.add("four");
b.add(new GeometryFactory().createPoint(new Coordinate(4, 4)));
SimpleFeature f = b.buildFeature(null);
features.addFeatures(DataUtilities.collection(f));
// pattern match to handle the multi primary key case
assertTrue(
((String) f.getUserData().get("fid"))
.matches(tname(featureType.getTypeName()) + ".4(\\..*)?"));
}
内容来源于网络,如有侵权,请联系作者删除!