wiki:DODSExample1

DODSExample1

DODS Example

In this example we extract point data from a "nested sequence" server and plot it in mapserver.

The server in question is http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp. If we look at the DDS definition (from http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp.dds) we see:

Dataset {
    Sequence {
        Float32 lat;
        Float32 lon;
        Float64 time;
        Int32 _id;
        Sequence {
            Float32 P_1;
            Float32 depth;
            Float32 T_20;
            Float32 S0_43;
            Float32 BO_61;
            Float32 pH_159;
            Float32 NO3_182;
            Float32 PO4_186;
            Float32 SI_188;
            Float32 TCO2_1751;
            Float32 PCO2_1755;
        } profile;
    } location;
} natl_prof_bot;

A default view of this dataset through OGR would be something like this:

warmerda@gdal2200[20]% ogrinfo -ro -al -so 'DODS:http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp'
INFO: Open of `DODS:http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp'
using driver `DODS' successful.

Layer name: location
Geometry: Unknown (any)
Feature Count: 1000
Extent: (0.000000, 0.500000) - (0.000000, 58.080002)
Layer SRS WKT:
(unknown)
lat: Real (0.0)
lon: Real (0.0)
time: Real (0.0)
_id: Integer (0.0)
profile.P_1: RealList (0.0)
profile.depth: RealList (0.0)
profile.T_20: RealList (0.0)
profile.S0_43: RealList (0.0)
profile.BO_61: RealList (0.0)
profile.pH_159: RealList (0.0)
profile.NO3_182: RealList (0.0)
profile.PO4_186: RealList (0.0)
profile.SI_188: RealList (0.0)
profile.TCO2_1751: RealList (0.0)
profile.PCO2_1755: RealList (0.0)

You will note that the default action is to convert the subsequences into "list" attributes. These are of limited use in MapServer since filters and so forth don't work on OGR list type variables. The DODS url is converted into a form usable by OGR by prepending "DODS:" to it.

For plotting the points we don't need much. Just the lat, and lon. We use the DODS "projection" concept to request only the fields we are interested in. This will dramatically reduce the amount of data that the DODS server needs to return to mapserver. In this case we might use the following OGR datasetname:

ogrinfo -ro -al 'DODS:http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp?lat,lon'
INFO: Open of `DODS:http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cd
p?lat,lon'
using driver `DODS' successful.

Layer name: location
Geometry: Unknown (any)
Feature Count: 1000
Extent: (0.000000, 0.500000) - (0.000000, 58.080002)
Layer SRS WKT:
(unknown)
lat: Real (0.0)
lon: Real (0.0)
OGRFeature(location):0
  lat (Real) = 0.5
  lon (Real) = 0
  POINT (0.00000000 0.50000000)
...

To minimally plot the data, we might use a .map file like:

MAP
NAME  "test"
SIZE  400 400
EXTENT  -30 0 30 60

PROJECTION
"proj=latlong"
END

SYMBOL
  NAME "cross"
  TYPE vector
  POINTS
    2 0
    2 4
    -99 -99
    0 2
    4 2
  END 
END

LAYER
  NAME  "test"
  TYPE POINT
  CONNECTIONTYPE OGR
  CONNECTION 'DODS:http://www.epic.noaa.gov:10100/dods/wod2001/natl_prof_bot.cdp?lat,lon'
  DATA 'location'
  STATUS  default
  CLASS
    COLOR 255 255 0
    SYMBOL 'cross'
    SIZE 8
  END
END

END

As per normal OGR usage, the datset name is the CONNECTION string, and the layer name is in the DATA statement. In this case symbol yellow cross symbols are used to plot the points.

Last modified 15 years ago Last modified on Jan 27, 2009, 3:34:14 PM
Note: See TracWiki for help on using the wiki.