[mapserver-users] replacing layer with different scales.

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Thu Feb 9 07:09:33 EST 2012


Hi,

Name the real layers as MIPARE_A_CLOSE and MIPARE_A_FAR and then make requests with the grouping layer name &layers=MIPARE and it should start to work.

-Jukka Rahkonen-


ElPer wrote:


> Hello
> 
> I need help with the mapfile of the mapserver and I hope you 
> can help me.
> I want to replace one layer with another at different scale, but I get
> always an Error.
> In the documentation I read that I can replace it with the same name
> according to different scales: 
> "The name should be unique, unless one layer replaces another 
> at different
> scales."
> Our Mapserver uses also Tilecache and I'm not sure if the 
> error comes from
> the mapserver or tilecache.
> 
> Thanks for your help
> 
> Here is my mapfile:
> 
> MAP
>    NAME Nautical Map
>    STATUS ON
>   
>    # Spherical Mercator
>    EXTENT -20037508.34 -20037508.34 20037508.34 20037508.34
>    PROJECTION
>       "init=epsg:900913"
>    END
> 
>    SIZE 2048 2048
> 
>    IMAGETYPE mypng
>    OUTPUTFORMAT
>       NAME "mypng"
>       DRIVER AGG/PNG
>       MIMETYPE "image/png"
>       IMAGEMODE RGBA
>       EXTENSION "png"
>       TRANSPARENT ON
>       FORMATOPTION "INTERLACE=OFF"
>    END
> 
>    WEB
>       IMAGEPATH "/opt/fgs2/tmp/ms_tmp/"
>       IMAGEURL "/ms_tmp/"
>       METADATA
>          "wms_srs" "EPSG:4326 EPSG:900913"
>       END
>    END
> 
>     LAYER
>       NAME MIPARE_A_1
>       GROUP "MIPARE"
>       STATUS ON
>       PROJECTION
>          "init=epsg:4326"
>       END
>       TYPE POLYGON
>       DATA 
> "data/Scale_S57_Shapefile/25000/DE416020/MIPARE/A/MIPARE.shp"
>       PROCESSING "CLOSE_CONNECTION=DEFER"
>       PROCESSING "LABEL_NO_CLIP=ON"
>       MINSCALEDENOM 0
>       MAXSCALEDENOM 24999
>       CLASS
>          EXPRESSION ([CATMPA] == 2)
>          STYLE
>             SIZE 10
>             OUTLINECOLOR 200 0 255
>             SYMBOL mipare_torea
>          END
>       END
>       CLASS
>          EXPRESSION (([CATMPA] == 3) || ([CATMPA] == 4))
>          STYLE
>             SIZE 10
>             OUTLINECOLOR 200 0 255
>             SYMBOL mipare_subea
>          END
>       END
>       CLASS
>          STYLE
>             SIZE 1
>             OUTLINECOLOR 200 0 255
>             SYMBOL dashed_line
>          END
>       END
>    END
>     
>    LAYER
>       NAME MIPARE_A_1
>       GROUP "MIPARE"
>       STATUS ON
>       PROJECTION
>          "init=epsg:4326"
>       END
>       TYPE POLYGON
>       DATA 
> "data/Scale_S57_Shapefile/45000/DE316001/MIPARE/A/MIPARE.shp"
>       PROCESSING "CLOSE_CONNECTION=DEFER"
>       PROCESSING "LABEL_NO_CLIP=ON"
>       MINSCALEDENOM 25000
>       MAXSCALEDENOM 499999
>       CLASS
>          EXPRESSION ([CATMPA] == 2)
>          STYLE
>             SIZE 10
>             OUTLINECOLOR 200 0 255
>             SYMBOL mipare_torea
>          END
>       END
>       CLASS
>          EXPRESSION (([CATMPA] == 3) || ([CATMPA] == 4))
>          STYLE
>             SIZE 10
>             OUTLINECOLOR 200 0 255
>             SYMBOL mipare_subea
>          END
>       END
>       CLASS
>          STYLE
>             SIZE 1
>             OUTLINECOLOR 200 0 255
>             SYMBOL dashed_line
>          END
>       END
>    END
> END
> 
> And here is the Exception wich I get:
> 
> Mapserver message:
>  Did not get image data back. 
> URL:
> http://127.0.0.1:8181/cgi-bin/mapserv?MAP=/opt/fgs2/www/htdocs
/nautical.map&transparent=true&layers=MIPARE_A_1> &styles=&service=WMS&width=612&format=image%2Fpng&request=GetM
ap&height=612&srs=EPSG%3A900913&version=1.1.1&bbox=1104629.71327%> 2C7248943.79384%2C1116324.57859%2C7260638.65917
> Content-Type Header: application/vnd.ogc.se_xml
> Response: 
> <?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?>
> <!DOCTYPE ServiceExceptionReport SYSTEM
> &quot;http://schemas.opengis.net/wms/1.1.1/exception_1_1_1.dtd&quot;>
> <ServiceExceptionReport version="1.1.1">
> <ServiceException code="LayerNotDefined">
> msWMSLoadGetMapParams(): WMS server error. Invalid layer(s) 
> given in the
> LAYERS parameter.
> </ServiceException>
> </ServiceExceptionReport>
> 
>   File 
> "/opt/fgs2/www/htdocs/tilecache-2.10/TileCache/Service.py", line 323,
> in cgiHandler
>     format, image = service.dispatchRequest( params, 
> path_info, req_method,
> host )
>   File 
> "/opt/fgs2/www/htdocs/tilecache-2.10/TileCache/Service.py", line 226,
> in dispatchRequest
>     (format, data) = self.renderTile(t, params.has_key('FORCE'))
>   File 
> "/opt/fgs2/www/htdocs/tilecache-2.10/TileCache/Service.py", line 138,
> in renderTile
>     data = layer.render(tile, force=force)
>   File 
> "/opt/fgs2/www/htdocs/tilecache-2.10/TileCache/Layer.py", line 435,
> in render
>     image = self.renderMetaTile(metatile, tile)
>   File 
> "/opt/fgs2/www/htdocs/tilecache-2.10/TileCache/Layer.py", line 395,
> in renderMetaTile
>     data = self.renderTile(metatile)
>   File 
> "/opt/fgs2/www/htdocs/tilecache-2.10/TileCache/Layers/WMS.py", line
> 29, in renderTile
>     tile.data, response = wms.fetch()
>   File 
> "/opt/fgs2/www/htdocs/tilecache-2.10/TileCache/Client.py", line 68,
> in fetch
>     raise Exception("Did not get image data back. \nURL: 
> %s\nContent-Type
> Header: %s\nResponse: \n%s" % (self.url(), ctype, data))
> 
> --
> View this message in context: 
> http://osgeo-org.1560.n6.nabble.com/replacing-layer-with-diffe
rent-scales-tp4378365p4378365.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


More information about the mapserver-users mailing list