[Gfoss] wfs OpenLayers - Damiano Natali

Stefano Salvador stefano.salvador a gmail.com
Ven 18 Feb 2011 19:30:39 CET


> le richieste WFS, come tutte le richieste dati, non possono essere
> crossdomain, ovvero per farla breve se chiedi i dati a geoserver
> all'indirizzo "localhost:8080", necessariamene la tua pagina deve
> essere pubblicata da quel dominio e porta.
> prova a far pubblicare la pagina da geoserver (magari piazzala dentro
> webapps\geoserver\sample) e vedi se funziona.
> in ogni caso se l'errore è questo, la console di firebug ti
> mostrerebbe l'errore...

questo purtroppo non è vero, quasi tutti i browser si limitano ad
ignorare la richiesta (o comunque firebug a me non mostrava niente).
Comunque copio e incollo dalle FAQ di OL:

Q: Why isn't WFS working on my local checkout of OpenLayers?

A: This is probably because you do not have a proxy host set up. See
FrequentlyAskedQuestions#ProxyHost

Q: I'm trying to use WFS, why won't my vector data show up?

A: Try not setting the featureClass property when declaring your WFS layer.

Q: Why do I need a ProxyHost?

A: Due to security restrictions in Javascript, it is not possible to
retrieve information from remote domains via an XMLHttpRequest.
Classes like WFS and GeoRSS use XMLHTTPRequest to get their data. If
they are querying a remote server (anything other than the machine
hosting your page), you must install a proxy script somewhere web
accessible on that machine. See below for how to set up your own
ProxyHost.
If the OpenLayers.ProxyHost variable is not set to a valid proxy host,
requests are sent directly to the remote servers. In most cases, the
result will be a security exception, although this exception often
occurs silently.

Q: How do I set up a ProxyHost?

An example proxy host script is available here:
trunk/openlayers/examples/proxy.cgi
For the standard Apache configuration, you would place proxy.cgi into
your /usr/lib/cgi-bin/ directory.
Once a proxy host script has been installed, you must then edit the
OpenLayers.ProxyHost variable to match that URL.
Given the above standard Apache configuration:

    OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

If you have done something like this, you should be able to visit:

     http://YourDomain.example.com/cgi-bin/proxy.cgi

The resulting content at that page should be the openlayers.org website.

If you get a 404 error instead, either the proxy script is not in the
right location, or your webserver is not configured correctly.


Maggiori informazioni sulla lista Gfoss