[mapserver-users] Combine GetFeatureInfo for layers with same data source

Jörg Thomsen jt at mapmedia.de
Thu Mar 27 06:34:21 PDT 2014


hello again,

some PHP could help, call the script from your client instead of
mapserv-cgi:
> ELSEIF ($_GET['REQUEST'] == "GetFeatureInfo" or $_GET['request'] == "GetFeatureInfo") {
> 	IF ($_GET['QUERY_LAYERS'] == 'Abwasser,Verbandsgebiet' OR $_GET['QUERY_LAYERS'] == 'Verbandsgebiet,Abwasser' ) {
> 			$url = str_replace('Abwasser,Verbandsgebiet', 'Abwasser', $url)
> 			$url = str_replace('Verbandsgebiet,Abwasser', 'Abwasser', $url)
> 	}
>    $answer = file_get_contents($url);
>    $answer = utf8_decode($answer);
>    ECHO $answer;
> }

(whole script attached)

Jörg

Am 27.03.2014 14:03, schrieb TDS:
> Hello,
> 
> that's the problem. The user should select one or both of them. If both,
> all two layer names are send in the QUERY_LAYERS inquiry - like it should.
> 
> Bye, TDS
> ------------------------------------------------------------------------
> mailto:tds at tds-net.de
> ------------------------------------------------------------------------
> 1+1=10
> You have a question? - 42 or RTFM.
> Am 27.03.2014 13:58, schrieb Jörg Thomsen:
>> Hi,
>>
>> okay, join is not what you need, sorry.
>> Would it work for you if only one of the two layers is queryable?
>>
>> At the moment I have no idea...
>>
>> Jörg
>>
>> Am 27.03.2014 11:57, schrieb TDS:
>>> Hello,
>>>
>>> I've read this and I'm confused of how it can work...
>>> ONE-TO-ONE or ONE-TO-MANY or ... I want to have a solution *scream* If
>>> both layers are queried it should be one table, because the date is the
>>> same. Only the class item differs.
>>>
>>>
>>> Example Mapfile:
>>>     LAYER
>>>         STATUS    on
>>>         NAME    "Trinkwasserversorgung"
>>>         TYPE    POLYGON
>>>         DATA    "wv_wilster_84.shp"
>>>         DUMP    true
>>>         TOLERANCE        3
>>>         TOLERANCEUNITS    pixels
>>>         CLASSITEM        "TW"
>>>
>>>         HEADER            "templates/header.html"
>>>         TEMPLATE        "templates/template.html"
>>>         FOOTER            "templates/footer.html"
>>>
>>>         JOIN
>>>             NAME "Wasser"
>>>             TABLE "wv_wilster_84.dbf"
>>>             FROM "Id"
>>>             TO "Id"
>>>             TYPE ONE-TO-ONE
>>>         END
>>>
>>>            CLASS
>>>             NAME  "Trinkwasser"
>>>             EXPRESSION  "Trinkwasser"
>>>             STYLE
>>>                 COLOR   130  192  255
>>>             END
>>>             STYLE
>>>                 OUTLINECOLOR   120 120 120
>>>                 WIDTH 2
>>>                 ANTIALIAS TRUE
>>>             END
>>>         END
>>>
>>>         CLASS
>>>             NAME  "Selbstversorger"
>>>             STYLE
>>>                 SYMBOL "im_schraffur"
>>>             END       
>>>             EXPRESSION  "Selbstversorger"
>>>             STYLE
>>>                 OUTLINECOLOR   120 120 120
>>>                 WIDTH 2
>>>                 ANTIALIAS TRUE
>>>             END
>>>         END
>>>
>>>         PROJECTION
>>>             "init=epsg:4326"
>>>         END
>>>
>>>         METADATA
>>>             "wms_title"                "Verbandsgebiet"
>>>             "wms_title metadata"    ""
>>>             "wms_include_items"        "all"
>>>             "wms_srs"                "EPSG:4326 EPSG:54004 EPSG:41001
>>> EPSG:31467 EPSG:31468"
>>>         END
>>>     END
>>>
>>>     LAYER
>>>         STATUS    on
>>>         NAME    "Abwasserentsorgung"
>>>         TYPE    POLYGON
>>>         DATA    "wv_wilster_84.shp"
>>>         DUMP    true
>>>         TOLERANCE        3
>>>         TOLERANCEUNITS    pixels
>>>         CLASSITEM        "AW"
>>>
>>>         HEADER            "templates/header.html"
>>>         TEMPLATE        "templates/template.html"
>>>         FOOTER            "templates/footer.html"
>>>
>>>         JOIN
>>>             NAME "Wasser"
>>>             TABLE "wv_wilster_84.dbf"
>>>             FROM "Id"
>>>             TO "Id"
>>>             TYPE ONE-TO-ONE
>>>         END
>>>
>>>         CLASS
>>>             NAME  "Abwasser"
>>>             EXPRESSION  "Abwasser"
>>>             STYLE
>>>                 COLOR   255 128 0
>>>             END
>>>             STYLE
>>>                 OUTLINECOLOR   120 120 120
>>>                 WIDTH 2
>>>                 ANTIALIAS TRUE
>>>             END
>>>         END
>>>
>>>         CLASS
>>>             NAME  "Diverse Abwasseraufgaben"
>>>             STYLE
>>>                 SYMBOL "schraffur_orange"
>>>             END
>>>             EXPRESSION  "Diverse Abwasseraufgaben"
>>>             STYLE
>>>                 OUTLINECOLOR   120 120 120
>>>                 WIDTH 2
>>>                 ANTIALIAS TRUE
>>>             END
>>>         END
>>>
>>>         CLASS
>>>             NAME  "Kein Abwasser"
>>>             EXPRESSION  "Kein Abwasser"
>>>             STYLE
>>>                 OUTLINECOLOR   120 120 120
>>>                 WIDTH 2
>>>                 ANTIALIAS TRUE
>>>             END
>>>         END
>>>
>>>         PROJECTION
>>>             "init=epsg:4326"
>>>         END
>>>
>>>         METADATA
>>>             "wms_title"                "Abwasser"
>>>             "wms_title metadata"    ""
>>>             "wms_include_items"        "all"
>>>             "wms_srs"                "EPSG:4326 EPSG:54004 EPSG:41001
>>> EPSG:31467 EPSG:31468"
>>>         END
>>>     END
>>>
>>>
>>>
>>> Bye, TDS
>>> ------------------------------------------------------------------------
>>> mailto:tds at tds-net.de
>>> ------------------------------------------------------------------------
>>> 1+1=10
>>> You have a question? - 42 or RTFM.
>>> Am 26.03.2014 21:50, schrieb jt at mapmedia.de:
>>>> Hi,
>>>>
>>>> Referring to your signatur: rtfm ;)
>>>>
>>>> Try http://mapserver.org/de/mapfile/join.htm
>>>>
>>>> Join streets_main with the dbf of streets_sub. Read the doc carefuly,
>>>> it's a bit tricky.
>>>>
>>>> You may find a working example under
>>>> http://mapmedia.de/downloads/viewcategory/5-vortraege (
>>>>
>>>> Workshop_umn...)
>>>>
>>>> Jörg
>>>>
>>>>  
>>>>
>>>> On Wed, 26 Mar 2014 20:58:17 +0100, TDS wrote:
>>>>
>>>>>     Hello,
>>>>>
>>>>>
>>>>> is it possible to join two layers in GetFeatureInfo with same
>>>>> template and same shape file to output only one combined html file?
>>>>>
>>>>> Example:
>>>>> Streets_Main => streets.shp => template.html
>>>>> Streets_Sub => streets.shp => template.html
>>>>>
>>>>> OUTPUT:
>>>>>
>>>>> Current:
>>>>> Output for Streets_Mains
>>>>> Output for Streets_Sub
>>>>>
>>>>> Wish:
>>>>>
>>>>> Streets_Mains unique id Streets_sub (e.g. main street and sub street
>>>>> have both id=1 in shape file)
>>>>>
>>>>>
>>>>> -- 
>>>>> Bye, TDS
>>>>> ------------------------------------------------------------------------
>>>>> mailto:tds at tds-net.de
>>>>> ------------------------------------------------------------------------
>>>>> 1+1=10
>>>>> You have a question? - 42 or RTFM.
>>>>  
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> mapserver-users mailing list
>>>> mapserver-users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: osm.php
Type: application/x-php
Size: 3740 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140327/93258865/attachment.bin>


More information about the MapServer-users mailing list