[OpenLayers-Users] How to display PostGIS data through Openlayers and JSP

Stephen Woodbridge woodbri at swoodbridge.com
Sat Jul 24 14:19:10 EDT 2010


George Matt wrote:
> Hi all,
>  
> Is it possible to show postgis data in openlayers?
>  
> If yes can some body points me to some links or upload a working example 
> to illustrate.
>  
> A usecase can be:
> Consider a road table (road_id, geom, road_name) in the postgre/postgis 
> database. In SQL the select statement can be [SELECT road_id, 
> ST_AsText(road_geom) AS geom, road_name FROM roads;] to select all the 
> roads. Now how to give it to openlayers to show them on the map.


George,

You need some application on the server side like:

- mapserver that can connect to the database and render a map image. 
There are other application that can do this, some in java if you prefer.

- or you can do the query on the servlet and format the results into GML 
or GeoJSON, but this in only viable if you have under 1000 features that 
you are rendering at any give time. And 1000 might be pushhing the limit 
depending on the browser performance and memory.

-Steve W



More information about the Users mailing list