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

Mapscript getProjection error caused by select.php when GROUP is used rather than LAYER #31

Closed
tchaddad opened this issue Aug 20, 2013 · 3 comments

Comments

@tchaddad
Copy link
Contributor

Querying a LAYER works fine as an individual layer, but querying the same LAYER as soon as it was combined in a GROUP with other related layers, causes a 500 server error:

Call to a member function getProjection() on a non-object in \htdocs\php\select.php on line 215

This is happening with the buffered_select tool in GM 2.6.1.

reported first here:
http://lists.osgeo.org/pipermail/mapserver-users/2012-September/073223.html

and discussed here:
http://osgeo-org.1560.x6.nabble.com/Geomoose-users-getProjection-error-select-php-td5058806.html

@tchaddad
Copy link
Contributor Author

Suggested approach for a fix from @klassenjs (not tested):

"Ideally, the PHP would check for groups and explode them into layers then act on the layers.

That would probably be implemented by checking both the name and group of each layer and including the layer if either match as it iterates through. Something like this :

diff --git a/htdocs/php/select.php b/htdocs/php/select.php

--- a/htdocs/php/select.php
+++ b/htdocs/php/select.php
@@ -193,7 +193,14 @@ if($layer == 'all') {
               array_push($layersToQuery, $map->getLayer($i));
      }
} else {
-       array_push($layersToQuery, $map->getLayerByName($layer));
+       $group_layers = $map->getLayersIndexByGroup($layer);
+       if(count($group_layers) > 0) {
+               foreach($group_layers as $layerid) {
+                       array_push($layersToQuery, $map->getLayer($layerid);
+               }
+       } else {
+               array_push($layersToQuery, $map->getLayerByName($layer));
+       }
 }
$foundShapes = array();

Also, might have to be more careful about not including the same layer twice."

theduckylittle pushed a commit to geomoose/geomoose-services that referenced this issue Apr 25, 2014
@theduckylittle
Copy link
Member

I moved how layersToQuery array is built. Funny enough we have a loop that disabled all of the layers, so I moved the logic there since we were looping there anyway.

@theduckylittle
Copy link
Member

Test is current passing: select_php_test.php:SelectTest.test_ticket31

theduckylittle pushed a commit to geomoose/geomoose-services that referenced this issue Jun 29, 2015
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

2 participants