本文整理汇总了Java中org.geojson.FeatureCollection.setFeatures方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureCollection.setFeatures方法的具体用法?Java FeatureCollection.setFeatures怎么用?Java FeatureCollection.setFeatures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geojson.FeatureCollection
的用法示例。
在下文中一共展示了FeatureCollection.setFeatures方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.geojson.FeatureCollection; //导入方法依赖的package包/类
@Nonnull
public FeatureCollection execute(final Set<Long> zoneIds, final GISUtils.SRID srid, final double simplifyAmount) {
final FeatureCollection featureCollection = new FeatureCollection();
featureCollection.setCrs(srid.getGeoJsonCrs());
if (zoneIds.isEmpty()) {
return featureCollection;
}
final MapSqlParameterSource params = new MapSqlParameterSource()
.addValue("zoneIds", zoneIds)
.addValue("crs", srid.getValue())
.addValue("simplify", simplifyAmount);
final List<Feature> features = jdbcOperations.query(SQL, params, (rs, i) -> mapResultToFeature(rs));
if (features != null) {
featureCollection.setFeatures(features);
}
return featureCollection;
}
示例2: execute
import org.geojson.FeatureCollection; //导入方法依赖的package包/类
public FeatureCollection execute(final long zoneId, final GISUtils.SRID srid) {
final MapSqlParameterSource params = new MapSqlParameterSource()
.addValue("zoneId", zoneId)
.addValue("crs", srid.getValue());
final List<Feature> features = jdbcOperations.query(SQL, params, (resultSet, i) -> {
final Feature feature = new Feature();
feature.setId(Long.toString(zoneId));
feature.setProperty(GeoJSONConstants.PROPERTY_NUMBER, resultSet.getString("property_identifier"));
feature.setGeometry(GISUtils.parseGeoJSONGeometry(objectMapper, resultSet.getString("geom")));
return feature;
});
final FeatureCollection featureCollection = new FeatureCollection();
if (features != null) {
featureCollection.setFeatures(features);
}
return featureCollection;
}
示例3: report
import org.geojson.FeatureCollection; //导入方法依赖的package包/类
@Transactional(readOnly = true)
public FeatureCollection report(int year) {
if (year < MIN_YEAR || year > MAX_YEAR) {
throw new IllegalArgumentException("Year must be between" + MIN_YEAR + " and " + MAX_YEAR);
}
List<Feature> features = jdbcTemplate.query(SQL, getSqlParameterSource(year, "209"), new RowMapper<Feature>() {
private final ObjectMapper objectMapper = new ObjectMapper();
@Override
public Feature mapRow(ResultSet rs, int rowNum) throws SQLException {
Feature feature = new Feature();
feature.getProperties().put("day", rs.getString("day"));
feature.getProperties().put("gender", rs.getString("gender"));
feature.getProperties().put("age", rs.getString("age"));
feature.getProperties().put("luke_status", rs.getString("luke_status"));
feature.getProperties().put("rhy_code", rs.getString("rhy_code"));
feature.getProperties().put("rhy_fi", rs.getString("rhy_fi"));
feature.getProperties().put("rhy_sv", rs.getString("rhy_sv"));
try {
feature.setGeometry(objectMapper.readValue(rs.getString("geom"), GeoJsonObject.class));
} catch (IOException e) {
throw new RuntimeException(e);
}
return feature;
}
});
FeatureCollection featureCollection = new FeatureCollection();
featureCollection.setFeatures(features);
Crs crs = new Crs();
crs.getProperties().put("name", "urn:ogc:def:crs:EPSG::3067");
featureCollection.setCrs(crs);
return featureCollection;
}
示例4: exportClubAreaFeatures
import org.geojson.FeatureCollection; //导入方法依赖的package包/类
private FeatureCollection exportClubAreaFeatures(Locale locale, GISZone zone, LocalisedString areaName, LocalisedString clubName, Date modificationTime) {
final LocalDateTime saveDateTime = DateUtil.toLocalDateTimeNullSafe(modificationTime);
final String saveDate = DTF.print(saveDateTime);
final double[] bbox = gisZoneRepository.getBounds(zone.getId(), GISUtils.SRID.ETRS_TM35FIN);
final GeometryAndSize geometryAndSize = getZoneFeature(zone.getId());
final Feature feature = new Feature();
feature.setGeometry(geometryAndSize.geom);
feature.setProperty("clubName", clubName.getAnyTranslation(locale));
feature.setProperty("saveDate", i18n("saveDate", locale) + " " + saveDate);
feature.setProperty("areaName", i18n("areaName", locale) + " " + areaName.getAnyTranslation(locale));
feature.setProperty("areaSize", formatAreaSize(locale, "totalAreaSize", geometryAndSize.totalAreaSize) + " " +
formatAreaSize(locale, "landAreaSize", geometryAndSize.landAreaSize) + " " +
formatAreaSize(locale, "waterAreaSize", geometryAndSize.waterAreaSize));
feature.setProperty("fill", "rgb(0, 192, 60)");
feature.setProperty("fill-opacity", 0.3);
feature.setProperty("stroke-width", 3.0);
feature.setProperty("stroke", "rgb(0,0,0)");
final FeatureCollection featureCollection = new FeatureCollection();
featureCollection.setCrs(GISUtils.SRID.ETRS_TM35FIN.getGeoJsonCrs());
featureCollection.setBbox(bbox);
featureCollection.setFeatures(ImmutableList.of(feature));
return featureCollection;
}
示例5: query
import org.geojson.FeatureCollection; //导入方法依赖的package包/类
private FeatureCollection query(final String sql, MapSqlParameterSource parameterSource) {
final FeatureCollection featureCollection = new FeatureCollection();
featureCollection.setFeatures(jdbcTemplate.query(sql, parameterSource, ROW_MAPPER));
final Crs crs = new Crs();
crs.getProperties().put("name", "urn:ogc:def:crs:EPSG::4326");
featureCollection.setCrs(crs);
return featureCollection;
}
示例6: execute
import org.geojson.FeatureCollection; //导入方法依赖的package包/类
public FeatureCollection execute(final Long zoneId, final GISUtils.SRID srid) {
final MapSqlParameterSource params = new MapSqlParameterSource()
.addValue("zoneId", zoneId)
.addValue("crs", srid.getValue());
final List<Feature> features = jdbcOperations.query(SQL, params, (rs, i) -> mapResultToFeature(rs));
final FeatureCollection featureCollection = new FeatureCollection();
if (features != null) {
featureCollection.setFeatures(features);
}
return featureCollection;
}