[Geoserver-users] using CQL filters in wms requests with google maps

Hi all,

I'm wondering whether I'm approaching this the right way.
So I'm trying to make a site that displays data from my postgis database on google maps. What I want is to let visitors choose which layer/filters they want (basically time/location filter for now). I'm thinking CQL filters would be nice since they're embedded in the url itself, and when visitors choose an option that'll get sent to a php script which generates the right parameters, and then sent url back to browser. The only thing is there aren't that much examples of how CQL works on the geosever site, so is there other examples I can look at?

Another idea is to generate sld files with filters on the fly and then have Styles point to it in the url...but that opens the question of where to store the styles, etc...

Also, I tried playing with the example on google maps tutorial and added myStyles = 'a_style' in the javascript, but it didn't show up even after refreshing the page. Actually it stayed the same as the initial style even after I changed the default style in geoserver admin page. Anyone know what's wrong?

Thanks,
Doris

OK, I think I found what's going on, if I comment out this line in wms-gs.js provided on the geoserver google maps page, the myStyles registers.

if (typeof(window['this.myStyles'])=="undefined") this.myStyles="";

What is window['this.myStyles']?

Thanks.

Also, I tried playing with the example on google maps tutorial and
added myStyles = 'a_style' in the javascript, but it didn't show up
even after refreshing the page. Actually it stayed the same as the
initial style even after I changed the default style in geoserver admin
page. Anyone know what's wrong?

Thanks,
Doris

dlamoris@anonymised.com wrote:

Hi all,

I'm wondering whether I'm approaching this the right way.
So I'm trying to make a site that displays data from my postgis database on google maps. What I want is to let visitors choose which layer/filters they want (basically time/location filter for now). I'm thinking CQL filters would be nice since they're embedded in the url itself, and when visitors choose an option that'll get sent to a php script which generates the right parameters, and then sent url back to browser. The only thing is there aren't that much examples of how CQL works on the geosever site, so is there other examples I can look at?

My extremely unfinished tutorial at http://docs.codehaus.org/display/GEOSDOC/Common+Query+Language+(CQL)+Tutorial+(unfinished) is unfortunately about the best on the web. The only other thing to do is to look at the BNF of CQL: http://docs.codehaus.org/display/GEOTOOLS/CQL+Parser+Design I'm hoping to finish the tutorial someday, but I've got to do KML tutorials first.

Another idea is to generate sld files with filters on the fly and then have Styles point to it in the url...but that opens the question of where to store the styles, etc...

That can also work. You don't necessarily need to store the styles, you can send the SLD in the request, though you may hit the GET limit for browsers. I forget if we support POST GetMap requests. Or you can also just point at any URL for the SLD, so can just make temp SLD files in whatever's convenient for php.

Chris

Also, I tried playing with the example on google maps tutorial and added myStyles = 'a_style' in the javascript, but it didn't show up even after refreshing the page. Actually it stayed the same as the initial style even after I changed the default style in geoserver admin page. Anyone know what's wrong?

Thanks,
Doris

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4005,46a10484265035219720167!

Doris Lam wrote:

Hi Chris,

Does the CQL filters work the same way as filters and filter functions in sld (anything one can do, the other can also?) I noticed in one example, (population > 80000 one) you used > instead of PropertyIsGreaterThan, etc, does that mean we can use mathematical notation for properties that aren't geometries?

Yes. That's probably the main point of CQL. It's more terse representations of the things in the filter spec.

If we want to say, filter out a city, would that be CQL_FILTER=(city=name)AND(whatever else we want to filter)...?

Yes.

I'm a bit confused about the BNF...it lists all the valid filter strings? Which url encoding should I use for spaces and >, etc? (+ or %20)?

Both work. + is a lot more readable imho. I didn't realize you could use it until near the end of the examples I was doing.

Sorry! I'm probably have more questions over the next week as I'm trying to figure this out...Thanks so much for you help!

No problem, the one thing I ask is you cc the list on questions, as I may not be able to answer them and others may be curious.

best regards,

Chris

Doris

Chris Holmes wrote:

dlamoris@anonymised.com wrote:

Hi all,

I'm wondering whether I'm approaching this the right way.
So I'm trying to make a site that displays data from my postgis database on google maps. What I want is to let visitors choose which layer/filters they want (basically time/location filter for now). I'm thinking CQL filters would be nice since they're embedded in the url itself, and when visitors choose an option that'll get sent to a php script which generates the right parameters, and then sent url back to browser. The only thing is there aren't that much examples of how CQL works on the geosever site, so is there other examples I can look at?

My extremely unfinished tutorial at http://docs.codehaus.org/display/GEOSDOC/Common+Query+Language+(CQL)+Tutorial+(unfinished) is unfortunately about the best on the web. The only other thing to do is to look at the BNF of CQL: http://docs.codehaus.org/display/GEOTOOLS/CQL+Parser+Design I'm hoping to finish the tutorial someday, but I've got to do KML tutorials first.

Another idea is to generate sld files with filters on the fly and then have Styles point to it in the url...but that opens the question of where to store the styles, etc...

That can also work. You don't necessarily need to store the styles, you can send the SLD in the request, though you may hit the GET limit for browsers. I forget if we support POST GetMap requests. Or you can also just point at any URL for the SLD, so can just make temp SLD files in whatever's convenient for php.

Chris

Also, I tried playing with the example on google maps tutorial and added myStyles = 'a_style' in the javascript, but it didn't show up even after refreshing the page. Actually it stayed the same as the initial style even after I changed the default style in geoserver admin page. Anyone know what's wrong?

Thanks,
Doris

-------------------------------------------------------------------------

This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

!DSPAM:4005,46a3d7b9239733668746562!