[OpenLayers-Users] create a layer from a getFeature url ?

Pierre GIRAUD bluecarto at gmail.com
Fri May 25 06:26:13 EDT 2007


This worked for me with this configuration :

function init(){
            OpenLayers.ProxyHost="/cgi-bin/proxy.cgi/?url=";
            map = new OpenLayers.Map('map');
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
            map.addLayer(layer);

            layer = new OpenLayers.Layer.WFS( "Owl Survey",
                "http://swing.brgm.fr/cgi-bin/carrieres",
                {typename: "exploitationsponctualsproduction", maxfeatures: 1},
                { featureClass: OpenLayers.Feature.WFS});
            map.addLayer(layer);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.zoomToMaxExtent();
        }

Please note that you probably need a proxy if the domain of you html
page and the one for the WFS server are not the same.

Regards.

Pierre

On 5/25/07, Husson Florian <f.husson at brgm.fr> wrote:
> My goal is to display on the map, the geometry result of a WFS getFeature.
>
> Something like that don't work, and I don't see how to do that...
>
> layer2 = new OpenLayers.Layer.WFS( "Quarry",
> "http://swing.brgm.fr/cgi-bin/carrieres?request=getfeature&service=wfs&version=1.0.0&typename=exploitationsponctualsproduction&maxFeatures=1",
>                 { typename: 'exploitationsponctualsproduction'},
>                 OpenLayers.Feature.WFS );
> map.addLayer(layer2);
>
> I looked at getfeatureinfo.html, but I didn't find anything.
>
> I looked at OpenLayers.Format.GML too and that must be the thing which I need, but I don't know how to make use of it and at which time I must call upon my WFS getFeature.
>
>
> Regards,
> Florian HUSSON.
>
>
>
> -----Message d'origine-----
> De : Christopher Schmidt [mailto:crschmidt at metacarta.com]
> Envoyé : jeudi 24 mai 2007 15:58
> À : Husson Florian
> Cc : users at openlayers.org
> Objet : Re: [OpenLayers-Users] create a layer from a getFeature url ?
>
> On Thu, May 24, 2007 at 03:29:06PM +0200, Husson Florian wrote:
> > Hello,
> >
> > I work with openlayers 2.4 and geoserver 1.5.
> >
> > In my application, the user must type an WFS url (getFeature) in a
> > textarea, and when he validate, I would like to draw the feature(s)
> > result.
> > Is it possible?
>
> Yes. OpenLayers.Format.GML and the getfeatureinfo.html file in the examples directory are probably both helpful.
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
> **********************************************************************************************
>
> Pensez à l'environnement avant d'imprimer ce message
>  Think Environment before printing
>
> Le contenu de ce mél et de ses pièces jointes est destiné à l'usage exclusif du (des) destinataire(s) désigné(s)
> comme tel(s).
> En cas de réception par erreur, le signaler à son expéditeur et ne pas en divulguer le contenu.
> L'absence de virus a été vérifiée à l'émission, il convient néanmoins de s'assurer de l'absence de
> contamination à sa réception.
>
> The contents of this email and any attachments areconfidential. They are intended for the named recipient(s)
> only.
> If you have received this email in error please notifythe system manager or the sender immediately and do not
> disclose the contents to anyone or make copies.
> eSafe scanned this email for viruses, vandals and malicious content.
>
> **********************************************************************************************
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list