[Geoserver-devel] Trying out Dynamic SLD

I am working on implementing a web service where a user can send parameters
to change the image returned by WMS. Right now I have written a servlet
which simply returns a SLD xml file based on the parameters given to it. It
looks something like this:

http://localhost:8080/geoserver/DynamicSLDRequest?layer=topp:states&shapeType=polygon

So I can use this dynamic SLD generator to implement the web service. The
servlet would take assign parameter "layer" to
"<NamedLayer><Name>______</Name>...." and return an SLD appropriate for a
polygon shape. If I make a request to the servlet directly it outputs a
valid SLD xml.

Now when I try to use the WMS service and use the "SLD=" feature, I get an
error. This is how I make the call:

http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&Format=image/png&request=GetMap&width=550&height=250&srs=EPSG:4326&SLD=http://localhost:8080/geoserver/DynamicSLDRequest?layer=topp:states&shapeType=polygon

After working on it, I found the error was becasue when I make the call
through the WMS service, it recognizes only the first parameter that is sent
in the SLD URL. So in the above example, layer is assigned the correct value
and shapeType is assigned null. If I send a request with shapeType as the
first parameter like this:

http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&Format=image/png&request=GetMap&width=550&height=250&srs=EPSG:4326&SLD=http://localhost:8080/geoserver/DynamicSLDRequest?shapeType=polygon&layer=topp:states

Then shapeType is assigned the correct value but payer is assigned null.

Is there some kind of limitation on the SLD url when used thorugh the WMS
service for a GetMap operation?
--
View this message in context: http://www.nabble.com/Trying-out-Dynamic-SLD-tp25157667p25157667.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

I guess you only need to escape the value for the SLD parameter, like in with the JavaScript escape function:

url += "&SLD=" + escape("http://localhost:8080/geoserver/DynamicSLDRequest?shapeType=polygon&layer=topp:states&quot;\);

Cheers,
Gabriel

sabman wrote:

I am working on implementing a web service where a user can send parameters
to change the image returned by WMS. Right now I have written a servlet
which simply returns a SLD xml file based on the parameters given to it. It
looks something like this:

http://localhost:8080/geoserver/DynamicSLDRequest?layer=topp:states&shapeType=polygon

So I can use this dynamic SLD generator to implement the web service. The
servlet would take assign parameter "layer" to
"<NamedLayer><Name>______</Name>...." and return an SLD appropriate for a
polygon shape. If I make a request to the servlet directly it outputs a
valid SLD xml.

Now when I try to use the WMS service and use the "SLD=" feature, I get an
error. This is how I make the call:

http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&Format=image/png&request=GetMap&width=550&height=250&srs=EPSG:4326&SLD=http://localhost:8080/geoserver/DynamicSLDRequest?layer=topp:states&shapeType=polygon

After working on it, I found the error was becasue when I make the call
through the WMS service, it recognizes only the first parameter that is sent
in the SLD URL. So in the above example, layer is assigned the correct value
and shapeType is assigned null. If I send a request with shapeType as the
first parameter like this:

http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&Format=image/png&request=GetMap&width=550&height=250&srs=EPSG:4326&SLD=http://localhost:8080/geoserver/DynamicSLDRequest?shapeType=polygon&layer=topp:states

Then shapeType is assigned the correct value but payer is assigned null.

Is there some kind of limitation on the SLD url when used thorugh the WMS
service for a GetMap operation?

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

ah! Thanks.

On Wed, Aug 26, 2009 at 4:46 PM, Gabriel Roldan <groldan@anonymised.com> wrote:

I guess you only need to escape the value for the SLD parameter, like in with the JavaScript escape function:

url += “&SLD=” + escape(“http://localhost:8080/geoserver/DynamicSLDRequest?shapeType=polygon&layer=topp:states”);

Cheers,
Gabriel

sabman wrote:

I am working on implementing a web service where a user can send parameters
to change the image returned by WMS. Right now I have written a servlet
which simply returns a SLD xml file based on the parameters given to it. It
looks something like this:

http://localhost:8080/geoserver/DynamicSLDRequest?layer=topp:states&shapeType=polygon

So I can use this dynamic SLD generator to implement the web service. The
servlet would take assign parameter “layer” to
“______…” and return an SLD appropriate for a
polygon shape. If I make a request to the servlet directly it outputs a
valid SLD xml.

Now when I try to use the WMS service and use the “SLD=” feature, I get an
error. This is how I make the call:

http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&Format=image/png&request=GetMap&width=550&height=250&srs=EPSG:4326&SLD=http://localhost:8080/geoserver/DynamicSLDRequest?layer=topp:states&shapeType=polygon

After working on it, I found the error was becasue when I make the call
through the WMS service, it recognizes only the first parameter that is sent
in the SLD URL. So in the above example, layer is assigned the correct value
and shapeType is assigned null. If I send a request with shapeType as the
first parameter like this:

http://localhost:8080/geoserver/wms?bbox=-130,24,-66,50&Format=image/png&request=GetMap&width=550&height=250&srs=EPSG:4326&SLD=http://localhost:8080/geoserver/DynamicSLDRequest?shapeType=polygon&layer=topp:states

Then shapeType is assigned the correct value but payer is assigned null.
Is there some kind of limitation on the SLD url when used thorugh the WMS
service for a GetMap operation?


Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.


Regards,
Sebastin