Search in sources :

Example 1 with SimpleFeatureGeometry

use of de.ii.xtraplatform.geometries.domain.SimpleFeatureGeometry in project ldproxy by interactive-instruments.

the class SchemaDeriverCollectionProperties method getSchemaForGeometry.

@Override
protected JsonSchema getSchemaForGeometry(FeatureSchema schema) {
    JsonSchema jsonSchema;
    SimpleFeatureGeometry type = schema.getGeometryType().orElse(SimpleFeatureGeometry.ANY);
    String baseUrlFormat = "https://geojson.org/schema/%s.json";
    switch(type) {
        case POINT:
        case MULTI_POINT:
        case LINE_STRING:
        case MULTI_LINE_STRING:
        case POLYGON:
        case MULTI_POLYGON:
        case GEOMETRY_COLLECTION:
            jsonSchema = ImmutableJsonSchemaRefExternal.builder().ref(String.format(baseUrlFormat, CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, type.name()))).build();
            break;
        case NONE:
            jsonSchema = JsonSchemaBuildingBlocks.NULL;
            break;
        case ANY:
        default:
            jsonSchema = ImmutableJsonSchemaRefExternal.builder().ref(String.format(baseUrlFormat, "Geometry")).build();
            break;
    }
    return adjustGeometry(schema, jsonSchema);
}
Also used : SimpleFeatureGeometry(de.ii.xtraplatform.geometries.domain.SimpleFeatureGeometry)

Aggregations

SimpleFeatureGeometry (de.ii.xtraplatform.geometries.domain.SimpleFeatureGeometry)1