Skip to content
Permalink
Browse files

Auto setup temporal handling for temporal AFS layers

  • Loading branch information
nyalldawson committed May 7, 2020
1 parent 731ad8d commit f8a1f377f2befac897e1bbbd5c3f92683e947f66
Showing with 23 additions and 0 deletions.
  1. +23 −0 src/providers/arcgisrest/qgsafsprovider.cpp
@@ -191,6 +191,29 @@ QgsAfsProvider::QgsAfsProvider( const QString &uri, const ProviderOptions &optio
}
mSharedData->mGeometryType = QgsWkbTypes::zmType( mSharedData->mGeometryType, hasZ, hasM );

// read temporal properties
if ( layerData.contains( QStringLiteral( "timeInfo" ) ) )
{
const QVariantMap timeInfo = layerData.value( QStringLiteral( "timeInfo" ) ).toMap();

temporalCapabilities()->setHasTemporalCapabilities( true );
temporalCapabilities()->setStartField( timeInfo.value( QStringLiteral( "startTimeField" ) ).toString() );
temporalCapabilities()->setEndField( timeInfo.value( QStringLiteral( "endTimeField" ) ).toString() );
if ( !temporalCapabilities()->endField().isEmpty() )
temporalCapabilities()->setMode( QgsVectorDataProviderTemporalCapabilities::ProviderStoresFeatureDateTimeStartAndEndInSeparateFields );
else if ( !temporalCapabilities()->startField().isEmpty() )
temporalCapabilities()->setMode( QgsVectorDataProviderTemporalCapabilities::ProviderStoresFeatureDateTimeInstantInField );
else
temporalCapabilities()->setMode( QgsVectorDataProviderTemporalCapabilities::ProviderHasFixedTemporalRange );

const QVariantList extent = timeInfo.value( QStringLiteral( "timeExtent" ) ).toList();
if ( extent.size() == 2 )
{
temporalCapabilities()->setAvailableTemporalRange( QgsDateTimeRange( QgsArcGisRestUtils::parseDateTime( extent.at( 0 ) ),
QgsArcGisRestUtils::parseDateTime( extent.at( 1 ) ) ) );
}
}

// Read OBJECTIDs of all features: these may not be a continuous sequence,
// and we need to store these to iterate through the features. This query
// also returns the name of the ObjectID field.

0 comments on commit f8a1f37

Please sign in to comment.
You can’t perform that action at this time.