use of com.vividsolutions.jts.geom.Coordinate in project incubator-rya by apache.
the class GeoWaveGTQueryTest method ingestCannedData.
private static void ingestCannedData() throws IOException {
final List<SimpleFeature> points = new ArrayList<>();
System.out.println("Building SimpleFeatures from canned data set...");
for (final Entry<String, Coordinate> entry : CANNED_DATA.entrySet()) {
System.out.println("Added point: " + entry.getKey());
points.add(buildSimpleFeature(entry.getKey(), entry.getValue()));
}
System.out.println("Ingesting canned data...");
try (final IndexWriter<SimpleFeature> indexWriter = dataStore.createWriter(ADAPTER, INDEX)) {
for (final SimpleFeature sf : points) {
indexWriter.write(sf);
}
}
System.out.println("Ingest complete.");
}
use of com.vividsolutions.jts.geom.Coordinate in project incubator-rya by apache.
the class MongoIndexerDeleteIT method populateRya.
private void populateRya(final SailRepositoryConnection conn) throws Exception {
final ValueFactory VF = new ValueFactoryImpl();
// geo 2x2 points
final GeometryFactory GF = new GeometryFactory();
for (int x = 0; x <= 1; x++) {
for (int y = 0; y <= 1; y++) {
final Geometry geo = GF.createPoint(new Coordinate(x + .5, y + .5));
final RyaStatement stmnt = statement(geo);
final Statement statement = RyaToRdfConversions.convertStatement(stmnt);
conn.add(statement);
}
}
// freetext
final URI person = VF.createURI("http://example.org/ontology/Person");
String uuid;
uuid = "urn:people";
conn.add(VF.createURI(uuid), RDF.TYPE, person);
conn.add(VF.createURI(uuid), RDFS.LABEL, VF.createLiteral("Alice Palace Hose", VF.createURI("http://www.w3.org/2001/XMLSchema#string")));
conn.add(VF.createURI(uuid), RDFS.LABEL, VF.createLiteral("Bob Snob Hose", "en"));
// temporal
final TemporalInstant instant = new TemporalInstantRfc3339(1, 2, 3, 4, 5, 6);
conn.add(VF.createURI("foo:time"), VF.createURI("Property:atTime"), VF.createLiteral(instant.toString()));
}
use of com.vividsolutions.jts.geom.Coordinate in project alliance by codice.
the class NitfImageTransformer method getPolygonForSegment.
private Polygon getPolygonForSegment(ImageSegment segment, GeometryFactory geomFactory) {
Coordinate[] coords = new Coordinate[5];
ImageCoordinates imageCoordinates = segment.getImageCoordinates();
coords[0] = new Coordinate(imageCoordinates.getCoordinate00().getLongitude(), imageCoordinates.getCoordinate00().getLatitude());
coords[4] = new Coordinate(coords[0]);
coords[1] = new Coordinate(imageCoordinates.getCoordinate0MaxCol().getLongitude(), imageCoordinates.getCoordinate0MaxCol().getLatitude());
coords[2] = new Coordinate(imageCoordinates.getCoordinateMaxRowMaxCol().getLongitude(), imageCoordinates.getCoordinateMaxRowMaxCol().getLatitude());
coords[3] = new Coordinate(imageCoordinates.getCoordinateMaxRow0().getLongitude(), imageCoordinates.getCoordinateMaxRow0().getLatitude());
LinearRing externalRing = geomFactory.createLinearRing(coords);
return geomFactory.createPolygon(externalRing, null);
}
use of com.vividsolutions.jts.geom.Coordinate in project alliance by codice.
the class LinestringGeometrySubsampler method apply.
@Override
public Geometry apply(Geometry geometry, Context context) {
if (!(geometry instanceof LineString)) {
return geometry;
}
if (context.getSubsampleCount() == null) {
throw new IllegalStateException("subsampleCount must be set in the GeometryOperator.Context");
}
int subsampleCount = context.getSubsampleCount();
Coordinate[] input = geometry.getCoordinates();
int inputSize = input.length;
if (input.length <= subsampleCount) {
return geometry;
}
Coordinate[] output = new Coordinate[subsampleCount];
for (int i = 0; i < subsampleCount; i++) {
output[i] = input[i * inputSize / subsampleCount];
}
return new GeometryFactory().createLineString(output);
}
use of com.vividsolutions.jts.geom.Coordinate in project alliance by codice.
the class NsiliFilterFactory method convertWktToBqs.
public String convertWktToBqs(String wkt) {
WKTReader wktReader = new WKTReader(GEOMETRY_FACTORY);
Geometry geometry;
try {
geometry = wktReader.read(wkt);
} catch (ParseException e) {
LOGGER.debug("Unable to parse WKT String {}", wkt, e);
return NsiliFilterDelegate.EMPTY_STRING;
}
if (geometry.getCoordinates() == null || StringUtils.isBlank(geometry.getGeometryType())) {
return NsiliFilterDelegate.EMPTY_STRING;
}
StringBuilder result = new StringBuilder(geometry.getGeometryType().toUpperCase() + LP);
Coordinate[] coordinates = geometry.getCoordinates();
for (Coordinate coordinate : coordinates) {
result.append(coordinate.y + COMMA + coordinate.x + COMMA);
}
return result.toString().substring(0, result.toString().length() - 1) + RP;
}
Aggregations