Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PHPMapscript ]please add method mapObj->getAllGroupNames() #5763

Open
thjack opened this issue Mar 9, 2019 · 4 comments
Open

[PHPMapscript ]please add method mapObj->getAllGroupNames() #5763

thjack opened this issue Mar 9, 2019 · 4 comments

Comments

@thjack
Copy link

thjack commented Mar 9, 2019

please add all methods of mapscript I use pmapper and like keep using it

@sdlime
Copy link
Member

sdlime commented Mar 22, 2019

@geographika and @jmckenna, what do you think? This request is to fill a gap between PHPMapScript and Swig. It's a map-level method and wraps msGetAllGroupNames()... I don't see anything similar where we return an array of strings in Swig.

--Stee

@geographika
Copy link
Member

@sdlime from https://mapserver.org/mapscript/mapscript.html -

There are yet no mapscript methods that return arrays or sequences or accept array or sequence arguments.

I think the C# bindings do have one though - https://github.com/mapserver/mapserver/blob/branch-7-2/mapscript/csharp/csmodule.i#L125

We'd have to create typemaps for the other language bindings to support these (as I understand it, unless newer versions of SWIG support this automatically).

The typemap for Python from GDAL could probably be modified and used:

https://github.com/OSGeo/gdal/blob/master/gdal/swig/include/python/typemaps_python.i#L1026

I'm not sure about PHP - it looks as though the PHPMapScript could maybe be adjusted and added to SWIG as a typemap.

Any thoughts on use/support of Ruby, Java, TCL, and Perl bindings?

@sdlime
Copy link
Member

sdlime commented Mar 25, 2019

I was hoping for - newer versions of SWIG support this automatically... ;-) Seems like a pretty common need IMHO but it doesn't look to be the case based on the docs,

In terms of other languages, I would bet TCL see's almost no use - the others probably do. PHP-only could be considered as an initial target though. The other bindings don't know what they are missing...

@richie21
Copy link
Contributor

@thjack : maybe you can use this workaround ?

function getAllGroupNames($mapObj)
{
    $aGroups = [];

    for ($i = 0; $i < $mapObj->numlayers; $i++) {
        $layerObj = $mapObj->getLayer($i);

        if (in_array($layerObj->group, $aGroups) === false) {
            $aGroups[] = $layerObj->group;
        }
    }

    return $aGroups;
}
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants