[pgrouting-users] ender the postgresql query into browser by openlayers (GeoJSON output)

Charles Galpin cgalpin at lhsw.com
Wed Aug 10 17:17:59 EDT 2011


Hi Javad

I use geoserver and it's "sql view" feature to do this.  I don't return the results in GeoJSON but I believe it can, but you can use a vector layer if you want the raw data to put into a store or do something interactive, or a wms layer if there are large results for better performance.

The way it works is pretty much like you describe. In openlayers you define a layer with a filter and in your app you can let someone enter a street name say, and refresh the layer (using mergeNewParams).  The parameters get send to the geoserver sql view which you'd have your select statement use the parameter value, and the layer results go back just like in a static layer.

hth
charles

On Aug 10, 2011, at 12:54 PM, javad sadidi wrote:

> hi to all.
>  I am working on pgrouting project.I am using OSM data to find the best route. 
> but I want to take a query into postgresql by php server side and returen the result on the browser with GeoJSON format. for example I want bring the result of this query as selected streets on the browser by openlayers.
> select * from table where streetname is x or y;
> then bring the result by Geojson output to the browser,I would like to display these streets as red color in the browser for clients.
> who can help me?
> it the simplest example.
> danke
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users



More information about the Pgrouting-users mailing list