Discussion:
[OpenLayers-Users] WFS and OL
Gis Newbye
2013-10-14 18:10:03 UTC
Permalink
I've tested my WFS with
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP

and all is fine i can see my data. And i see the states one time.

when i try to add it in Open Layers with:

<script type="text/javascript">
var map, layer, select, hover, control;

function init(){
OpenLayers.ProxyHost= "proxy.cgi?url=";
map = new OpenLayers.Map('map', {
controls: [
new OpenLayers.Control.PanZoom(),
new OpenLayers.Control.Permalink(),
new OpenLayers.Control.Navigation()
]
});
layer = new OpenLayers.Layer.WMS(
"States WMS/WFS",
"
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP
",
{layers: 'Municipality:MN_NAME', format: 'image/gif'}
);
select = new OpenLayers.Layer.Vector("Selection", {styleMap:
new
OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
});
hover = new OpenLayers.Layer.Vector("Hover");
map.addLayers([layer, hover, select]);

control = new OpenLayers.Control.GetFeature({
protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer),
box: true,
hover: true,
multipleKey: "shiftKey",
toggleKey: "ctrlKey"
});
control.events.register("featureselected", this, function(e) {
select.addFeatures([e.feature]);
});
control.events.register("featureunselected", this, function(e) {
select.removeFeatures([e.feature]);
});
control.events.register("hoverfeature", this, function(e) {
hover.addFeatures([e.feature]);
});
control.events.register("outfeature", this, function(e) {
hover.removeFeatures([e.feature]);
});
map.addControl(control);
control.activate();

// map.setCenter(new
OpenLayers.Bounds(-140.444336,25.115234,-44.438477,50.580078).getCenterLonLat(),
3);
}
</script>

i see the states many time and not only one time! And i cannot "Query"
datas Why?
Phil Scadden
2013-10-14 20:02:50 UTC
Permalink
My guess would be an issue with SRS (mismatch between what OL thinks is
the SRS and what it actually is). Using chrome developer tools or
firebug, use the NET tab and see exactly what the WFS request looks
like. That should give you some big hints as to the nature of the problem.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
Gis Newbye
2013-10-15 04:30:02 UTC
Permalink
1. I can see this many times:
<img class="olTileImage" style="visibility: inherit; opacity: 1;
position: absolute; left: 1565px; top: 76px; width: 256px; height: 256px;"
src="
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP&FORMAT=image%2Fgif&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=45,45,90,90&WIDTH=256&HEIGHT=256
">

Do i have to change epsg in mapfile or in OL?

now i've this mapfile:
http://pastebin.com/rqjMnjuL

and from firebug i see always this:
http://pastebin.com/fMAPEHM1
Post by Phil Scadden
My guess would be an issue with SRS (mismatch between what OL thinks is
the SRS and what it actually is). Using chrome developer tools or firebug,
use the NET tab and see exactly what the WFS request looks like. That
should give you some big hints as to the nature of the problem.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
______________________________**_________________
Users mailing list
http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
Phil Scadden
2013-10-15 20:04:10 UTC
Permalink
Please keep on list so others might help.

Show you map, and then do the GETFeature click that is returning
everything. It is a call on the NET table with request=GetFeatureInfo in
it (and of particular interest will be the bbox and SRS).

I have never user Mapserver so not able to help there, but general
design is for OL to set the project and to pass requests to the WMS
server specifying the SRS that it is using. I could not see any SRS
specified on your map config so I guess it defaults to 4326. You might
want to reconsider this as 4326 (more or les Plate Carre) has no
redeeming features as a projection at all, but this isnt relevant to the
problem at hand. It looks to me like the getfeatureinfo request in OL is
sending a request that mapserver interprets as asking for a bbox over
the whole area. You might improve things somewhat by setting up the map
with maxextent etc.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
Gis Newbye
2013-10-15 20:47:28 UTC
Permalink
Thanks for the answer!

I cannot understand why the same thing is replyed 19 times. I can see 19
times Getmapserve.exe in Net button of firebug, with same code

