Search in sources :

Example 1 with MultiPoint

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;
}
Also used : MultiPoint(org.geojson.MultiPoint) CoordinateOperations(org.openforis.idm.geospatial.CoordinateOperations) FeatureCollection(org.geojson.FeatureCollection) Coordinate(org.openforis.idm.model.Coordinate) Feature(org.geojson.Feature) SamplingDesignItem(org.openforis.collect.model.SamplingDesignItem)

Example 2 with MultiPoint

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));
}
Also used : MultiPoint(org.geojson.MultiPoint) LineString(org.geojson.LineString) LngLatAlt(org.geojson.LngLatAlt) Test(org.junit.Test)

Example 3 with MultiPoint

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));
}
Also used : MultiPoint(org.geojson.MultiPoint) LngLatAlt(org.geojson.LngLatAlt) Test(org.junit.Test)

Example 4 with MultiPoint

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));
}
Also used : MultiPoint(org.geojson.MultiPoint) LngLatAlt(org.geojson.LngLatAlt) Test(org.junit.Test)

Aggregations

MultiPoint (org.geojson.MultiPoint)4 LngLatAlt (org.geojson.LngLatAlt)3 Test (org.junit.Test)3 Feature (org.geojson.Feature)1 FeatureCollection (org.geojson.FeatureCollection)1 LineString (org.geojson.LineString)1 SamplingDesignItem (org.openforis.collect.model.SamplingDesignItem)1 CoordinateOperations (org.openforis.idm.geospatial.CoordinateOperations)1 Coordinate (org.openforis.idm.model.Coordinate)1