work with postgis & geoserver

 

[OpenLayers-Users] work with postgis & geoserver

beppe beppenapo at gmail.com
Mon Mar 1 13:42:10 EST 2010


Thanks for the suggestion, now it's time to work !!!
I hope to be able to do it!
There's something I don't understand yet, for example: when I click in
the map for create a new feature, I would display a form in a pop-up (or
in a <div>) for insert the geometry attributes...how?

thanks a lot

-beppe-

> Il giorno ven, 19/02/2010 alle 11.58 -0500, Louis Versailles ha scritto:
> > Hi
> > I dont know how good you are with OL and I am not the best but this is a simple
> > exemple
> > 
> > first get your wfs
> > exemple:
> > var wfs2 = new OpenLayers.Layer.Vector("Editable Features", {
> >         strategies: [new OpenLayers.Strategy.BBOX(), new
> > OpenLayers.Strategy.Save()],
> >         projection: new OpenLayers.Projection(this.srs),
> >         extractAttributes: true,
> >         protocol: new OpenLayers.Protocol.WFS({
> >             version: "1.1.0",
> >             srsName: this.srs,
> >             url: "http://jprovencher:8080/geoserver/wfs%22,
> >             featureNS :  "http://127.0.0.1:8082/topp%22,
> >             featureType: "conduite_aq",
> >             geometryName: "the_geom",
> >             schema:
> > "http://jprovencher:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=topp:conduite_aq"
> >         }),
> >         minScale:5000
> >     });
> > 
> > the new OpenLayers.Strategy.Save() is for savin your stuf.
> > Make sure your postgis table have primery key because if not geoserver will take
> > it as an read only table
> > 
> > than the control for drawing
> > 
> > var draw = new OpenLayers.Control.DrawFeature(
> >                 wfs2, OpenLayers.Handler.Path,
> >                 {
> >                     title: "Draw Feature",
> >                     displayClass: "olControlDrawFeaturePolygon",
> >                     handlerOptions: {multi: true}
> >                 }
> >             );
> > 
> > for display you can add it to a panel
> > 
> > var panel = new OpenLayers.Control.Panel(
> >                 {'displayClass': 'customEditingToolbar'}
> >             );
> > panel.addControls([draw]);
> > 
> > like in the exemple
> > http://www.openlayers.org/dev/examples/wfs-protocol-transactions.html (make
> > sure to create the displayClass)
> > 
> > if you want to do somting when the feature is added you can add a event to the
> > control:
> > 
> > draw.events.register('featureadded', draw, addattribut);
> > 
> > where the addattribut is a function where you do what you want
> > exemple:
> > 
> > function addattribut(object){
> >     //not sure if nessesery
> >     object.state = OpenLayers.State.INSERT;
> > 
> >     var attribut = object.feature.attributes;
> >     attribut['CODE'] ="test"
> > 
> >     saveStrategy.save()
> > 
> > }
> > 
> > hope it's help
> > 
> > (sory for my english)
> > 
> > Louis Versailles
> > 
> > 


Il giorno sab, 20/02/2010 alle 17.11 +0000, Luís de Sousa ha scritto:
> HI beppe,
> 
> You have a simple example to add new features with Geoserver. If can
> find it following:
> 
> My Geoserver -> Demo -> WFS-T demo
> 
> this should open a link to geoserver/www/wfs-t.html
> 
> To edit attributes you can have a look the last example in chapter 4
> of OpenGeo's OpenLayers Workshop:
> 
> http://workshops.opengeo.org/openlayers-intro/vector.html
> 
> Good luck,
> 
> Luís
> 
> On Fri, Feb 19, 2010 at 3:44 PM, beppe <beppenapo at gmail.com> wrote:
> > Hi list,
> > I've a postgis point table (epsg:32632) and I'm using a wfs service
> > (geoserver) to display it.
> > Now I'd like to be able to handle it (insert/delete/update/modify) but
> > I'm a little bit confused!!!
> > I could start from this [1], but I need also to define/change the
> > features attributes, something like this [2].
> > There is some simple example (easiest than example 2 !) to start?
> >
> > Your suggestions are really precious for me
> >
> > thanks
> >
> > -beppe-
> >
> > [1]
> > http://www.openlayers.org/dev/examples/wfs-protocol-transactions.html
> >
> > [2] http://dev4.mapgears.com/bdga/bdgaWFS-T.html
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >


 

 

 转载自:http://openlayers.org/pipermail/users/2010-March/016472.html

转载自:https://blog.csdn.net/weixin_33943836/article/details/85459644

You may also like...