Java Code Examples for com.vividsolutions.jts.geom.Point#getY()

The following examples show how to use com.vividsolutions.jts.geom.Point#getY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MiscellaneousTest.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void testEmptyPoint() throws Exception {
  Point p = geometryFactory.createPoint((Coordinate)null);
  assertEquals(0, p.getDimension());
  assertEquals(new Envelope(), p.getEnvelopeInternal());
  assertTrue(p.isSimple());
  try {
    p.getX();
    assertTrue(false);
  }
  catch (IllegalStateException e1) {
  }
  try {
    p.getY();
    assertTrue(false);
  }
  catch (IllegalStateException e2) {
  }

  assertEquals("POINT EMPTY", p.toString());
  assertEquals("POINT EMPTY", p.toText());
}
 
Example 2
Source File: GeoServiceImpl.java    From geomajas-project-server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public Geometry createCircle(final Point point, final double radius, final int nrPoints) {
	double x = point.getX();
	double y = point.getY();
	Coordinate[] coords = new Coordinate[nrPoints + 1];
	for (int i = 0; i < nrPoints; i++) {
		double angle = ((double) i / (double) nrPoints) * Math.PI * 2.0;
		double dx = Math.cos(angle) * radius;
		double dy = Math.sin(angle) * radius;
		coords[i] = new Coordinate(x + dx, y + dy);
	}
	coords[nrPoints] = coords[0];

	LinearRing ring = point.getFactory().createLinearRing(coords);
	return point.getFactory().createPolygon(ring, null);
}
 
Example 3
Source File: GeoWaveIndexerSfTest.java    From rya with Apache License 2.0 5 votes vote down vote up
private static String geoToGml(final Point point) {
    //CRS:84 long X,lat Y
    //ESPG:4326 lat Y,long X
    return "<Point"//
    + " srsName='CRS:84'"// TODO: point.getSRID()
    + "><pos>"+point.getX()+" "+point.getY()+"</pos>  "// assumes  Y=lat  X=long
    + " </Point>";
}
 
Example 4
Source File: GeoIndexerSfTest.java    From rya with Apache License 2.0 5 votes vote down vote up
private static String geoToGml(final Point point) {
    //CRS:84 long X,lat Y
    //ESPG:4326 lat Y,long X
    return "<Point"//
    + " srsName='CRS:84'"// TODO: point.getSRID()
    + "><pos>"+point.getX()+" "+point.getY()+"</pos>  "// assumes  Y=lat  X=long
    + " </Point>";
}
 
Example 5
Source File: PointImpl.java    From mrgeo with Apache License 2.0 5 votes vote down vote up
@Override
public void fromJTS(Point jtsPoint)
{
  x = jtsPoint.getX();
  y = jtsPoint.getY();

  hash = false;
}
 
Example 6
Source File: PointOverlayType.java    From geoar-app with Apache License 2.0 4 votes vote down vote up
public GeoPoint getPoint() {
    Point p = geometry.getCentroid();
    return new GeoPoint(p.getY(), p.getX());
}
 
Example 7
Source File: StationConverter.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private GeojsonPoint getCoordinates(Station station) {
    Point location = station.getLocation();
    double x = location.getX();
    double y = location.getY();
    return createWithCoordinates(new Double[] {x, y});
}
 
Example 8
Source File: Coordinate.java    From SensorWebClient with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param point
 *        the point to be mapped. Has to be in lon/lat order.
 * @param mapProjection
 *        the projection of the map in which the coordinate will be rendered.
 * @return a Coordinate instance transformed to given map projection.
 */
public static Coordinate createProjectedCoordinate(Point point, String mapProjection) {
    return new Coordinate(point.getX(), point.getY(), mapProjection);
}