2

In Geoserver i create parametric view:

SELECT *
FROM MyTable
LEFT JOIN Track On MyTable.SegmentID=Track.SegmentID
WHERE (DATEPART(yy, MyTable.Date)=%year%
AND DATEPART(mm, MyTable.Date)=%month%
AND DATEPART(dd, MyTable.Date)=%day%)

i set default values 2009年09月18日

Now i go in layer preview pick my layer and see layer with features with Date=2009年09月18日.
Now i want to see features with another date. In address line i add:

viewparams=year:2009

But still see same features. I try another dates but not help.
Whats wrong?

asked Apr 25, 2013 at 9:44
2
  • is that %mounth% correct? or just a typo here? Commented Apr 25, 2013 at 10:49
  • Yeah %month% of course. Just a typo. Commented Apr 26, 2013 at 3:54

1 Answer 1

0

I dont know what heppens with my view but i delete all parameters except one and try it. And use viewparams parameter in Layer Preview i get features. After i add another parameters in view and my final view:

SELECT 
myTable.Segment_ID,
the_geom
FROM myTable
LEFT JOIN Track ON Segment_ID.Segment_ID=Track.Segment_ID
where (DATEPART(yy, myTable.Date) = %year%
AND DATEPART(mm, myTable.Date) = %mounth%
AND DATEPART(dd, myTable.Date) = %day%
AND DATEPART(hh, myTable.Date) = %hour%)

And Layer Preview address look like:

http://localhost:8080/geoserver/cite/wms?service=WMS&version=1.1.0&request=GetMap&
layers=cite:IntensityPram&styles=&
bbox=62.65931379022568,59.354842,77.56711981909412,63.919917987969896&
width=1077&height=330&srs=EPSG:4326&
viewparams=year:2009;mounth:09;day:18;hour:11&
format=application/openlayers

I think my problem was with Bouding Box. It was too small.

answered May 6, 2013 at 16:43

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.