Unable to pass additional parameters with WMSParams in OpenScales?

86 views
Skip to first unread message

Luu

unread,
Sep 29, 2013, 1:52:01 AM9/29/13
to opensca...@googlegroups.com

I'm using OpenScales-2.2 and GeoServer-2.3.4.

There is a layer 'myspace:mylayer'(defined as SQL View and 'ft_number' as SQL View Parameter) on GeoServer.

I try to set additional parameters by WMSParams:

    import org.openscales.core.layer.HTTPRequest;
    import org.openscales.core.layer.Layer;
    import org.openscales.core.layer.ogc.WMS;
    import org.openscales.core.layer.params.IHttpParams;
    import org.openscales.core.layer.params.ogc.WMSParams;
    import org.openscales.core.Map;

    ...
    ...
    // url and layer
    var url:String = "http://localhost:8080/geoserver";
    var layer:String = "myspace:mylayer";

    // create wms-layer
    var wmsLayer:Layer = new WMS("MyWMSLayer", url, layer);
    // create params
    var params:IHttpParams = new WMSParams(layer);
    params.setAdditionalParam("viewparams", "ft_number:20");
    (wmsLayer as HTTPRequest).params = params;

    // add wms-layer to the map
    map.addLayer(wmsLayer);

    ...

But the "setAdditianalParam" seems to be invalid, the "features" in the wms-Layer is incorrect.

Following is the request log (Jetty):

"GET /geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=myspace:mylayer
&STYLES=&SRS=EPSG:4326&BBOX=~,~,~,~
&WIDTH=800&HEIGHT=600&FORMAT=image/png&TRANSPARENT=TRUE&EXCEPTIONS=XML&TILED=false HTTP/1.1"

there is no "viewparams" above.

Thanks for your reading.

Any suggestion will be appreciated.

Diego Marrero

unread,
Sep 30, 2013, 2:24:50 AM9/30/13
to openscales-dev
I use setAdditonalParam and it works well for me. I'm not sure what you are trying to accomplish. If you want a new parameter ft_number with value 20, what you should do is params.setAdditionalParam ("ft_number", "20")

Regards.

Diego.



2013/9/29 Luu <like...@163.com>

--
You received this message because you are subscribed to the Google Groups "openscales-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openscales-de...@googlegroups.com.
To post to this group, send email to opensca...@googlegroups.com.
Visit this group at http://groups.google.com/group/openscales-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Luu

unread,
Sep 30, 2013, 5:04:24 AM9/30/13
to opensca...@googlegroups.com
Thanks for your reply.

I tried as your suggestion but failed.

I defined a layer " myspace:mylayer " as SQL View and " ft_number " as the view parameter:

         select
            aws.code,
            aws.name,
            data.date,
            data.temp

        from aws inner join data
        on aws.code=data.code

        where data.number='%ft_number%'

In the example of GeoServer, the parameters should be set by " viewparams ":

So I used params.setAdditionalParam("viewparams", "ft_number:20").

在 2013年9月30日星期一UTC+8下午2时24分50秒,diego写道:
Reply all
Reply to author
Forward
0 new messages