Image transparency via SWIG API

Sean Gillies sgillies at FRII.COM
Mon May 16 19:31:32 PDT 2005


On May 16, 2005, at 6:54 PM, Rick Innis wrote:

> --Apple-Mail-6-545094000
> Content-Transfer-Encoding: 7bit
> Content-Type: text/plain;
>         charset=US-ASCII;
>         format=flowed
>
>
>> Rick, you say everything works fine when you load the same layer via a
>> mapfile ... so why not do that?
>
> The application allows each user, or group of users, to view different
> data layers superimposed on the same base map. This is running as a web
> service, so we don't want to have to manage potentially hundreds or
> thousands of maps that differ only in one or two layers.
>
>> I'm going to need more details on your
>> use before I can be of any help such as how you are styling and
>> rendering the points, and perhaps the relevant portion of the mapfile
>> that works.
>
> OK, and thanks. In reverse order, then, here's the mapfile fragment:
>
>          LAYER
>                  NAME user_data
>                  STATUS on
>                  CONNECTION "user=XXXX password=YYYY dbname=ZZZZ
> host=localhost port=5432"
>                  CONNECTIONTYPE postgis
>                  DATA "the_geom from j_random_table"
>                  TYPE point
>                  CLASS
>                          NAME "pins"
>                          STYLE
>                                  BACKGROUNDCOLOR 0 255 0
>                                  COLOR 0 255 0
>                                  SYMBOL
> ../../Image/Pin/pin_black_map.gif
>                          END
>                  END
>          END
>
> And the code:
>
>         // Corresponds to the LAYER statement above
>         layerObj l = new layerObj(map);
>         l.setType(MS_LAYER_TYPE.MS_LAYER_POINT);
>         l.setConnectiontype(MS_CONNECTION_TYPE.MS_POSTGIS);
>         l.setConnection(connectionString);
>         l.setData(geomString);
>         l.setStatus(mapscriptConstants.MS_ON);
>         l.setName("data_layer");
>
>         // corresponds to CLASS statement
>         classObj c = l.getClass(0);
>         // paranoia?
>       if (c == null)
>                 c = new classObj(l);
>         // this seems to be needed in the API version of this
>         c.setStatus(mapscriptConstants.MS_ON);
>
>         // create a symbolObj and insert it into the map's symbol set
>         symbolObj so = new symbolObj("pin",pinPath);
>         symbolSetObj ss = map.getSymbolset();
>         ss.appendSymbol(so);
>         // create a style object to attach the symbol to
>         styleObj style = new styleObj(c);
>         style.setSymbol(1);
>         style.setSymbolname("pin");
>
> I've also attached the resulting map, though I'm not sure if the list
> will strip it or not.
>
> Thanks for any insight you can provide. In my perfect world the
> solution is something simple, even if not obvious :-)
>
>         --Rick.
>

Rick,

My recommendation is to include your "pin" symbol in your base map file
instead of adding it through mapscript.  Load up the base map file,
then add your new layer, set the style symbol to the index of the pin
symbol and you should be good to go.

Sean

--
Sean Gillies
sgillies at frii dot com
http://zcologia.com



More information about the MapServer-users mailing list