<script
src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js">
</script>
<script type="text/javascript">
function init() {
var map = new OpenLayers.Map ("map", {
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoom()
]
} );
var openstreetmap = new OpenLayers.Layer.OSM();
var style = new OpenLayers.Style();
var rule= new OpenLayers.Rule({
filter: new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "district",
value: "1",
}),
symbolizer: {
fillColor: "#FF7144",
fillOpacity: 0.6,
strokeColor: "#FF0000",
strokeWidth: 2,
strokeDashstyle: "solid",
label: " ${district}",
labelAlign: "cc",
fontColor: "#000000",
fontOpacity: 1,
fontFamily: "Arial",
fontSize: 16,
fontWeight: "600"}
});
style.addRules([rule]);
var wfs_layer = new OpenLayers.Layer.Vector("fsa", {
strategies: [new OpenLayers.Strategy.BBOX()],
styleMap: style,
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
url: "http://localhost:8080/geoserver/wfs",
featurePrefix: "india",
featureNS : "http://opengeo.org/india",
featureType: "india",
})
});
map.addLayers([openstreetmap,wfs_layer]);
var WGS84 = new OpenLayers.Projection("EPSG:4326");
var mapextent = new OpenLayers.Bounds(-123.294, 49.296, -122.953, 49.411).transform(WGS84, map.getProjectionObject());
map.zoomToExtent(mapextent);
}
</script>
This code is working fine in geoserver, but when I tried this code in wampserver(PHP), only WMS layer was displayed. I have gone through many tutorials and stack overflow queries related to adding WFS layer in OpenLayers, but nothing working in my case...I have also tried proxy.cgi scripts to allow proxy call to geoserver, but it does not work. Can CGI proxy script be used only with Python or can it be used with PHP as well?