com.frightanic.smn.api.geojson.FeatureCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of open-data-smn Show documentation
Show all versions of open-data-smn Show documentation
An API to serve publicly available data from the SwissMetNet.
package com.frightanic.smn.api.geojson;
import com.frightanic.smn.api.SmnRecord;
import com.wordnik.swagger.annotations.ApiModel;
import lombok.Getter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* Represents a the entire data set in GeoJSON format.
*/
@Getter
@ApiModel(value = "A GeoJSON feature collection")
public final class FeatureCollection {
private final String type = "FeatureCollection";
private final List features;
private final Crs crs;
public FeatureCollection(CrsType crs, Collection smnRecords) {
this.crs = new Crs(crs);
features = new ArrayList<>(smnRecords.size());
populateFeatures(crs, smnRecords);
}
private void populateFeatures(CrsType crs, Collection smnRecords) {
for (SmnRecord smnRecord : smnRecords) {
features.add(new Feature(crs, smnRecord));
}
}
}