jkh6100
jkh6100

Reputation: 129

openlayers get database informs using geoserver

I am using geoserver, and POSTGIS and, I tried to Get Database informs from postgis on openlayers, So My question is:

  1. Is there any way sending request sql to postgis on openlayers?
  2. Or is there a geoserver api that sending request sql dialect to postgis and return results
  3. Any other way to Get database informs from postgis?

Upvotes: 2

Views: 839

Answers (1)

So4ne
So4ne

Reputation: 1182

You can use SQL View on Geoserver Side. You write you SQL request with the params you want to query like select info from country where country = '%param%' and then request the WMS with mergeParams where param is &viewparams=country:[the country you want]

Here's the link to Geoserver's doc which is pretty well explained : http://docs.geoserver.org/stable/en/user/data/database/sqlview.html

Upvotes: 1

Related Questions