Search in sources :

Example 1 with TimeDefinition

use of org.locationtech.geowave.core.geotime.index.dimension.TimeDefinition in project geowave by locationtech.

the class TemporalDimensionalityTypeProvider method createIndexFromOptions.

public static Index createIndexFromOptions(final TemporalOptions options) {
    if (!options.noTimeRanges) {
        final NumericDimensionDefinition[] dimensions = TEMPORAL_DIMENSIONS;
        final NumericDimensionField<?>[] fields = TEMPORAL_FIELDS;
        dimensions[dimensions.length - 1] = new TimeDefinition(options.periodicity);
        fields[dimensions.length - 1] = new TimeField(options.periodicity);
        final BasicIndexModel indexModel = new BasicIndexModel(fields);
        final String combinedArrayID = DEFAULT_TEMPORAL_ID_STR + "_" + options.periodicity;
        return new CustomNameIndex(XZHierarchicalIndexFactory.createFullIncrementalTieredStrategy(dimensions, new int[] { 63 }, SFCType.HILBERT, options.maxDuplicates), indexModel, combinedArrayID);
    }
    final BasicIndexModel indexModel = new BasicIndexModel(new NumericDimensionField[] { new BasicNumericDimensionField<>(TimeField.DEFAULT_FIELD_ID, Long.class) });
    return new CustomNameIndex(new SimpleTimeIndexStrategy(), indexModel, DEFAULT_TEMPORAL_ID_STR);
}
Also used : BasicNumericDimensionField(org.locationtech.geowave.core.store.dimension.BasicNumericDimensionField) NumericDimensionField(org.locationtech.geowave.core.store.dimension.NumericDimensionField) TimeField(org.locationtech.geowave.core.geotime.store.dimension.TimeField) NumericDimensionDefinition(org.locationtech.geowave.core.index.dimension.NumericDimensionDefinition) BasicIndexModel(org.locationtech.geowave.core.store.index.BasicIndexModel) TimeDefinition(org.locationtech.geowave.core.geotime.index.dimension.TimeDefinition) SimpleTimeDefinition(org.locationtech.geowave.core.geotime.index.dimension.SimpleTimeDefinition) CustomNameIndex(org.locationtech.geowave.core.store.index.CustomNameIndex) SimpleTimeIndexStrategy(org.locationtech.geowave.core.geotime.index.dimension.SimpleTimeIndexStrategy)

Example 2 with TimeDefinition

use of org.locationtech.geowave.core.geotime.index.dimension.TimeDefinition in project geowave by locationtech.

the class SpatialTemporalDimensionalityTypeProvider method isSpatialTemporal.

public static boolean isSpatialTemporal(final NumericIndexStrategy indexStrategy) {
    if ((indexStrategy == null) || (indexStrategy.getOrderedDimensionDefinitions() == null)) {
        return false;
    }
    final NumericDimensionDefinition[] dimensions = indexStrategy.getOrderedDimensionDefinitions();
    if (dimensions.length < 3) {
        return false;
    }
    boolean hasLat = false, hasLon = false, hasTime = false;
    for (final NumericDimensionDefinition definition : dimensions) {
        if (definition instanceof TimeDefinition) {
            hasTime = true;
        } else if (SpatialIndexUtils.isLatitudeDimension(definition)) {
            hasLat = true;
        } else if (SpatialIndexUtils.isLongitudeDimension(definition)) {
            hasLon = true;
        }
    }
    return hasTime && hasLat && hasLon;
}
Also used : NumericDimensionDefinition(org.locationtech.geowave.core.index.dimension.NumericDimensionDefinition) TimeDefinition(org.locationtech.geowave.core.geotime.index.dimension.TimeDefinition)

Example 3 with TimeDefinition

use of org.locationtech.geowave.core.geotime.index.dimension.TimeDefinition in project geowave by locationtech.

the class SpatialTemporalDimensionalityTypeProvider method createIndexFromOptions.