BBOX=-135,0,-90,45
FORMAT=image/gif
HEIGHT=256
LAYERS=ALL
MAP=C:/myprojects/case.map
MODE=MAP
REQUEST=GetMap
SERVICE=WMS
SRS=EPSG:4326
STYLES=
VERSION=1.1.1
WIDTH=256

but differents BBOX

BBOX-90,0,-45,45FORMATimage/gifHEIGHT256LAYERSALLMAPC:/myprojects/case.map
MODEMAPREQUESTGetMapSERVICEWMSSRSEPSG:4326STYLESVERSION1.1.1WIDTH256


If i put online the webpage can be usefull to have help?
Post by Phil Scadden
Please keep on list so others might help.
Show you map, and then do the GETFeature click that is returning
everything. It is a call on the NET table with request=GetFeatureInfo in it
(and of particular interest will be the bbox and SRS).
I have never user Mapserver so not able to help there, but general design
is for OL to set the project and to pass requests to the WMS server
specifying the SRS that it is using. I could not see any SRS specified on
your map config so I guess it defaults to 4326. You might want to
reconsider this as 4326 (more or les Plate Carre) has no redeeming features
as a projection at all, but this isnt relevant to the problem at hand. It
looks to me like the getfeatureinfo request in OL is sending a request that
mapserver interprets as asking for a bbox over the whole area. You might
improve things somewhat by setting up the map with maxextent etc.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
Phil Scadden
2013-10-15 22:09:56 UTC
Permalink
These are the getmap requests that build your map, one first each tile.
This is normal and not a problem. Have a look at the getfeatureinfo one
however.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
Gis Newbye
2013-10-16 05:46:12 UTC
Permalink
I cannot see in firebug any getfeatureinfo i've only get Mapserve.exe?

in html of firebug i see:
http://pastebin.com/T3XPtVeT

in NET of firebug:

GET mapserve.exe?
as shownd in other emails

POST mapserve.exe?
http://pastebin.com/StrAN7H1
Post by Phil Scadden
These are the getmap requests that build your map, one first each tile.
This is normal and not a problem. Have a look at the getfeatureinfo one
however.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
______________________________**_________________
Users mailing list
http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
Diego Guidi
2013-10-16 06:29:59 UTC
Permalink
btw: the proxy works?
try to build a sample page that runs inside your mapserver.
or even better: download a geoserver package, and the build an html
page that works without proxy, publishing it inside data_dir\www, and
that uses "states" layers.
So you can post here and we can debug easily what's happening.

Diego Guidi
Post by Gis Newbye
I cannot see in firebug any getfeatureinfo i've only get Mapserve.exe?
http://pastebin.com/T3XPtVeT
GET mapserve.exe?
as shownd in other emails
POST mapserve.exe?
http://pastebin.com/StrAN7H1
Post by Phil Scadden
These are the getmap requests that build your map, one first each tile.
This is normal and not a problem. Have a look at the getfeatureinfo one
however.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Gis Newbye
2013-10-16 06:51:55 UTC
Permalink
As i told before the problem is not mapserver because if i put in my
browser:

http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP

i can see my map!

inspecting with firebug:

<html>

<head> … </head>
<body>
<img class="decoded" src="
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP"
alt="
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP
"></img>
</body>

</html>
Post by Diego Guidi
btw: the proxy works?
try to build a sample page that runs inside your mapserver.
or even better: download a geoserver package, and the build an html
page that works without proxy, publishing it inside data_dir\www, and
that uses "states" layers.
So you can post here and we can debug easily what's happening.
Diego Guidi
Post by Gis Newbye
I cannot see in firebug any getfeatureinfo i've only get Mapserve.exe?
http://pastebin.com/T3XPtVeT
GET mapserve.exe?
as shownd in other emails
POST mapserve.exe?
http://pastebin.com/StrAN7H1
Post by Phil Scadden
These are the getmap requests that build your map, one first each tile.
This is normal and not a problem. Have a look at the getfeatureinfo one
however.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Diego Guidi
2013-10-16 06:54:40 UTC
Permalink
of course your wfs works, but OL app needs a proxy. try to check with
firebug if actual "proxy.cgi" calls works...

