@@ -516,6 +516,117 @@ def testGetFeatureInfoPostgresTypes(self):
516
516
attribute .get ('value' )), {
517
517
'c' : 4.0 , 'd' : 5.0 })
518
518
519
+ def testGetFeatureInfoGroupedLayers (self ):
520
+ """Test that we can get feature info from the top and group layers"""
521
+
522
+ # areas+and+symbols (not nested)
523
+ self .wms_request_compare ('GetFeatureInfo' ,
524
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
525
+ '&CRS=EPSG:4326' +
526
+ '&WIDTH=2&HEIGHT=2' +
527
+ '&QUERY_LAYERS=areas+and+symbols' +
528
+ '&INFO_FORMAT=text/plain' +
529
+ '&I=0&J=1' +
530
+ '&FEATURE_COUNT=10' ,
531
+ 'wms_getfeatureinfo_group_name_areas' ,
532
+ 'test_project_wms_grouped_layers.qgs' )
533
+
534
+ # areas+and+symbols (nested)
535
+ self .wms_request_compare ('GetFeatureInfo' ,
536
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
537
+ '&CRS=EPSG:4326' +
538
+ '&WIDTH=2&HEIGHT=2' +
539
+ '&QUERY_LAYERS=areas+and+symbols' +
540
+ '&INFO_FORMAT=text/plain' +
541
+ '&I=0&J=1' +
542
+ '&FEATURE_COUNT=10' ,
543
+ 'wms_getfeatureinfo_group_name_areas_nested' ,
544
+ 'test_project_wms_grouped_nested_layers.qgs' )
545
+
546
+ # as-areas-short-name
547
+ self .wms_request_compare ('GetFeatureInfo' ,
548
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
549
+ '&CRS=EPSG:4326' +
550
+ '&WIDTH=2&HEIGHT=2' +
551
+ '&QUERY_LAYERS=as-areas-short-name' +
552
+ '&INFO_FORMAT=text/plain' +
553
+ '&I=0&J=1' +
554
+ '&FEATURE_COUNT=10' ,
555
+ 'wms_getfeatureinfo_group_name_areas_nested_shortname' ,
556
+ 'test_project_wms_grouped_nested_layers.qgs' )
557
+
558
+ # Top level: QGIS Server - Grouped Layer
559
+ self .wms_request_compare ('GetFeatureInfo' ,
560
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
561
+ '&CRS=EPSG:4326' +
562
+ '&WIDTH=2&HEIGHT=2' +
563
+ '&QUERY_LAYERS=QGIS+Server+-+Grouped Nested Layer' +
564
+ '&INFO_FORMAT=text/plain' +
565
+ '&I=0&J=1' +
566
+ '&FEATURE_COUNT=10' ,
567
+ 'wms_getfeatureinfo_group_name_top' ,
568
+ 'test_project_wms_grouped_nested_layers.qgs' )
569
+
570
+ # Multiple matches from 2 layer groups
571
+ self .wms_request_compare ('GetFeatureInfo' ,
572
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
573
+ '&CRS=EPSG:4326' +
574
+ '&WIDTH=2&HEIGHT=2' +
575
+ '&QUERY_LAYERS=areas+and+symbols,city+and+district+boundaries' +
576
+ '&INFO_FORMAT=text/plain' +
577
+ '&I=0&J=1' +
578
+ '&FEATURE_COUNT=10' ,
579
+ 'wms_getfeatureinfo_group_name_areas_cities' ,
580
+ 'test_project_wms_grouped_nested_layers.qgs' )
581
+
582
+ # no_query group (nested)
583
+ self .wms_request_compare ('GetFeatureInfo' ,
584
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
585
+ '&CRS=EPSG:4326' +
586
+ '&WIDTH=2&HEIGHT=2' +
587
+ '&QUERY_LAYERS=no_query' +
588
+ '&INFO_FORMAT=text/plain' +
589
+ '&I=0&J=1' +
590
+ '&FEATURE_COUNT=10' ,
591
+ 'wms_getfeatureinfo_group_no_query' ,
592
+ 'test_project_wms_grouped_nested_layers.qgs' )
593
+
594
+ # query_child group (nested)
595
+ self .wms_request_compare ('GetFeatureInfo' ,
596
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
597
+ '&CRS=EPSG:4326' +
598
+ '&WIDTH=2&HEIGHT=2' +
599
+ '&QUERY_LAYERS=query_child' +
600
+ '&INFO_FORMAT=text/plain' +
601
+ '&I=0&J=1' +
602
+ '&FEATURE_COUNT=10' ,
603
+ 'wms_getfeatureinfo_group_query_child' ,
604
+ 'test_project_wms_grouped_nested_layers.qgs' )
605
+
606
+ # child_ok group (nested)
607
+ self .wms_request_compare ('GetFeatureInfo' ,
608
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
609
+ '&CRS=EPSG:4326' +
610
+ '&WIDTH=2&HEIGHT=2' +
611
+ '&QUERY_LAYERS=child_ok' +
612
+ '&INFO_FORMAT=text/plain' +
613
+ '&I=0&J=1' +
614
+ '&FEATURE_COUNT=10' ,
615
+ 'wms_getfeatureinfo_group_query_child' ,
616
+ 'test_project_wms_grouped_nested_layers.qgs' )
617
+
618
+ # as_areas_query_copy == as-areas-short-name-query-copy (nested)
619
+ self .wms_request_compare ('GetFeatureInfo' ,
620
+ '&BBOX=52.44095517977704901,10.71171069440170776,52.440955186258563,10.71171070552261817' +
621
+ '&CRS=EPSG:4326' +
622
+ '&WIDTH=2&HEIGHT=2' +
623
+ '&QUERY_LAYERS=as-areas-short-name-query-copy' +
624
+ '&INFO_FORMAT=text/plain' +
625
+ '&I=0&J=1' +
626
+ '&FEATURE_COUNT=10' ,
627
+ 'wms_getfeatureinfo_group_query_child' ,
628
+ 'test_project_wms_grouped_nested_layers.qgs' )
629
+
519
630
520
631
if __name__ == '__main__' :
521
632
unittest .main ()
0 commit comments