Opened 21 years ago

Closed 20 years ago

#434 closed enhancement (fixed)

new functions numMetaData and keyMetaData to retrieve number and keys of metadata entries

Reported by: m.spring@… Owned by: sdlime
Priority: high Milestone:
Component: MapScript-SWIG Version: 4.1
Severity: minor Keywords:
Cc: sgillies@…

Description

Mapscript currently has no methods to retrieve existing metadata without knowing
its keys.

The new method 'numMetaData' gets the number of metadata entries (like
map->numlayers), and 'keyMetaData(pos)' gets the key of the metadata entry on
position 'pos'.

To achieve this functionality patching of maphash.c, maphash.h and mapscript.i
is necessary.
The patches are context-diffed against the mapserver cvs-version of sunday,
sept. 21, 2003 and can be downloaded from

http://dream.lrrl.arch.tu-muenchen.de/~springm/mapserver/maphash_patches/maphash.c.patch
http://dream.lrrl.arch.tu-muenchen.de/~springm/mapserver/maphash_patches/maphash.h.patch
http://dream.lrrl.arch.tu-muenchen.de/~springm/mapserver/maphash_patches/mapscript.i.patch

I hope this patch can be included in the current and future versions of mapserver.

Attachments (4)

maphash.c.patch (960 bytes ) - added by m.spring@… 21 years ago.
Patch for maphash.c
maphash.h.patch (406 bytes ) - added by m.spring@… 21 years ago.
Patch for maphash.h
mapscript.i.patch (1.6 KB ) - added by m.spring@… 21 years ago.
Patch for mapscript.i
mapscript.i.2.patch (1.5 KB ) - added by m.spring@… 21 years ago.
Correct patch for mapscript.i

Download all attachments as: .zip

Change History (8)

by m.spring@…, 21 years ago

Attachment: maphash.c.patch added

Patch for maphash.c

by m.spring@…, 21 years ago

Attachment: maphash.h.patch added

Patch for maphash.h

by m.spring@…, 21 years ago

Attachment: mapscript.i.patch added

Patch for mapscript.i

comment:1 by m.spring@…, 21 years ago

attachments.isobsolete: 01

by m.spring@…, 21 years ago

Attachment: mapscript.i.2.patch added

Correct patch for mapscript.i

comment:2 by sgillies@…, 21 years ago

Cc: sgillies@… added
Sean Gillies added

comment:3 by m.spring@…, 21 years ago

Status: newassigned

comment:4 by sgillies@…, 20 years ago

Cc: warmerdam@… mapserver-bugs@… added
Component: MapScriptMapScript-SWIG
Resolution: fixed
Status: assignedclosed
Been a long time, but have finally resolved this bug.

We are not going to use the provided patch, but using new 
msFirstKeyFromHashTable and msNextKeyFromHashTable functions written
by Frank Warmerdam.

These give us an opaque iterator over metadata keys that we can use
like this:

    keys = []
    key = mapobj.getFirstMetaDataKey()
    if key is not None: 
        keys.append(key)
        while 1:
            key = mapobj.getNextMetaDataKey(key)
            if not key:
                break
            keys.append(key)
    
and keys contains all the metadata keys.  One could create a dictionary
from the metadata in a similar fashion.

Note: See TracTickets for help on using tickets.