/** * Build a bounding box feature. * In this case, it has a name but is empty. * * @param id the ID string * @return the Feature for the new bounds */ public static Feature createBounds(final String id) { final Feature feature = new Feature(); feature.setId(id); feature.setGeometry(new Polygon()); return feature; }
/** * Convert a Point and LocationType into a Feature. * * @param point the Point * @param locationType the LocationType * @return the Feature */ private static Feature createLocation(final Point point, final LocationType locationType) { final Feature location = new Feature(); location.setGeometry(point); location.setProperty("locationType", locationType); location.setId("location"); return location; }
/** * Create a GeoJSON Point from a LatLng. * * @param latLng the LatLng * @param locationType the location type * @return the GeoServiceLatLng */ default Feature toLocationFeature(final LatLng latLng, final LocationType locationType) { if (latLng == null) { final Feature feature = new Feature(); feature.setProperty("locationType", locationType); feature.setId("location"); return feature; } final Point point = new Point(latLng.lng, latLng.lat); final Feature feature = new Feature(); feature.setGeometry(point); feature.setProperty("locationType", locationType); feature.setId("location"); return feature; } }
final LngLatAlt southwest, final LngLatAlt northeast) { final Feature feature = new Feature(); feature.setId(id); if (northeast == null || southwest == null) {
private Feature buildFeature() { Feature feature = new Feature(); feature.setGeometry(new Point(Math.random() * 360 - 180, Math.random() * 180 - 90)); feature.setProperty("key", instanceIdSeq.getAndIncrement()); feature.setProperty("field", "some-field"); feature.setProperty("empty", "no"); feature.setProperty("valid", "yes"); return feature; } }