OpenLayers: WFS in Verbindung mit OSM
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/OpenLayers.js"></script>
<body onload="init()">OpenLayers: WFS in Verbindung mit OSM
<div id="map" class="smallmap"></div>
</body>
CSS
#map {
width: 400px;
height: 400px;
border: 1px solid #dddddd;
}
JavaScript
var map;
var layer,osm;
function init() {
map = new OpenLayers.Map('map',
{ maxExtent: new OpenLayers.Bounds(0,0,0,0)
});
osm = new OpenLayers.Layer.OSM();
layer = new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: "http://geospatial.ga:8080/geoserver/newdata/ows",
version: "1.0.0",
featureType: "missouri_building",
// layername: osm:ne_10m_populated_places
// prefix osm: not needed, as we declare the featureNS
featureNS: "http://geospatial.ga"
})
});
map.addLayers([osm, layer]);
map.setCenter(new OpenLayers.LonLat(12.5, 52.5).transform("EPSG:4326","EPSG:3857"), 7);
}