Changes between Initial Version and Version 1 of DODSExample2


Ignore:
Timestamp:
Jan 27, 2009, 3:36:09 PM (13 years ago)
Author:
jmckenna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DODSExample2

    v1 v1  
     1= DODSExample2 =
     2
     3== DODS Example 2 - Render and Query ==
     4
     5This example is similar to DODSExample1 in how rendering is accomplished. However, in order to produce per-depth reading query results it is necessary to do the queries again the layer in "normalized" form. That is, with each depth reading sub-sequence record at a profile point treated as a feature.
     6
     7To accomplish this we need to provide hint "AIS" information to the OGR driver to tell it what strategies to use for the layers. The .das file for this looks like this:
     8{{{
     9natl_prof_bot.cdp.das:
     10
     11Attributes {
     12    ogr_layer_info_1 {
     13        string layer_name normalized;
     14        string spatial_ref WGS84;
     15        string target_container location.profile;
     16        x_field {
     17            string name location.lon;
     18            string scope dds;
     19        }
     20        y_field {
     21            string name location.lat;
     22            string scope dds;
     23        }
     24    }
     25    ogr_layer_info_2 {
     26        string layer_name profiles;
     27        string spatial_ref WGS84;
     28        string target_container location;
     29        x_field {
     30            string name location.lon;
     31            string scope dds;
     32        }
     33        y_field {
     34            string name location.lat;
     35            string scope dds;
     36        }
     37    }
     38}
     39}}}
     40The things to note are that the first layer definition (named normalized) references location.profile as the target_container. So a feature (shape in MapServer-speak) is produced for each record in the location.profile sequence. That is a feature for each depth reading.
     41
     42The second layer (profiles) references just location as the target_container, so a feature is produced for each location at which readings were taken.
     43
     44In order to instruct the DODS client side libraries to associate the above information as additional DDS info (via the DODS AIS mechanism) we need to provide an AIS file mapping the DODS url to the das file like this:
     45{{{
     46ogr_ais_eg.xml:
     47
     48<?xml version="1.0" encoding="US-ASCII" standalone="no"?>
     49<!DOCTYPE ais SYSTEM "http://www.opendap.org/ais/ais_database.dtd">
     50<ais xmlns="http://xml.opendap.org/ais">
     51
     52  <entry>
     53    <primary regexp="http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp*"/>
     54
     55    <ancillary url="/u/www/dods/natl_prof_bot.cdp.das"/>
     56  </entry>
     57</ais>
     58}}}
     59Now the mapfile looks like this:
     60{{{
     61MAP
     62NAME  "test"
     63SIZE  400 400
     64EXTENT  -5 -2 5 8
     65CONFIG DODS_CONF "/u/www/dods/dodsrc"
     66CONFIG DODS_AIS_FILE "/u/www/dods/ogr_ais_eg.xml"
     67
     68PROJECTION
     69"proj=latlong"
     70END
     71
     72#
     73# Start of web interface definition
     74#
     75WEB
     76  HEADER demo_header.html
     77  TEMPLATE demo.html
     78  FOOTER demo_footer.html
     79  MINSCALE 1
     80  MAXSCALE 15500000000
     81  IMAGEPATH "/u/www/tmp/"
     82  IMAGEURL "/tmp/"
     83#  LOG "demo.log"
     84END
     85
     86SYMBOL
     87  NAME "cross"
     88  TYPE vector
     89  POINTS
     90    2 0
     91    2 4
     92    -99 -99
     93    0 2
     94    4 2
     95  END
     96END
     97
     98LAYER
     99  NAME  "test_locations"
     100  TYPE POINT
     101  CONNECTIONTYPE OGR
     102  CONNECTION 'DODS:http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp?lat,lon'
     103  DATA 'profiles'
     104  STATUS  default
     105  CLASS
     106    COLOR 255 255 0
     107    SYMBOL 'cross'
     108    SIZE 8
     109  END
     110END
     111
     112LAYER
     113  NAME  "test_query"
     114  TYPE QUERY
     115  CONNECTIONTYPE OGR
     116  CONNECTION 'DODS:http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp'
     117  DATA 'normalized'
     118  TEMPLATE normalized_query.html
     119  STATUS  default
     120END
     121
     122END
     123}}}
     124Key things to note are that CONFIG statements are used to ensure particular dodsrc and AIS info files are used. Also, note that the rendering layer (TYPE POINT) uses the profiles layer restricted to the lat,lon values as done before. However, the new query layer (TYPE QUERY) uses the normalized layer, so that a query record is returned for each depth reading.
     125
     126This can be see in operation at:
     127
     128  http://gdal.velocet.ca/dods/demo_init.html
     129
     130If you check, you should see that a multiple query on a point returns a bunch of different depth readings for the same _id (profile) location.