[mapserver-users] Selecting data from multiple OGR layers

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed Feb 3 13:58:22 PST 2021


Thanks Iljya and Tamas, I have confirmed that the documentation was 
outdated, and has now been fixed as recommended by Tamas.

Iljya: I tested successfully with:

    EXPRESSION ("[Union_SourceLayerName]" = "LAYER1")

and welcome to the MapServer community! :)

-jeff




-- 
Jeff McKenna
GatewayGeo: MapServer Consulting and Training Services
co-founder of FOSS4G
http://gatewaygeo.com/

On 2021-02-03 2:16 p.m., Tamas Szekeres wrote:
> Iljya,
> 
> You might probably try Union_SourceLayerName as the attribute name.
> 
> Best regards,
> 
> Tamas
> 
> 
> 
> 
> Iljya Kalai <iljya.kalai at gmail.com <mailto:iljya.kalai at gmail.com>> ezt 
> írta (időpont: 2021. febr. 3., Sze, 18:54):
> 
>     Hi everyone,
> 
>     I'm trying to select data from multiple OGR layers and style them
>     based on the source layer, as well as some attributes that are not
>     common to all layers.
> 
>     I discovered the UNION layer
>     <https://mapserver.org/mapfile/union.html#union> which seems to be
>     the answer. According to the documentation
>     <https://mapserver.org/mapfile/union.html#union> the source layer
>     name should be in the [Combine_SourceLayerName] attribute. However,
>     I get this error when I try to use it:
> 
>         msOGRLayerInitItemInfo(): OGR error. Invalid Field name:
>     Combine_SourceLayerName in layer `LAYER1'
> 
>       (I also tried [Union:SourceLayerName] which I found in the
>     mapunion.c code
>     <https://github.com/MapServer/MapServer/blob/0f7bbf67ce7c6fec0feaa0b33033daf02e406b9b/mapunion.c#L39>,
>     but that gives the same error.)
> 
>     Map file snippet:
> 
>     LAYER
>          NAME "U"
>          STATUS DEFAULT
>          CONNECTIONTYPE UNION
>          CONNECTION "LAYER1,LAYER2"
>          CLASS
>             NAME "C1"
>             EXPRESSION ("[Combine_SourceLayerName]" = "LAYER1")
>             ...
> 
>     Any ideas?
> 
>     Thanks!
>     Iljya
>     P.S I'm new here!






More information about the MapServer-users mailing list