Geographic Information Systems Asked by apricity on March 11, 2021
I have Time Dimension Working with an Image Mosaic layer. Is it possible to add dimensions other than time/elevation? For example the files in my mosaic are named as follows where rtma or pris represents a “climate” attribute:
pristmax_20150115.tif
pristmax_20150115.tif
rtmatmax_20150116.tif
rtmatmax_20150116.tif
In my mosaic directory, I now have two regex property files (one for time dimension and one for climatesource dimension):
timeregex.properties containing regex=[0-9]{8}
climateregex.properties containing regex=^.{4}
I modified my indexer.properties property file look like so:
TimeAttribute=ingestion
ClimateAttribute=climatesource
Schema=*the_geom:Polygon,location:String,ingestion:java.util.Date,climatesource:String
PropertyCollectors=TimestampFileNameExtractorSPI[timeregex](ingestion),StringFileNameExtractorSPI[climateregex](climatesource)
I also tried modifying postgis_rasters.properties to have a ClimateAttribute:
#-Automagically created from GeoTools-
#Wed Nov 25 13:16:00 MST 2015
Levels=0.026578191679850746,0.026578191679850746
Heterogeneous=false
TimeAttribute=ingestion
ClimateAttribute=climatesource
AbsolutePath=false
Name=postgis_rasters
TypeName=postgis_rasters
Caching=false
ExpandToRGB=false
LocationAttribute=location
SuggestedSPI=it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReaderSpi
CheckAuxiliaryMetadata=false
LevelsNum=1
Geoserver created a table in Postgis as expected:
1 | 0103... | rtmatmax_20150115.tif | 2015-01-14 17:00:00.000000 | rtma
2 | 0103... | pristmax_20150115.tif | 2015-01-14 17:00:00.000000 | pris
But using &climate=rtma or &climate=pris in my url doesn’t effect which raster is retrieved, whereas &time=2015-01-14 or &time=2015-01-15 selects the raster from that day. How can I get the climate attribute to function?
— UPDATE —
After following @rovo’s answer, the new dimension appears in geoserver. Here is a screen cap.
And here is an example the postres side (note my regex was wrong so I currently don’t have what I meant to have under climatesource but this is just a test):
The part I’m not yet able to get working is geoserver seems to be ignoring the CLIMATESOURCE param in my url.
In the getcapabilities I see
<Dimension name="time" units="ISO8601"/>
<Dimension name="CLIMATESOURCE" units=""/>
<Extent name="time" default="2017-07-06T00:00:00Z">2016-01-01T00:00:00.000Z,2016-01-02T00:00:00.000Z...
<Extent name="CLIMATESOURCE" default="agdd_20170706_base_thirtytwo">agdd_20160101_base_fifty,agdd_20160101_base_thirtytwo.....
When using &time=2017-07-06&CLIMATESOURCE=agdd_20170206_base_thirtytwo I get a valid map back because 2017-07-07 happens to match the default for CLIMATESOURCE. When I change time to be anything else it doesn’t return a map because it’s still using the default “agdd_20170706_base_thirtytwo” even if I try overriding CLIMATESOURCE with a matching date.
— UPDATE2 SOLVED —
RoVo’s answer now clarifies to use DIM_CLIMATESOURCE in the WMS request.
ClimateAttribute
is an unknown keyword and will be ignored when the indexer.properties
is read. The correct keyword to add additional dimensions to an Imagemosaic is AdditionalDomainAttributes
.
The following should work adding a new Dimension in the Dimensions tab:
indexer.properties
TimeAttribute=time
AdditionalDomainAttributes=climatesource(climatesource)
PropertyCollectors=TimestampFileNameExtractorSPI[timeregex](time),StringFileNameExtractorSPI[climateregex](climatesource)
Schema=*the_geom:Polygon,location:String,time:java.util.Date,climatesource:String
climateregex.properties
regex=^.{4}
Note: String and Date dimensions are working properly, but due to a bug, Integer or Double Values are read as String only. That makes it not possible yet to query intervals. See this Bug Report.
Update: The bug has been fixed in 2.11.2.
WMS Request:
&DIM_CLIMATESOURCE=...
Correct answer by pLumo on March 11, 2021
Ciao, a few questions plus some pointers.
Some pointers:
Let us know how it goes.
Simone.
Answered by simogeo on March 11, 2021
If you only want to use the extra attribute for filtering you don't have to expose it as a dimension.
Just put this in your indexer.properties file:
TimeAttribute=time
PropertyCollectors=TimestampFileNameExtractorSPI[timeregex](time),StringFileNameExtractorSPI[climateregex](climatesource)
Schema=*the_geom:Polygon,location:String,time:java.util.Date,climatesource:String
and use the ususal CQL_FILTER query parameter. Your attribute will be available for filtering using the name in the Schema definition in indexter.properties, which also corresponds to the column name in the database.
For example you would filter out all "pris" granules using:
&CQL_FILTER=climatesource like 'pris'
(of course you have to urlencode it). One advantage using CQL_FILTER is that you can use more complex filtering.
Also if using dimensions, you don't have to activate it to use the DIM_XYZ query parameter. If you activate it you will have a default filter applied at all times. If you don't activate it you can access the entire mosaic, but filter when you desire.
(A couple of years late, and the case is already solved but I stumbled on this question when trying to do something similar)
Answered by Stefan on March 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP