Thanks, Jeroen! I am a couple of weeks or a month out from needing to try
to implement this, but thought I would start asking early. If you don't
mind, I may come back to you with a question or two once I start trying to
create something like this for my own use.
- Mike Grogan
On Fri, Nov 14, 2014 at 5:21 AM, Jeroen Dries <[email protected]> wrote:
> Hi Mike,
>
>
>
> these are the ingredients:
>
> -Create an extension of BaseCoverageResponseDelegate
>
> -Register it in a custom applicationContext so Spring picks it up:
>
> <bean id="timeseriesJSON" class="myPackage.TimeSeriesJsonOutput">
>
> <constructor-arg ref="geoServer"/>
>
> </bean>
>
> -when calling the super constructor, register your custom mime type
>
> -Use reflection to work around the issue with mdFormats
>
> -The GridCoverage2D which is passed into the encode method can now be cast
> to a GranuleStack, which should contain a coverage for each instant in your
> time series.
>
> -Encode the values of these coverages to your liking, if the WCS request
> comes down to a single pixel, you can simply return those pixel values as a
> json object.
>
>
>
> This is an example of the type of WCS request that I use:
>
>
> http://myhost/geoserver/wcs?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&coverageId=workspaceX-myCoverage&FORMAT=application/json&subset=X,http://www.opengis.net/def/crs/EPSG/0/3857(474094.3071525846,474144.3071525846)&subset=Y,http://www.opengis.net/def/crs/EPSG/0/3857(6609749.836034014,6609799.836034014)
>
>
>
> Below is some sample code which contains the mdFormats hack.
>
>
>
> best regards,
>
> Jeroen
>
>
>
> public class TimeSeriesJsonOutput extends BaseCoverageResponseDelegate
> implements
>
> CoverageResponseDelegate {
>
>
>
> private final static String MIME_TYPE = "application/json";
>
> static{
>
> try {
>
> Field field = GetCoverage.class.getDeclaredField("mdFormats");
>
> field.setAccessible(true);
>
> ((Set<String>)field.get(null)).add(MIME_TYPE);
>
> } catch (NoSuchFieldException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> } catch (SecurityException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> } catch (IllegalArgumentException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> } catch (IllegalAccessException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> }
>
> }
>
>
>
> public static final Logger LOGGER =
> Logging.getLogger(TimeSeriesJsonOutput.class.getName());
>
>
>
> @SuppressWarnings("serial")
>
> public TimeSeriesJsonOutput(GeoServer geoserver) {
>
> super(geoserver, Arrays.asList("TSJSON"), // output formats
>
> new HashMap<String, String>() { // file extensions
>
> {
>
> put("TSJSON", "json");
>
> put(MIME_TYPE, "json");
>
> }
>
> }, new HashMap<String, String>() { // mime types
>
> {
>
> put("TSJSON", MIME_TYPE);
>
> }
>
> });
>
> }
>
>
>
>
>
> public void encode(GridCoverage2D sourceCoverage, String outputFormat,
>
> Map<String, String> econdingParameters, OutputStream output) throws
> ServiceException,
>
> IOException {
>
>
>
> On Wednesday 12 November 2014 11:39:34 Mike Grogan wrote:
>
> > Wow, I was out for the day after sending this, and I came back to some
>
> > great responses. Thanks, everyone.
>
> >
>
> > Jeroen, any tips you have would be greatly appreciated. I see you have a
>
> > JIRA open on registering custom MIME types ... so any workaround like
> that
>
> > would be great advice. Code pointers, etc. would be most welcome.
>
> >
>
> > Jukka and Andrea,
>
> >
>
> > Thanks for weighing in, too. As I have told Andrea personally, I think
>
> > GeoSolutions is doing a really good job expanding GeoServer into better
>
> > serving Meteorology / Oceanography data needs. From the model data
>
> > perspective, visualizing data for all gridcells at a time is important,
> but
>
> > displaying all data at a point across all forecast times is also
> important,
>
> > and that is the scope of my current problem. I could write some 'sidecar'
>
> > application to do this from the same data used by the Image Mosaic, but I
>
> > would rather incorporate it into GeoServer via plugin, custom code, etc.
>
> >
>
> > Thanks,
>
> >
>
> > Mike
>
> >
>
> > On Wed, Nov 12, 2014 at 4:44 AM, Jeroen Dries <[email protected]>
> wrote:
>
> > > Hi Jukka,
>
> > >
>
> > > indeed I use a WCS 2.0 range query to select a point, this does mean
> that
>
> > > the
>
> > > client request needs to be adapted to the resolution of the coverage.
> In
>
> > > case
>
> > > the area matches multiple pixels, I plan to compute the average band
> value
>
> > > over all pixels, because that is also a valid use case.
>
> > >
>
> > > I have also used range subsetting for band selection, although I did
>
> > > encounter
>
> > > some inconsistencies in the geoserver implementation which I had to
> work
>
> > > around, but this may have been specific to my custom data backend.
>
> > >
>
> > > best regards,
>
> > > Jeroen
>
> > >
>
> > > On Wednesday 12 November 2014 09:29:55 Rahkonen Jukka wrote:
>
> > > > Hi,
>
> > > >
>
> > > > Well, I was thinking simply X and Y for giving the point to be
> queried
>
> > > > because I thought that BBOX can't be a point. But I have mostly used
> WCS
>
> > > > 1.0.0. Is it so that in WCS 2.0 core the "slicePoint" can be used for
>
> > >
>
> > > this?
>
> > >
>
> > > > And standard range subsetting can be used for selecting what is
> queried,
>
> > > > like list of bands from multiband satellite images?
>
> > > >
>
> > > > -Jukka Rahkonen-
>
> > > >
>
> > > >
>
> > > > Jeroen Dries wrote:
>
> > > >
>
> > > >
>
> > > > Hello,
>
> > > >
>
> > > >
>
> > > >
>
> > > > for my use case, the standard WCS 2.0 options were sufficient, only
> the
>
> > > > outputformat is not described by a standard, but that's not so
> relevant
>
> > >
>
> > > as
>
> > >
>
> > > > it's plain text json.
>
> > > >
>
> > > >
>
> > > >
>
> > > > If you are thinking about more complex queries, than you can have a
> look
>
> > >
>
> > > at
>
> > >
>
> > > > http://www.opengeospatial.org/standards/wcps . (Do note that
> writing a
>
> > >
>
> > > full
>
> > >
>
> > > > implementation would be very complex, and also the queries which you
>
> > > > have
>
> > > > to send as a client can become quite
>
> > > > large.)<http://www.opengeospatial.org/standards/wcps>
>
> > > >
>
> > > >
>
> > > >
>
> > > > What type of vendor options were you thinking
>
> > > > about?<http://www.opengeospatial.org/standards/wcps>
>
> > > >
>
> > > >
>
> > > >
>
> > > > best regards,<http://www.opengeospatial.org/standards/wcps>
>
> > > >
>
> > > > Jeroen<http://www.opengeospatial.org/standards/wcps>
>
> > > >
>
> > > > On Wednesday 12 November 2014 08:39:31 Rahkonen Jukka wrote:
>
> > > > > Hi,
>
> > > > >
>
> > > > >
>
> > > > >
>
> > > > > Sounds interesting. There might be more use for such queries from
>
> > > > >
>
> > > > > multidimensional coverages.
>
> > > > >
>
> > > > >
>
> > > > >
>
> > > > > Have you been thinking what could be the best way to enhance WCS
> with
>
> > >
>
> > > such
>
> > >
>
> > > > > new query type "GetCoverageInfo" in some close-to-standard way?
> Could
>
> > >
>
> > > it
>
> > >
>
> > > > > be
>
> > > > >
>
> > > > > a special outputformat as you did plus some vendor option
>
> > > > >
>
> > > > > "CoverageInfoParameters"?
>
> > > > >
>
> > > > >
>
> > > > >
>
> > > > > -Jukka Rahkonen-
>
> > > > >
>
> > > > > > -----Alkuperäinen viesti-----
>
> > > > > >
>
> > > > > > Lähettäjä: Jeroen Dries [mailto:[email protected]]
>
> > > > > >
>
> > > > > > Lähetetty: 12. marraskuuta 2014 9:57
>
> > > > > >
>
> > > > > > Vastaanottaja:
>
> > >
>
> > > > > > [email protected]<mailto:
>
> > > [email protected]
>
> > >
>
> > > > > > ceforge.net>
>
> > > > > >
>
> > > > > > Aihe: Re: [Geoserver-users] WMS GetFeatureInfo & Time Series Data
>
> > > > > >
>
> > > > > >
>
> > > > > >
>
> > > > > > Hi Mike,
>
> > > > > >
>
> > > > > >
>
> > > > > >
>
> > > > > > I had exactly the same problem. I solved it using the
>
> > >
>
> > > multidimensional
>
> > >
>
> > > > > > outputformat support in the geoserver WCS implementation. I
> wrote a
>
> > > > > > custom
>
> > > > > >
>
> > > > > > multidimensional outputformat encoder, which encodes to json.
> Then I
>
> > > > > > send
>
> > > > > >
>
> > > > > > WCS GetCoverage requests to geoserver, using something like
>
> > > > > > 'custom/json'
>
> > > > > >
>
> > > > > > as the outputformat.
>
> > > > > >
>
> > > > > >
>
> > > > > >
>
> > > > > > My outputformat code then receives a 'GranuleStack', which I
> encode
>
> > >
>
> > > to
>
> > >
>
> > > > > > json.
>
> > > > > >
>
> > > > > >
>
> > > > > >
>
> > > > > > If you're interested in this approach, I can lookup some code
>
> > >
>
> > > pointers
>
> > >
>
> > > > > > and
>
> > > > > >
>
> > > > > > possible workarounds that were needed to get this to work.
>
> > > > > >
>
> > > > > >
>
> > > > > >
>
> > > > > > best regards,
>
> > > > > >
>
> > > > > > Jeroen
>
> > > > > >
>
> > > > > > On Monday 10 November 2014 11:34:24 Mike Grogan wrote:
>
> > > > > > > With a time-enabled image mosaic as the data store, is there an
>
> > >
>
> > > easy
>
> > >
>
> > > > > > > way to get multiple return values for time series raster data
> via
>
> > > > > > >
>
> > > > > > > GetFeatureInfo (or anything else available on GeoServer)?
>
> > > > > > >
>
> > > > > > >
>
> > > > > > >
>
> > > > > > > For instance, in one request I would like to get all values
> for a
>
> > >
>
> > > grid
>
> > >
>
> > > > > > > cell for all times available in the mosaic. So, say I have
> hourly
>
> > > > > > >
>
> > > > > > > rasters covering a 24 hour period, I would like to return the
> 24
>
> > > > > > >
>
> > > > > > > hourly values at a particular lat/lon in a single request.
>
> > > > > > >
>
> > > > > > >
>
> > > > > > >
>
> > > > > > > Thanks,
>
> > > > > > >
>
> > > > > > >
>
> > > > > > >
>
> > > > > > > Mike Grogan
>
> > >
>
> > >
> ------------------------------------------------------------------------
>
> > >
>
> > > > > > --
>
> > > > > >
>
> > > > > > ---- Comprehensive Server Monitoring with Site24x7.
>
> > > > > >
>
> > > > > > Monitor 10 servers for $9/Month.
>
> > > > > >
>
> > > > > > Get alerted through email, SMS, voice calls or mobile push
>
> > > > > > notifications.
>
> > > > > >
>
> > > > > > Take corrective actions from your mobile device.
>
> > >
>
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.cl
>
> > >
>
> > > > > > kt
>
> > > > > >
>
> > > > > > r
>
> > > > > >
>
> > > > > > k
>
> > > > > >
>
> > > > > > _______________________________________________
>
> > > > > >
>
> > > > > > Geoserver-users mailing list
>
> > >
>
> > > > > > [email protected]<mailto:
>
> > > [email protected]
>
> > >
>
> > > > > > eforge.net>
>
> > > > > >
>
> > > > > > https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
> > >
>
> > >
> --------------------------------------------------------------------------
>
> > >
>
> > > > > --
>
> > > > >
>
> > > > > -- Comprehensive Server Monitoring with Site24x7.
>
> > > > >
>
> > > > > Monitor 10 servers for $9/Month.
>
> > > > >
>
> > > > > Get alerted through email, SMS, voice calls or mobile push
>
> > >
>
> > > notifications.
>
> > >
>
> > > > > Take corrective actions from your mobile device.
>
> > >
>
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clkt
>
> > >
>
> > > > > rk
>
> > > > >
>
> > > > > _______________________________________________
>
> > > > >
>
> > > > > Geoserver-users mailing list
>
> > >
>
> > > > > [email protected]<mailto:
>
> > > [email protected]
>
> > >
>
> > > > > orge.net>
>
> > > > >
>
> > > > > https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
> > >
>
> > >
> --------------------------------------------------------------------------
>
> > > ---- Comprehensive Server Monitoring with Site24x7.
>
> > > Monitor 10 servers for $9/Month.
>
> > > Get alerted through email, SMS, voice calls or mobile push
> notifications.
>
> > > Take corrective actions from your mobile device.
>
> > >
>
> > >
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clkt
>
> > > rk _______________________________________________
>
> > > Geoserver-users mailing list
>
> > > [email protected]
>
> > > https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
>
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users