GeoJSONResult.java
package org.genesys.server.api.model;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import lombok.Data;
@Data
public class GeoJSONResult {
/** The remaining number of accessions NOT included in the results because of search limit */
private long otherCount;
/** The actual GeoJSON data */
private List<Feature> geoJson = new LinkedList<>();
public Feature addFeature(String type) {
var feature = new Feature(type);
geoJson.add(feature);
return feature;
}
/** GeoJSON Feature */
@Data
public static class Feature {
/** Feature type */
private String type;
/** Feature ID */
private long id;
/** Feature geometry */
Geometry geometry;
/** Various other properties */
Map<String, Object> properties = new LinkedHashMap<>();
public Feature(String type) {
this.type = type;
}
}
/** Basic geometry */
@Data
public static class Geometry {
/** Geometry type */
private String type;
/** Coordinates. A "Point" has two coordinates: longitude, latitude (in that order) */
List<Number> coordinates;
public Geometry(String type) {
this.type = type;
}
}
}