I am creating a GeoDMS configuration that reads GTFS files (which are stored in csv format), constructs a spatiotemporally explicit network out of those files, and then computes OD traveltime matrices based on that network.
I am currently reading the csv files using the StorageType = "gdal.grid" property, which is useful because in that manner I do not have to specify the length of the csv file a-priori. However, to speed up the computation I would like to convert the raw csv files into GeoDMS-native fss files, as that would significantly speed up the data reading.
However if I am not mistaken, I would need to explicitly define all attributes I would like to store into the fss file, correct? In short, is there any example code out there in which csv files are stored into fss files?
Currently loading the csv files, and storing the intermediate results into a shapefile.. but that is not very elegant. Ideally I get my hands on a function that 'copies' csv files into fss files without having to know cardinality or fieldnames a-priori. If I need to specify all field names that would not be a problem either.
Currently attempting the following very naive, which does not work.
Template LoadCsvThroughGDAL {
parameter<File_Structure> inFile;
unit<uint32> Data: StorageName = "= '%DataDir%/_feeds/'+AvailableFeeds/Name[inFeed]+'/'+File_Structure/Name[inFile]+'.csv'", StorageType = "gdal.vect", StorageReadOnly = "True";
unit<uint32> StoreFSS: expr = "Data", StorageName = "= '%DataDir%/_feeds/'+AvailableFeeds/Name[inFeed]+'/fss/'+File_Structure/Name[inFile]+'.fss'";
}
Chris,
Hereby a working example for:
1) reading data from a .csv file
2) writing the data to a .fss file
3) reading the data again from this .fss file
without having to explicitly configure the attribute names.
parameter<string> SourceDir := '%SourceDataDir%/OV/GTFS_20190318';
container write_to_fss
{
unit<uint32> trip
: StorageName = "=SourceDir + '/trips.csv'"
, StorageType = "gdal.vect"
, StorageReadOnly = "True";
unit<uint32> name := SubItem_PropValues(trip,'name');
unit<uint32> fssdomain := trip;
container to_fss := for_each_nedv(name/name, 'trip/' + name/name, fssdomain, string)
, StorageName = "=SourceDir + '/trip.fss'"
{
unit<uint32> domain := fssdomain;
}
}
container readdomain: StorageName = "=SourceDir + '/trip.fss'"
, StorageReadOnly = "True"
{
unit<uint32> domain;
}
container trip := for_each_ndv(write_to_fss/name/name, readdomain/domain, string)
, StorageName = "=SourceDir + '/trip.fss'"
, StorageReadOnly = "True"
{
unit<uint32> domain;
}