use of org.geojson.MultiPoint in project collect by openforis.
the class SamplingPointsController method loadSamplingPointDataFeatures.
private FeatureCollection loadSamplingPointDataFeatures(CollectSurvey survey) {
FeatureCollection featureCollection = new FeatureCollection();
Feature feature = new Feature();
feature.setProperty("letter", "o");
feature.setProperty("color", "blue");
feature.setProperty("rank", "15");
MultiPoint multiPoint = new MultiPoint();
CoordinateOperations coordinateOperations = getCoordinateOperations(survey);
List<SamplingDesignItem> samplingDesignItems = loadSamplingDesignItems(survey);
for (SamplingDesignItem item : samplingDesignItems) {
Coordinate coordinate = new Coordinate(item.getX(), item.getY(), item.getSrsId());
multiPoint.add(createLngLatAlt(coordinateOperations, coordinate));
}
feature.setGeometry(multiPoint);
featureCollection.add(feature);
return featureCollection;
}
use of org.geojson.MultiPoint in project geojson-jackson by opendatalab-de.
the class LineStringTest method itShouldSerializeMultiPoint.
@Test
public void itShouldSerializeMultiPoint() throws Exception {
MultiPoint lineString = new LineString(new LngLatAlt(100, 0), new LngLatAlt(101, 1));
assertEquals("{\"type\":\"LineString\",\"coordinates\":[[100.0,0.0],[101.0,1.0]]}", mapper.writeValueAsString(lineString));
}
use of org.geojson.MultiPoint in project geojson-jackson by opendatalab-de.
the class MultiPointTest method itShouldDeserializeMultiPoint.
@Test
public void itShouldDeserializeMultiPoint() throws Exception {
MultiPoint multiPoint = mapper.readValue("{\"type\":\"MultiPoint\",\"coordinates\":[[100.0,0.0],[101.0,1.0]]}", MultiPoint.class);
assertNotNull(multiPoint);
List<LngLatAlt> coordinates = multiPoint.getCoordinates();
PointTest.assertLngLatAlt(100, 0, Double.NaN, coordinates.get(0));
PointTest.assertLngLatAlt(101, 1, Double.NaN, coordinates.get(1));
}
use of org.geojson.MultiPoint in project geojson-jackson by opendatalab-de.
the class MultiPointTest method itShouldSerializeMultiPoint.
@Test
public void itShouldSerializeMultiPoint() throws Exception {
MultiPoint multiPoint = new MultiPoint(new LngLatAlt(100, 0), new LngLatAlt(101, 1));
assertEquals("{\"type\":\"MultiPoint\",\"coordinates\":[[100.0,0.0],[101.0,1.0]]}", mapper.writeValueAsString(multiPoint));
}
Aggregations