|
$webwork.htmlEncode($page.space.name) : 02-Time Templates
This page last changed on Aug 08, 2007 by jdeolive.
Supplement KML with Temporal Information
Getting Started Getting StartedFirst we need to setup some temporal data. For this tutorial we will using a Shapefile which contains information about the number of internet users in the countries of western Europe.
Checking the SetupIf all is configured properly you should be able to navigate to http://localhost:8080/geoserver/wms/reflect?layers=topp:inet_weu&format=openlayers&bbox=-33.780,26.266,21.005,56.427 and see the following map:
Creating the TemplateNext we will create a template which allows us to specify the temporal aspects of the dataset. The schema of our dataset looks like:
The temporal attribute is RPT_YEAR and is the one that matters to us. Ok, time to create the template.
See the Reference section for more information about specifying a date format. Trying it OutOk time to try it out.
ReferenceSpecifying a Date FormatWhen setting up a time template for your own dataset the most important issue is the format of your temporal data. It may or may not be in a format in which GeoServer can read directly. While GeoServer will try its best to parse the data there are cases in which your data is in a format which it cannot parse. When this occurs it is necessary to explicitly specify the format. Luckily Freemarker provides us with functionality to do just this. Consider the date time 12:30 on January 01, 2007 specified in the following format: 01?01%2007&12$30!00. When creating the template we need to explicitly tell Freemarker the format the date time is in with the datetime function. ${}?datetime("M?d%y&H:m:s")
The process is similar for dates (no time). The date 01?01%2007 would be specified in a template as: ${}?date("M?d%y")
So when must you specify the date format in this manner? The following table illustrates the date formats that GeoServer can understand:
Specifying a Date RangeIn the above example a single time stamp is output for the dataset. GeoServer also supports specifying date ranges via a template. The syntax for ranges is: <begin>||<end> Where begin is the first date in the range, end is the last date in the range, and || is the delimiter between the two. As an example: 01/01/2007||06/01/2007 Would the date range starting at January 1, 2007 and ending June 1, 2007. Date ranges can also be open ended: ||06/01/2007 06/01/2007|| The first date specifies a date range where the beginning is open-ended. The second specifies a date range where the end is open-ended. |
| Document generated by Confluence on Jan 16, 2008 23:28 |