[OpenLayers-Users] WFS ProxyHost
Kai Behncke
Kai-Behncke at gmx.de
Wed Feb 18 06:13:33 EST 2009
Hello,
I took the one "proxy.cgi" that lies in the examples-directory of the openlayers-code. Copied it on a linux-server, got some problems, did dos2unix and it worked perfectly.
The only thing you might need to change is:
allowedHosts = ['www.openlayers.org', 'openlayers.org',
'labs.metacarta.com', 'world.freemap.in',
'www.bsc-eoc.org', 'www.yourspecialserver.de',
'sigma.openplans.org',
'www.openstreetmap.org']
Best regards, Kai
-------- Original-Nachricht --------
> Datum: Wed, 18 Feb 2009 08:06:08 -0300
> Von: Raphael Saldanha <saldanha.plangeo at gmail.com>
> An: Kai Behncke <Kai-Behncke at gmx.de>
> CC: users at openlayers.org
> Betreff: Re: [OpenLayers-Users] WFS ProxyHost
> Thanks Kai,
>
> But I dont have an idea how to write a proxy... do you know where can I
> find
> some tips or a generic one?
>
> On Wed, Feb 18, 2009 at 8:01 AM, Kai Behncke <Kai-Behncke at gmx.de> wrote:
>
> > Dear Raphael,
> >
> > I had also some problems with the wfs proxy-host.
> >
> > In my case it was because I wrote the code of the proxy-host on a
> > Windows-Machine and loaded it on a linux-server, there were some problem
> > with the word wraps then (maby by coincidence you have the same error).
> I
> > solved it with a dos2unix-compilation at the unix-server.
> >
> >
> >
> > > I'm starting to think why use Openlayers... this ProxyHost is a really
> > > bitch.
> >
> >
> > Well, sometimes, at the beginning, OpenLayers is not soooooo easy, but
> > after a while and some steps of learning it really starts to make big
> fun.
> > So don`t give up :-)
> >
> > Beste regards, Kai
> >
> > >
> > > On Tue, Feb 17, 2009 at 2:25 PM, Arnd Wippermann
> > > <arnd.wippermann at web.de>wrote:
> > >
> > > > Hi,
> > > >
> > > > for local addresses you don't need a proxy host. To be sure, that
> your
> > > > local address is used I would use relative path.
> > > >
> > > > OpenLayers.ProxyHost="/cgi-bin/proxy.cgi/?url="
> > > >
> > > > and you can also try to load your WFS with relative path. Then the
> > proxy
> > > > script is not used. Not 100% sure but only addresses, which begins
> with
> > > http
> > > > , use the proxy script.
> > > >
> > > > // Layer WFS
> > > > wfs = new OpenLayers.Layer.WFS(
> > > > "Quadras WFS",
> > > > "/geoserver/wfs",
> > > > {typename: 'topp:quadra'},
> > > >
> > > > If your WFS is now loaded, then there seems something wrong with
> your
> > > proxy
> > > > script or configuration. If not loaded, copy the WFS request from
> > > firebug
> > > > into the address bar of your browser, to be sure that the request
> send
> > a
> > > > valid response.
> > > >
> > > > Arnd Wippermann
> > > >
> > > > ------------------------------
> > > > *Von:* users-bounces at openlayers.org
> > > [mailto:users-bounces at openlayers.org]
> > > > *Im Auftrag von *Raphael Saldanha
> > > > *Gesendet:* Dienstag, 17. Februar 2009 02:10
> > > > *An:* users at openlayers.org
> > > > *Betreff:* [OpenLayers-Users] WFS ProxyHost
> > > >
> > > > Hi!
> > > >
> > > > I'm having some troubles on trying to use WFS...
> > > >
> > > > As suggested in the FAQ, and put the proxy.cgi on cgi-bin Apache
> > folder,
> > > > and add the line "AddHandler python-cgi-script .cgi" on httpd.conf,
> as
> > > > suggested in http://gist.fas.harvard.edu/chgis/?p=14.
> > > >
> > > > But loading the following page, I receive the error 1012, on
> Firebug.
> > > >
> > > > Help please!!!
> > > >
> > > > <html>
> > > > <head>
> > > > <title>IPTU</title>
> > > > <link rel="stylesheet" type="text/css" href="
> > > >
> http://localhost:8080/geoserver/openlayers/theme/default/style.css"/>
> > > >
> > > >
> > > >
> > > >
> > > > <!-- Import OpenLayers, reduced, wms read only version -->
> > > > <script src="
> > > > http://localhost:8080/geoserver/openlayers/OpenLayers.js"
> > > > type="text/javascript"></script>
> > > > <script defer="defer" type="text/javascript">
> > > > var map;
> > > > var quadra;
> > > > var imagem;
> > > > var wfs;
> > > >
> > > > OpenLayers.ProxyHost="
> > > > http://localhost:8080/cgi-bin/proxy.cgi/?url=";
> > > >
> > > > // pink tile avoidance
> > > > OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
> > > > // make OL compute scale according to WMS spec
> > > > OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
> > > >
> > > > function init(){
> > > > format = 'image/png';
> > > >
> > > > var bounds = new OpenLayers.Bounds(
> > > > 497839.91636617144, 7649918.889418672,
> > > > 499243.91636617144, 7650565.389418672
> > > > );
> > > >
> > > > var options = {
> > > > controls: [],
> > > > maxExtent: bounds,
> > > > maxResolution: 5.484375,
> > > > projection: "EPSG:32723",
> > > > units: 'm'
> > > >
> > > > };
> > > >
> > > > map = new OpenLayers.Map('map', options);
> > > >
> > > > // Layer QUADRA
> > > > quadra = new OpenLayers.Layer.WMS(
> > > > "Quadras",
> "http://localhost:8080/geoserver/wms",
> > > > {
> > > > layers: 'topp:quadra',
> > > > transparent: "true",
> > > > format: "image/png",
> > > > srs: 'EPSG:32723',
> > > > height: '345',
> > > > width: '800',
> > > > styles: '',
> > > > tiled: 'true',
> > > > tilesOrigin :
> > > > "497839.91636617144,7649918.889418672"
> > > > }
> > > > );
> > > >
> > > > // Layer WFS
> > > > wfs = new OpenLayers.Layer.WFS(
> > > > "Quadras WFS",
> > > > "http://localhost:8080/geoserver/wfs",
> > > > {typename: 'topp:quadra'},
> > > > {
> > > > typename: 'quadra',
> > > > featureNS: 'http://www.openplans.org/topp',
> > > > extractAttributes: false
> > > > }
> > > > );
> > > >
> > > > //Layer IMAGEM
> > > > imagem = new OpenLayers.Layer.WMS(
> > > > "WorldView-1",
> > > "http://localhost:8080/geoserver/wms",
> > > > {
> > > > layers: 'topp:lavras',
> > > > srs: 'EPSG:32723',
> > > > height: '345',
> > > > width: '800',
> > > > styles: '',
> > > > format: format,
> > > > tiled: 'true',
> > > > tilesOrigin :
> > > > "497839.91636617144,7649918.889418672"
> > > > }
> > > > );
> > > >
> > > >
> > > > map.addLayers([quadra,wfs,imagem]);
> > > >
> > > > // build up all controls
> > > > map.addControl(new OpenLayers.Control.PanZoomBar({
> > > > position: new OpenLayers.Pixel(2, 15)
> > > > }));
> > > > map.addControl(new OpenLayers.Control.Navigation());
> > > > map.addControl(new
> OpenLayers.Control.LayerSwitcher());
> > > > map.zoomToExtent(bounds);
> > > >
> > > >
> > > >
> > > >
> > > > }
> > > >
> > > >
> > > > </script>
> > > > </head>
> > > > <body onload="init()">
> > > >
> > > > <div id="map">
> > > > </div>
> > > >
> > > > </body>
> > > > </html>
> > > >
> > > >
> > > > --
> > > > Regards,
> > > >
> > > > Raphael Saldanha
> > > > saldanha.plangeo at gmail.com
> > > >
> > >
> > >
> > >
> > > --
> > > Atenciosamente,
> > >
> > > Raphael Saldanha
> > > saldanha.plangeo at gmail.com
> >
> > --
> > Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit
> allen:
> > http://www.gmx.net/de/go/multimessenger01
> >
>
>
>
> --
> Atenciosamente,
>
> Raphael Saldanha
> saldanha.plangeo at gmail.com
--
Jetzt 1 Monat kostenlos! GMX FreeDSL - Telefonanschluss + DSL
für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
More information about the Users
mailing list