Diego Guidi
Post by Gis Newbye
As i told before the problem is not mapserver because if i put in my
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP
i can see my map!
<html>
<head> … </head>
<body>
<img class="decoded"
src="http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP"
alt="http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP"></img>
</body>
</html>
Post by Diego Guidi
btw: the proxy works?
try to build a sample page that runs inside your mapserver.
or even better: download a geoserver package, and the build an html
page that works without proxy, publishing it inside data_dir\www, and
that uses "states" layers.
So you can post here and we can debug easily what's happening.
Diego Guidi
Post by Gis Newbye
I cannot see in firebug any getfeatureinfo i've only get Mapserve.exe?
http://pastebin.com/T3XPtVeT
GET mapserve.exe?
as shownd in other emails
POST mapserve.exe?
http://pastebin.com/StrAN7H1
Post by Phil Scadden
These are the getmap requests that build your map, one first each tile.
This is normal and not a problem. Have a look at the getfeatureinfo one
however.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Gis Newbye
2013-10-16 19:14:53 UTC
Permalink
i've edited also another WFS Example but i still cannot see my layer..

The layer is a of some municipality of south Africa.. i cannot see them

This is the webpage that i edited
http://gisnewbye.hopto.org/openlayers/examples/wfs-states.html

so you can debug with firebug and maybe help me :)
Post by Diego Guidi
of course your wfs works, but OL app needs a proxy. try to check with
firebug if actual "proxy.cgi" calls works...
Diego Guidi
Post by Gis Newbye
As i told before the problem is not mapserver because if i put in my
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP
Post by Gis Newbye
i can see my map!
<html>
<head> … </head>
<body>
<img class="decoded"
src="
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP
"
Post by Gis Newbye
alt="
http://192.168.1.95/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=Municipality&MODE=MAP
"></img>
Post by Gis Newbye
</body>
</html>
Post by Diego Guidi
btw: the proxy works?
try to build a sample page that runs inside your mapserver.
or even better: download a geoserver package, and the build an html
page that works without proxy, publishing it inside data_dir\www, and
that uses "states" layers.
So you can post here and we can debug easily what's happening.
Diego Guidi
Post by Gis Newbye
I cannot see in firebug any getfeatureinfo i've only get Mapserve.exe?
http://pastebin.com/T3XPtVeT
GET mapserve.exe?
as shownd in other emails
POST mapserve.exe?
http://pastebin.com/StrAN7H1
Post by Phil Scadden
These are the getmap requests that build your map, one first each
tile.
Post by Gis Newbye
Post by Diego Guidi
Post by Gis Newbye
Post by Phil Scadden
This is normal and not a problem. Have a look at the getfeatureinfo
one
Post by Gis Newbye
Post by Diego Guidi
Post by Gis Newbye
Post by Phil Scadden
however.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Phil Scadden
2013-10-16 19:48:20 UTC
Permalink
Perhaps making this public would help. My understanding is that WFS was
working but returning too many features? Or am I getting confused with
another person? However, if you are not seeing POST requests to WFS in
the NET console, then this could be a proxy problem. You must have a
working proxy to use any ajax-type functionality otherwise the browser
security blocks the requests. GETs for fetch the map image dont need a
proxy.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
Gis Newbye
2013-10-17 05:17:07 UTC
Permalink
WFS in browser always work but i'm tryng to use it in many ol examples and
never works :)

http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html<http://192.168.1.95/openlayers/examples/wfsrepeated.html>
i've the municipality repeated 19 times

while here:
http://gisnewbye.hopto.org/openlayers/examples/wfs-states.html
i cannot see my Wfs!

Thanks always for your help
Post by Phil Scadden
Perhaps making this public would help. My understanding is that WFS was
working but returning too many features? Or am I getting confused with
another person? However, if you are not seeing POST requests to WFS in the
NET console, then this could be a proxy problem. You must have a working
proxy to use any ajax-type functionality otherwise the browser security
blocks the requests. GETs for fetch the map image dont need a proxy.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
______________________________**_________________
Users mailing list
http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
Diego Guidi
2013-10-17 07:01:02 UTC
Permalink
both of pages doesn't load in my browser.

