@@ -591,6 +591,117 @@ def testGetFeatureInfoPostgresTypes(self):
591
591
attribute .get ('value' )), {
592
592
'c' : 4.0 , 'd' : 5.0 })
593
593
594
+ def testGetFeatureInfoGroupedLayers (self ):
595
+ """Test that we can get feature info from the top and group layers"""
596
+
597
+ # areas+and+symbols (not nested)
598
+ self .wms_request_compare ('GetFeatureInfo' ,
599
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
600
+ '&CRS=EPSG:4326' +
601
+ '&WIDTH=2&HEIGHT=2' +
602
+ '&QUERY_LAYERS=areas+and+symbols' +
603
+ '&INFO_FORMAT=application/json' +
604
+ '&I=0&J=1' +
605
+ '&FEATURE_COUNT=10' ,
606
+ 'wms_getfeatureinfo_group_name_areas' ,
607
+ 'test_project_wms_grouped_layers.qgs' )
608
+
609
+ # areas+and+symbols (nested)
610
+ self .wms_request_compare ('GetFeatureInfo' ,
611
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
612
+ '&CRS=EPSG:4326' +
613
+ '&WIDTH=2&HEIGHT=2' +
614
+ '&QUERY_LAYERS=areas+and+symbols' +
615
+ '&INFO_FORMAT=application/json' +
616
+ '&I=0&J=1' +
617
+ '&FEATURE_COUNT=10' ,
618
+ 'wms_getfeatureinfo_group_name_areas' ,
619
+ 'test_project_wms_grouped_nested_layers.qgs' )
620
+
621
+ # as-areas-short-name
622
+ self .wms_request_compare ('GetFeatureInfo' ,
623
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
624
+ '&CRS=EPSG:4326' +
625
+ '&WIDTH=2&HEIGHT=2' +
626
+ '&QUERY_LAYERS=as-areas-short-name' +
627
+ '&INFO_FORMAT=application/json' +
628
+ '&I=0&J=1' +
629
+ '&FEATURE_COUNT=10' ,
630
+ 'wms_getfeatureinfo_group_name_areas' ,
631
+ 'test_project_wms_grouped_nested_layers.qgs' )
632
+
633
+ # Top level: QGIS Server - Grouped Layer
634
+ self .wms_request_compare ('GetFeatureInfo' ,
635
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
636
+ '&CRS=EPSG:4326' +
637
+ '&WIDTH=2&HEIGHT=2' +
638
+ '&QUERY_LAYERS=QGIS+Server+-+Grouped Nested Layer' +
639
+ '&INFO_FORMAT=application/json' +
640
+ '&I=0&J=1' +
641
+ '&FEATURE_COUNT=10' ,
642
+ 'wms_getfeatureinfo_group_name_top' ,
643
+ 'test_project_wms_grouped_nested_layers.qgs' )
644
+
645
+ # Multiple matches from 2 layer groups
646
+ self .wms_request_compare ('GetFeatureInfo' ,
647
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
648
+ '&CRS=EPSG:4326' +
649
+ '&WIDTH=2&HEIGHT=2' +
650
+ '&QUERY_LAYERS=areas+and+symbols,city+and+district+boundaries' +
651
+ '&INFO_FORMAT=application/json' +
652
+ '&I=0&J=1' +
653
+ '&FEATURE_COUNT=10' ,
654
+ 'wms_getfeatureinfo_group_name_areas_cities' ,
655
+ 'test_project_wms_grouped_nested_layers.qgs' )
656
+
657
+ # no_query group (nested)
658
+ self .wms_request_compare ('GetFeatureInfo' ,
659
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
660
+ '&CRS=EPSG:4326' +
661
+ '&WIDTH=2&HEIGHT=2' +
662
+ '&QUERY_LAYERS=no_query' +
663
+ '&INFO_FORMAT=application/json' +
664
+ '&I=0&J=1' +
665
+ '&FEATURE_COUNT=10' ,
666
+ 'wms_getfeatureinfo_group_no_query' ,
667
+ 'test_project_wms_grouped_nested_layers.qgs' )
668
+
669
+ # query_child group (nested)
670
+ self .wms_request_compare ('GetFeatureInfo' ,
671
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
672
+ '&CRS=EPSG:4326' +
673
+ '&WIDTH=2&HEIGHT=2' +
674
+ '&QUERY_LAYERS=query_child' +
675
+ '&INFO_FORMAT=application/json' +
676
+ '&I=0&J=1' +
677
+ '&FEATURE_COUNT=10' ,
678
+ 'wms_getfeatureinfo_group_query_child' ,
679
+ 'test_project_wms_grouped_nested_layers.qgs' )
680
+
681
+ # child_ok group (nested)
682
+ self .wms_request_compare ('GetFeatureInfo' ,
683
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
684
+ '&CRS=EPSG:4326' +
685
+ '&WIDTH=2&HEIGHT=2' +
686
+ '&QUERY_LAYERS=child_ok' +
687
+ '&INFO_FORMAT=application/json' +
688
+ '&I=0&J=1' +
689
+ '&FEATURE_COUNT=10' ,
690
+ 'wms_getfeatureinfo_group_query_child' ,
691
+ 'test_project_wms_grouped_nested_layers.qgs' )
692
+
693
+ # as_areas_query_copy == as-areas-short-name-query-copy (nested)
694
+ self .wms_request_compare ('GetFeatureInfo' ,
695
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
696
+ '&CRS=EPSG:4326' +
697
+ '&WIDTH=2&HEIGHT=2' +
698
+ '&QUERY_LAYERS=as-areas-short-name-query-copy' +
699
+ '&INFO_FORMAT=application/json' +
700
+ '&I=0&J=1' +
701
+ '&FEATURE_COUNT=10' ,
702
+ 'wms_getfeatureinfo_group_query_child' ,
703
+ 'test_project_wms_grouped_nested_layers.qgs' )
704
+
594
705
595
706
if __name__ == '__main__' :
596
707
unittest .main ()
0 commit comments