[OpenLayers-Users] Dynamically add vector layer from database

Eric Lemoine eric.lemoine at camptocamp.com
Sun Sep 6 03:39:07 EDT 2009


On Saturday, September 5, 2009, frknml <faruk.namli at gmail.com> wrote:
>
>
>  Hi everybody;

Hi


>
> I'm new for openlayers and i need your helps.My problem is i have to add
> vector layer which filled with points which comes from database .What is
> your suggestions how can i get data from database and create a
> vectorlayer?

You basically have two options for serving vector data: either (a) use
an external software such as GeoServer, MapServer or FeatureServer, or
(b) implement it in your application. For the latter you can rely on
existing librairies and/or frameworks.

> One way is making an ajax request to my servlet and servlet
> returns datas as json or xml format to my client side and adding this points
> one by one to my vector layer,

Yes. GeoJSON would yield good performance - parsing JSON is faster
than XML in the browser.

If you are to implement data serving within your java webapp and want
to use GeoJSON as the data representation format I'd recommend looking
at the MapFish GeoJSON Java library [*].

[*] <http://trac.mapfish.org/trac/mapfish/browser/trunk/MapFish/server/java/mapfish-geo-lib>




> this is an inefficient way please show me the
> possible way or ways.

Sounds good to me. Client side you'd use an HTTP protocol
(OpenLayers.Protocol.HTTP) with a format (ex :
OpenLayers.Format.GeoJSON) in your vectoe layer.

Cheers,

>
> Faruk Namlı
> --
> View this message in context: http://n2.nabble.com/Dynamically-add-vector-layer-from-database-tp3584364p3584364.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list