Opened 22 years ago
Last modified 15 years ago
#130 new defect
[MapScript] Add $layer->getItems() method
Reported by: | dmorissette | Owned by: | sdlime |
---|---|---|---|
Priority: | highest | Milestone: | 6.0 release |
Component: | MapScript | Version: | 4.1 |
Severity: | normal | Keywords: | |
Cc: | sfournier@… |
Description (last modified by )
We need a way to retrieve the list of fields available in a layer from a mapfile in a MapScript application. We could open the DBF file directly using the dbase module, but this won't work for OGR data sources. The cleanest solution seems to be to add a $layer->getItems() method that would call msLayerGetItems() at the lower level and return an array of attribute names, e.g. $layer->open($shapepath); $attr_names = $layer->getItems(); $layer->close(); This should be added to both the SWIG MapScript (mapscript.i) and the PHP MapScript. Do you see any potential problem with doing this, Steve? I know this would work fine for SHP and OGR, but what about SDE, PostGIS, etc?
Change History (6)
comment:1 by , 22 years ago
Status: | new → assigned |
---|
comment:3 by , 22 years ago
Status: | new → assigned |
---|
Steve Lime wrote: > > It's on my to do list for the SWIGed versions of MapScript. Problem is > that you have to write SWIG typemaps which involves low level C code > within a particular language. This needs to be done for each language > supported, for sure that means perl, python, tk/tcl and java. A work > around would be to add accessor methods to the layerObj and shapeObj get > at item names and values for any particular shape. I thought that I'd > already done that much. > > I see no problems regardless of the datasource since the shapeObj is > supposed to buffer the user from that complexity. Any datasource that > supports queries (at the moment on Oracle Spatial does not) should be > fine. I think everyone implemented a msLayerGetShape capability so... > > Steve > I guess we'll implement this directly in php_mapscript.c then (it's just a call to msLayerGetItems() + packaging the layer->items[] array after all) and we will reassign the bug to you Steve after so that you can close it once the required changes to support the SWIG version have been done.
comment:4 by , 22 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
I added a new function 'getItems' into PHP mapscript that returns a string array of all layers items. Should be implemented in swig someday. That why I did not chage the bug to FIXED.
comment:5 by , 21 years ago
Priority: | high → highest |
---|---|
Version: | 3.6 → 4.1 |
If we waited this long, we can probably wait until 4.1... let's make this a P1 for 4.1
comment:6 by , 15 years ago
Description: | modified (diff) |
---|---|
Milestone: | → 6.0 release |
Note:
See TracTickets
for help on using tickets.