I am trying to put a WFS layer on top of a openlayer's template I found in openlayers examples. This is the link for the untouched version. And this is the pen I am working on. I am actually only changing the url defined in function extent and the center of coordinates to be zoomed. I think I do something wrong with getfeature link formation. Or maybe something about the coordinate systems.

<!DOCTYPE html>
<div id="map" class="map"></div>

var vectorSource = new ol.source.Vector({
  format: new ol.format.GeoJSON(),
  url: function(extent) {
    return '' +
        'version=1.0.0&request=GetFeature&typeName=county:taxlots&' +
        'outputFormat=application%2Fjson&srsname=EPSG:4326' +
        'bbox=' + extent.join(',') + ',EPSG:4326';
  strategy: ol.loadingstrategy.bbox

var vector = new ol.layer.Vector({
  source: vectorSource,
  style: new ol.style.Style({
    stroke: new ol.style.Stroke({
      color: 'rgba(0, 0, 255, 1.0)',
      width: 2

var raster = new ol.layer.Tile({
  source: new ol.source.OSM()

var map = new ol.Map({
  layers: [raster, vector],
  target: document.getElementById('map'),
  view: new ol.View({
    center: [-13679410,5217562],
    maxZoom: 21,
    zoom: 14

1 Answer 1


You seem to have switched your extent and GetFeature request to use lat/lon (EPSG:4326) while your map and centre are still in meters(?) probably using EPSG:3857. So your data is drawn just very small and on Null Island.

So either switch back to using metres throughout or transform your data to match the map or switch the map to match the data.

  • Thanks. I have changed the coordinate system accordinlgy. But still, I could not find a way to properly call the WFS layer.
    – Sam
    Jan 30, 2018 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.