All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.frightanic.smn.api.geojson.FeatureCollection Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
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));
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy