本文整理汇总了Java中org.geojson.Feature类的典型用法代码示例。如果您正苦于以下问题:Java Feature类的具体用法?Java Feature怎么用?Java Feature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Feature类属于org.geojson包,在下文中一共展示了Feature类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toFeatureCollectionWithMetadata
import org.geojson.Feature; //导入依赖的package包/类
private FeatureCollection toFeatureCollectionWithMetadata(final AreaEntity<?> area,
final HuntingClub club,
final int huntingYear) {
return area.computeCombinedFeatures(zoneRepository, 1)
.map(featureCollection -> {
final Date saveDate = area.getLatestCombinedModificationTime();
final DateTime saveDateTime = new DateTime(saveDate).withZone(DateTimeZone.UTC);
for (final Feature feature : featureCollection) {
feature.setId(null);
feature.setProperty(GeoJSONConstants.PROPERTY_CLUB_NAME, club.getNameLocalisation());
feature.setProperty(GeoJSONConstants.PROPERTY_AREA_NAME, area.getNameLocalisation());
feature.setProperty(GeoJSONConstants.PROPERTY_AREA_SIZE, Math.round(area.getZone().getComputedAreaSize()));
feature.setProperty(GeoJSONConstants.PROPERTY_WATER_AREA_SIZE, Math.round(area.getZone().getWaterAreaSize()));
feature.setProperty(GeoJSONConstants.PROPERTY_SAVE_DATE, ISODateTimeFormat.basicDateTimeNoMillis().print(saveDateTime));
feature.setProperty(GeoJSONConstants.PROPERTY_HUNTING_YEAR, huntingYear);
}
return featureCollection;
})
.orElseThrow(MissingHuntingClubAreaGeometryException::new);
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:24,代码来源:HuntingClubAreaExportFeature.java
示例2: geoJSON
import org.geojson.Feature; //导入依赖的package包/类
@Transactional(readOnly = true, timeout = 60)
public FeatureCollection geoJSON(final long clubAreaId) {
final HuntingClubArea huntingClubArea = requireEntityService
.requireHuntingClubArea(clubAreaId, EntityPermission.READ);
if (huntingClubArea.getZone() != null) {
final GISZone gisZone = huntingClubArea.getZone();
final FeatureCollection features = zoneRepository.getPalstaFeatures(gisZone.getId(), GISUtils.SRID.WGS84);
features.setBbox(zoneRepository.getBounds(gisZone.getId(), GISUtils.SRID.WGS84));
final Optional<Feature> excludedFeature = gisZone.getExcludedAsGeoJSON(GeoJSONConstants.ID_EXCLUDED);
excludedFeature.ifPresent(features::add);
// Metsähallitus hirvialueet
features.addAll(metsahallitusRepository.listZoneHirviFeatures(gisZone.getId(), GISUtils.SRID.WGS84));
return features;
}
return new FeatureCollection();
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:21,代码来源:HuntingClubAreaZoneFeature.java
示例3: PalstaFeatureCollection
import org.geojson.Feature; //导入依赖的package包/类
public PalstaFeatureCollection(final FeatureCollection featureCollection,
final List<Integer> currentList) {
this.current = Ints.toArray(currentList);
final List<Feature> palstaFeatures = featureCollection.getFeatures().stream()
.filter(f -> f.getId() != null && DIGIT_MATCHER.matchesAllOf(f.getId()))
.collect(toList());
this.toRetain = palstaFeatures.stream()
.mapToInt(f -> Integer.parseInt(f.getId()))
.toArray();
this.toReplace = palstaFeatures.stream()
.filter(f -> Boolean.TRUE.equals(f.getProperty(GeoJSONConstants.PROPERTY_FIXED)))
.mapToInt(f -> Integer.parseInt(f.getId()))
.toArray();
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:18,代码来源:PalstaFeatureCollection.java
示例4: execute
import org.geojson.Feature; //导入依赖的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;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:23,代码来源:GetCombinedFeatureCollectionQuery.java
示例5: mapResultToFeature
import org.geojson.Feature; //导入依赖的package包/类
@Nonnull
private Feature mapResultToFeature(final ResultSet rs) throws SQLException {
final Feature feature = new Feature();
feature.setId(String.valueOf(rs.getLong("id")));
feature.setGeometry(GISUtils.parseGeoJSONGeometry(objectMapper, rs.getString("geom")));
feature.setProperty(GeoJSONConstants.PROPERTY_NUMBER, PropertyIdentifier.formatPropertyIdentifier(rs.getLong("tunnus")));
feature.setProperty(GeoJSONConstants.PROPERTY_SIZE, rs.getDouble("area_size"));
if (rs.getBoolean("is_changed")) {
feature.setProperty(GeoJSONConstants.PROPERTY_CHANGED, true);
feature.setProperty(GeoJSONConstants.PROPERTY_SIZE_DIFF, rs.getFloat("diff_area"));
feature.setProperty(GeoJSONConstants.PROPERTY_PALSTA_NEW_ID, rs.getLong("new_palsta_id"));
feature.setProperty(GeoJSONConstants.PROPERTY_NUMBER_NEW, PropertyIdentifier.formatPropertyIdentifier(rs.getLong("new_palsta_tunnus")));
}
return feature;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:19,代码来源:GetPalstaFeatureCollectionQuery.java
示例6: execute
import org.geojson.Feature; //导入依赖的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;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:23,代码来源:GetExternalFeatureCollectionQuery.java
示例7: build
import org.geojson.Feature; //导入依赖的package包/类
public BoundedDataSet build(final GeoJsonObject data) {
dataSet = new DataSet();
if (data instanceof FeatureCollection) {
processFeatureCollection((FeatureCollection) data);
} else if (data instanceof GeometryCollection) {
processGeometryCollection(null, (GeometryCollection) data);
} else if (data instanceof Feature) {
processFeature((Feature) data);
} else {
processGeometry(null, data);
}
Bounds bounds = null;
for (OsmPrimitive osmPrimitive : dataSet.allPrimitives()) {
bounds = mergeBounds(bounds, osmPrimitive);
}
return new BoundedDataSet(dataSet, bounds);
}
开发者ID:JOSM,项目名称:geojson,代码行数:20,代码来源:DataSetBuilder.java
示例8: processGeometry
import org.geojson.Feature; //导入依赖的package包/类
private void processGeometry(final Feature feature, final GeoJsonObject geometry) {
if (geometry instanceof Feature) {
processGeometry((Feature) geometry, ((Feature) geometry).getGeometry());
} else {
if (geometry instanceof Point) {
processPoint(feature, ((Point) geometry).getCoordinates());
} else if (geometry instanceof LineString) {
processLineString(feature, ((LineString) geometry).getCoordinates());
} else if (geometry instanceof Polygon) {
processPolygon(feature, ((Polygon) geometry).getCoordinates());
} else if (geometry instanceof MultiPoint) {
processMultiPoint(feature, (MultiPoint) geometry);
} else if (geometry instanceof MultiLineString) {
processMultiLineString(feature, (MultiLineString) geometry);
} else if (geometry instanceof MultiPolygon) {
processMultiPolygon(feature, (MultiPolygon) geometry);
} else if (geometry instanceof GeometryCollection) {
processGeometryCollection(feature, (GeometryCollection) geometry);
}
}
}
开发者ID:JOSM,项目名称:geojson,代码行数:22,代码来源:DataSetBuilder.java
示例9: handleMissingTypeId
import org.geojson.Feature; //导入依赖的package包/类
@Override
public JavaType handleMissingTypeId(DeserializationContext ctxt, JavaType baseType, TypeIdResolver idResolver,
String failureMsg) throws IOException {
if (baseType.getRawClass() == Feature.class) {
return idResolver.typeFromId(ctxt, "Feature");
}
return super.handleMissingTypeId(ctxt, baseType, idResolver, failureMsg);
}
开发者ID:dbmdz,项目名称:iiif-apis,代码行数:9,代码来源:ProblemHandler.java
示例10: serialize
import org.geojson.Feature; //导入依赖的package包/类
@Override
public String serialize(Object object) throws JsonProcessingException {
if (object == null || !GeoJsonObject.class.isAssignableFrom(object.getClass())) {
return null;
}
GeoJsonObject geoJson = (GeoJsonObject) object;
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.addMixIn(Feature.class, FeatureMixIn.class);
return mapper.writeValueAsString(geoJson);
}
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:12,代码来源:GeoJsonSerializer.java
示例11: report
import org.geojson.Feature; //导入依赖的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;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:39,代码来源:PublicWolfReportFeature.java
示例12: exportClubAreaFeatures
import org.geojson.Feature; //导入依赖的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;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:29,代码来源:AreaPrintFeature.java
示例13: extractMetsahallitusHirvi
import org.geojson.Feature; //导入依赖的package包/类
private static Set<Integer> extractMetsahallitusHirvi(final FeatureCollection featureCollection) {
return featureCollection.getFeatures().stream()
.map(Feature::getId)
.filter(Objects::nonNull)
.filter(id -> id.startsWith(GeoJSONConstants.ID_PREFIX_MH_HIRVI))
.map(id -> id.substring(GeoJSONConstants.ID_PREFIX_MH_HIRVI.length()))
.map(Integer::parseInt)
.collect(Collectors.toSet());
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:10,代码来源:HuntingClubAreaZoneFeature.java
示例14: mapRow
import org.geojson.Feature; //导入依赖的package包/类
@Override
public Feature mapRow(ResultSet resultSet, int i) throws SQLException {
final Feature feature = new Feature();
feature.setId(String.valueOf(resultSet.getLong("id")));
feature.setGeometry(GISUtils.parseGeoJSONGeometry(objectMapper, resultSet.getString("geom")));
feature.setProperty(GeoJSONConstants.PROPERTY_NUMBER, StringUtils.leftPad(Long.toString(resultSet.getLong("tunnus")), 14, '0'));
feature.setProperty(GeoJSONConstants.PROPERTY_SIZE, resultSet.getDouble("area_size"));
return feature;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:12,代码来源:GISPropertyGeometryRepository.java
示例15: getHirviFeature
import org.geojson.Feature; //导入依赖的package包/类
@Override
@Transactional(readOnly = true)
public Feature getHirviFeature(final int id, final GISUtils.SRID srid) {
final MapSqlParameterSource params = new MapSqlParameterSource()
.addValue("id", id)
.addValue("srid", srid.getValue())
.addValue("simplify", SIMPLIFY_AMOUNT);
final String sql = SELECT_MH_HIRVI + " FROM mh_hirvi mh WHERE gid = :id;";
return namedParameterJdbcTemplate.queryForObject(sql, params, ROW_MAPPER_HIRVI);
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:13,代码来源:GISMetsahallitusRepositoryImpl.java
示例16: listZoneHirviFeatures
import org.geojson.Feature; //导入依赖的package包/类
@Override
@Transactional(readOnly = true)
public List<Feature> listZoneHirviFeatures(final long zoneId, final GISUtils.SRID srid) {
final MapSqlParameterSource params = new MapSqlParameterSource()
.addValue("zoneId", zoneId)
.addValue("srid", srid.getValue())
.addValue("simplify", SIMPLIFY_AMOUNT);
final String sql = SELECT_MH_HIRVI +
" FROM zone_mh_hirvi zmh" +
" JOIN mh_hirvi mh ON (zmh.mh_hirvi_id = mh.gid) " +
" WHERE zmh.zone_id = :zoneId;";
return namedParameterJdbcTemplate.query(sql, params, ROW_MAPPER_HIRVI);
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:16,代码来源:GISMetsahallitusRepositoryImpl.java
示例17: mapResultToFeature
import org.geojson.Feature; //导入依赖的package包/类
@Nonnull
private Feature mapResultToFeature(final ResultSet rs) throws SQLException {
final Feature feature = new Feature();
feature.setId(Long.toString(rs.getLong("id")));
feature.setGeometry(GISUtils.parseGeoJSONGeometry(objectMapper, rs.getString("geom")));
feature.setBbox(new double[]{
rs.getDouble("xmin"), rs.getDouble("ymin"),
rs.getDouble("xmax"), rs.getDouble("ymax")});
return feature;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:13,代码来源:GetCombinedFeatureCollectionQuery.java
示例18: execute
import org.geojson.Feature; //导入依赖的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;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:15,代码来源:GetPalstaFeatureCollectionQuery.java
示例19: getExcludedAsGeoJSON
import org.geojson.Feature; //导入依赖的package包/类
public Optional<Feature> getExcludedAsGeoJSON(final String excludedId) {
return Optional.ofNullable(this.excludedGeom)
.map(PolygonConversionUtil::javaToGeoJSON)
.map(g -> {
final Feature excluded = new Feature();
excluded.setId(excludedId);
excluded.setGeometry(g);
return excluded;
});
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:11,代码来源:GISZone.java
示例20: polygonUnion
import org.geojson.Feature; //导入依赖的package包/类
public static Geometry polygonUnion(final FeatureCollection features, final GISUtils.SRID srid) {
final Geometry[] geometries = features.getFeatures().stream()
.map(Feature::getGeometry)
.filter(Objects::nonNull)
.map(geom -> PolygonConversionUtil.geoJsonToJava(geom, srid))
.filter(Objects::nonNull)
.toArray(Geometry[]::new);
return geometries.length > 0 ? getGeometryFactory(srid).createGeometryCollection(geometries).union() : null;
}
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:11,代码来源:GISUtils.java
注:本文中的org.geojson.Feature类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论