cgi param substitute for metadata
Charlton Purvis
cplist at EARTHLINK.NET
Tue Nov 8 10:47:32 PST 2005
Hi, folks:
I'm not sure if this interests anyone or not, but I've continued to make
changes to mapserv.c to look for %cgi_vars% for runtime substitutions.
It has been particularly useful for only returning columns from a shapefile
that match whatever time parameter a user has passed.
E.g.
METADATA
"gml_include_items" "StartTime,t%STEP_TIME%,v%STEP_TIME%"
END
Because I may have columns called something like t05110817 and v05110817.
And I don't want to return all the timestamps -- just these.
It's been WAY too long since I tried dereferencing hashes in C, but this
blurp of code does the trick. It's probably inefficient since I'm
destroying an item and then recreating it.
Inside mapObj *loadMap(void)
...
tmp_metadata_item = msLookupHashTable(&(map->layers[j].metadata),
"gml_include_items");
if(tmp_metadata_item && (strstr(tmp_metadata_item, tmpstr) != NULL)) {
tmp_metadata_item = gsub(tmp_metadata_item, tmpstr,
msObj->request->ParamValues[i]);
if(msRemoveHashTable(&(map->layers[j].metadata),
"gml_include_items")) {
msInsertHashTable(&(map->layers[j].metadata), "gml_include_items",
tmp_metadata_item);
}
}
...
Charlton
More information about the MapServer-users
mailing list