public static Index createIndexFromOptions(final SpatialTemporalOptions options) {
    NumericDimensionDefinition[] dimensions;
    NumericDimensionField<?>[] fields = null;
    CoordinateReferenceSystem crs = null;
    boolean isDefaultCRS;
    String crsCode = null;
    final Integer geometryPrecision = options.getGeometryPrecision();
    if ((options.crs == null) || options.crs.isEmpty() || options.crs.equalsIgnoreCase(GeometryUtils.DEFAULT_CRS_STR)) {
        dimensions = SPATIAL_TEMPORAL_DIMENSIONS;
        fields = getSpatialTemporalFields(geometryPrecision);
        isDefaultCRS = true;
        crsCode = "EPSG:4326";
    } else {
        crs = GeometryUtils.decodeCRS(options.crs);
        final CoordinateSystem cs = crs.getCoordinateSystem();
        isDefaultCRS = false;
        crsCode = options.crs;
        dimensions = new NumericDimensionDefinition[cs.getDimension() + 1];
        fields = new NumericDimensionField[dimensions.length];
        for (int d = 0; d < (dimensions.length - 1); d++) {
            final CoordinateSystemAxis csa = cs.getAxis(d);
            if (!isUnbounded(csa)) {
                if (d == 0) {
                    dimensions[d] = new CustomCRSBoundedSpatialDimensionX(csa.getMinimumValue(), csa.getMaximumValue());
                    fields[d] = new CustomCRSSpatialField((CustomCRSBoundedSpatialDimensionX) dimensions[d], geometryPrecision, crs);
                }
                if (d == 1) {
                    dimensions[d] = new CustomCRSBoundedSpatialDimensionY(csa.getMinimumValue(), csa.getMaximumValue());
                    fields[d] = new CustomCRSSpatialField((CustomCRSBoundedSpatialDimensionY) dimensions[d], geometryPrecision, crs);
                }
            } else {
                if (d == 0) {
                    dimensions[d] = new CustomCRSUnboundedSpatialDimensionX(DEFAULT_UNBOUNDED_CRS_INTERVAL, (byte) d);
                    fields[d] = new CustomCRSSpatialField((CustomCRSUnboundedSpatialDimensionX) dimensions[d], geometryPrecision, crs);
                }
                if (d == 1) {
                    dimensions[d] = new CustomCRSUnboundedSpatialDimensionY(DEFAULT_UNBOUNDED_CRS_INTERVAL, (byte) d);
                    fields[d] = new CustomCRSSpatialField((CustomCRSUnboundedSpatialDimensionY) dimensions[d], geometryPrecision, crs);
                }
            }
        }
        dimensions[dimensions.length - 1] = new TimeDefinition(options.periodicity);
        fields[dimensions.length - 1] = new TimeField(options.periodicity);
    }
    BasicIndexModel indexModel = null;
    if (isDefaultCRS) {
        indexModel = new BasicIndexModel(fields);
    } else {
        indexModel = new CustomCrsIndexModel(fields, crsCode);
    }
    String combinedArrayID;
    if (isDefaultCRS) {
        combinedArrayID = DEFAULT_SPATIAL_TEMPORAL_ID_STR + "_" + options.bias + "_" + options.periodicity;
    } else {
        combinedArrayID = DEFAULT_SPATIAL_TEMPORAL_ID_STR + "_" + (crsCode.substring(crsCode.indexOf(":") + 1)) + "_" + options.bias + "_" + options.periodicity;
    }
    final String combinedId = combinedArrayID;
    return new CustomNameIndex(XZHierarchicalIndexFactory.createFullIncrementalTieredStrategy(dimensions, new int[] { options.bias.getSpatialPrecision(), options.bias.getSpatialPrecision(), options.bias.getTemporalPrecision() }, SFCType.HILBERT, options.maxDuplicates), indexModel, combinedId);
}
Also used : NumericDimensionField(org.locationtech.geowave.core.store.dimension.NumericDimensionField) NumericDimensionDefinition(org.locationtech.geowave.core.index.dimension.NumericDimensionDefinition) CoordinateSystem(org.opengis.referencing.cs.CoordinateSystem) CoordinateSystemAxis(org.opengis.referencing.cs.CoordinateSystemAxis) CustomCRSSpatialField(org.locationtech.geowave.core.geotime.store.dimension.CustomCRSSpatialField) CustomNameIndex(org.locationtech.geowave.core.store.index.CustomNameIndex) CustomCrsIndexModel(org.locationtech.geowave.core.geotime.store.dimension.CustomCrsIndexModel) TimeField(org.locationtech.geowave.core.geotime.store.dimension.TimeField) CustomCRSBoundedSpatialDimensionX(org.locationtech.geowave.core.geotime.store.dimension.CustomCRSBoundedSpatialDimensionX) CustomCRSBoundedSpatialDimensionY(org.locationtech.geowave.core.geotime.store.dimension.CustomCRSBoundedSpatialDimensionY) BasicIndexModel(org.locationtech.geowave.core.store.index.BasicIndexModel) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem) CustomCRSUnboundedSpatialDimensionY(org.locationtech.geowave.core.geotime.store.dimension.CustomCRSUnboundedSpatialDimensionY) TimeDefinition(org.locationtech.geowave.core.geotime.index.dimension.TimeDefinition) CustomCRSUnboundedSpatialDimensionX(org.locationtech.geowave.core.geotime.store.dimension.CustomCRSUnboundedSpatialDimensionX)

Aggregations

TimeDefinition (org.locationtech.geowave.core.geotime.index.dimension.TimeDefinition)3 NumericDimensionDefinition (org.locationtech.geowave.core.index.dimension.NumericDimensionDefinition)3 TimeField (org.locationtech.geowave.core.geotime.store.dimension.TimeField)2 NumericDimensionField (org.locationtech.geowave.core.store.dimension.NumericDimensionField)2 BasicIndexModel (org.locationtech.geowave.core.store.index.BasicIndexModel)2 CustomNameIndex (org.locationtech.geowave.core.store.index.CustomNameIndex)2 SimpleTimeDefinition (org.locationtech.geowave.core.geotime.index.dimension.SimpleTimeDefinition)1 SimpleTimeIndexStrategy (org.locationtech.geowave.core.geotime.index.dimension.SimpleTimeIndexStrategy)1 CustomCRSBoundedSpatialDimensionX (org.locationtech.geowave.core.geotime.store.dimension.CustomCRSBoundedSpatialDimensionX)1 CustomCRSBoundedSpatialDimensionY (org.locationtech.geowave.core.geotime.store.dimension.CustomCRSBoundedSpatialDimensionY)1 CustomCRSSpatialField (org.locationtech.geowave.core.geotime.store.dimension.CustomCRSSpatialField)1 CustomCRSUnboundedSpatialDimensionX (org.locationtech.geowave.core.geotime.store.dimension.CustomCRSUnboundedSpatialDimensionX)1 CustomCRSUnboundedSpatialDimensionY (org.locationtech.geowave.core.geotime.store.dimension.CustomCRSUnboundedSpatialDimensionY)1 CustomCrsIndexModel (org.locationtech.geowave.core.geotime.store.dimension.CustomCrsIndexModel)1 BasicNumericDimensionField (org.locationtech.geowave.core.store.dimension.BasicNumericDimensionField)1 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)1 CoordinateSystem (org.opengis.referencing.cs.CoordinateSystem)1 CoordinateSystemAxis (org.opengis.referencing.cs.CoordinateSystemAxis)1