[mapserver-users] Different image for each point

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Thu Aug 23 13:16:53 PDT 2012


You can't do expressions as originally discussed but you can use attribute binding. This requires the image file name be in a single attribute. Syntax is:

  SYMBOL [FILENAME]  # no quotes

This basically creates symbols at runtime so the images are cached based on filename I believe.

Steve

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephen Woodbridge
Sent: Thursday, August 23, 2012 2:26 PM
To: Ian Walberg
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Different image for each point

A lot of this code has been changed in 6.2, but I think the basics still work. I'm not sure if images are cached or not when using this method or if it matters in your case. I guess ideally if it were a fixed set of images then you want caching, but it they are all different then you probably want to turn caching off, but I do not think there are any controls for that. If you have the whole path to the image in the attribute then you do not need to use an expression to concatenate the path and name so it simplies to:

SYMBOL '[FILENAME]'

Also be aware that you should probably use a POINT layer and not ANNOTATION layers as the latter is deprecated in 6.2 so upgrading it will be easier.

-Steve W

On 8/23/2012 2:27 PM, Ian Walberg wrote:
> Stephen,
>
> This looks perfect, I need to look closer but I had thought the 
> symbols needed to be defined separately.
>
> Regards
>
> Ian
>
> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Stephen 
> Woodbridge
> Sent: Thursday, August 23, 2012 11:21 AM
> To: mapserver-users at lists.osgeo.org
> Subject: Re: [mapserver-users] Different image for each point
>
> On 8/23/2012 1:31 PM, Ian Walberg wrote:
>> Hello folks,
>>
>> We need to be able to display a different small image from each point 
>> in a data set, say along the lines of a thumbnail.
>>
>>   From what I can see this could be done my defining each image as a 
>> symbol and then referencing that.
>>
>> However what we would like to be able to do is get the image file 
>> name
>
>> as part of the query and display the image based on that.
>>
>> Is this possible?
>
> I have done this by creating a column with the filename in it. You can 
> then use the column as a symbol name or symbol path or as attribute 
> column in wfs to OpenLayers that can then be used to point to a 
> thumbnail directory of fullsize directory of images.
>
>
> LAYER
>     NAME "images"
>     TYPE POINT
>     DATA "myImagePoints"
>     CLASS
>       STYLE
>         SYMBOL ("/path/to/thumbs/"+'[FILENAME]')
>       END
>     END
> END
>
> Where column FILENAME has something like 'myimage.png' and to do this 
> you are probably limited to gif, jpg, and png images only. svg will 
> NOT work.
>
> -Steve W
>
> _______________________________________________
> 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




More information about the mapserver-users mailing list