Diego Guidi
Post by Gis Newbye
WFS in browser always work but i'm tryng to use it in many ol examples and
never works :)
http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html
i've the municipality repeated 19 times
http://gisnewbye.hopto.org/openlayers/examples/wfs-states.html
i cannot see my Wfs!
Thanks always for your help
Post by Phil Scadden
Perhaps making this public would help. My understanding is that WFS was
working but returning too many features? Or am I getting confused with
another person? However, if you are not seeing POST requests to WFS in the
NET console, then this could be a proxy problem. You must have a working
proxy to use any ajax-type functionality otherwise the browser security
blocks the requests. GETs for fetch the map image dont need a proxy.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Diego Guidi
2013-10-17 07:03:33 UTC
Permalink
Post by Gis Newbye
http://gisnewbye.hopto.org/openlayers/examples/wfs-states.html
http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html
ok sorry, both works now

Diego Guidi
Post by Gis Newbye
both of pages doesn't load in my browser.
Diego Guidi
Post by Gis Newbye
WFS in browser always work but i'm tryng to use it in many ol examples and
never works :)
http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html
i've the municipality repeated 19 times
http://gisnewbye.hopto.org/openlayers/examples/wfs-states.html
i cannot see my Wfs!
Thanks always for your help
Post by Phil Scadden
Perhaps making this public would help. My understanding is that WFS was
working but returning too many features? Or am I getting confused with
another person? However, if you are not seeing POST requests to WFS in the
NET console, then this could be a proxy problem. You must have a working
proxy to use any ajax-type functionality otherwise the browser security
blocks the requests. GETs for fetch the map image dont need a proxy.
Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Diego Guidi
2013-10-17 07:07:47 UTC
Permalink
Post by Gis Newbye
http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html
sorry bou your WMS is "broken" I see a map repeated multiple times.
this is a problem related to Mapserver, nothing related to OL usage.
My2Cents.


Diego Guidi
Ian Turton
2013-10-17 07:42:39 UTC
Permalink
Definitely a mis configured WMS -
http://gisnewbye.hopto.org/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=ALL&MODE=MAP&service=wms&request=getcapabilities&version=1.1.0
should
return XML not an image. (in fact all requests seem to return this image
hence the repetition).

Ian
Post by Diego Guidi
Post by Gis Newbye
http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html
sorry bou your WMS is "broken" I see a map repeated multiple times.
this is a problem related to Mapserver, nothing related to OL usage.
My2Cents.
Diego Guidi
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Ian Turton
Diego Guidi
2013-10-17 07:49:59 UTC
Permalink
@Gis Newbie: Try configuring mapserver with data and config from
ms-ogc-workshop: http://mapserver.github.io/ms-ogc-workshop
So you can be sure that server-side is right, and see how is the
problem in your mapserver config.

Diego Guidi
Post by Ian Turton
Definitely a mis configured WMS -
http://gisnewbye.hopto.org/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=ALL&MODE=MAP&service=wms&request=getcapabilities&version=1.1.0
should return XML not an image. (in fact all requests seem to return this
image hence the repetition).
Ian
Post by Diego Guidi
Post by Gis Newbye
http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html
sorry bou your WMS is "broken" I see a map repeated multiple times.
this is a problem related to Mapserver, nothing related to OL usage.
My2Cents.
Diego Guidi
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Ian Turton
Bart van den Eijnden
2013-10-17 07:53:43 UTC
Permalink
He should leave out the &layers=all&mode=map part from the WMS url in OpenLayers, this is the MapServer CGI interface and will interfere with WMS.

Best regards,
Bart
Definitely a mis configured WMS - http://gisnewbye.hopto.org/cgi-bin/mapserv.exe?MAP=C:/myprojects/mun.map&LAYERS=ALL&MODE=MAP&service=wms&request=getcapabilities&version=1.1.0 should return XML not an image. (in fact all requests seem to return this image hence the repetition).
Ian
Post by Gis Newbye
http://gisnewbye.hopto.org/openlayers/examples/wfsrepeated.html
sorry bou your WMS is "broken" I see a map repeated multiple times.
this is a problem related to Mapserver, nothing related to OL usage.
My2Cents.
Diego Guidi
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Ian Turton
_______________________________________________
Users mailing list
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Continue reading on narkive:
Loading...