Home > openlayers > How to add GeoServer wfs layer on OpenLayers?

How to add GeoServer wfs layer on OpenLayers?

March 4Hits:16
Advertisement

I can't seem to add a WFS layer like this. It works when i copy all this code locally but as soon as i change the values to point to my own layer within my own GeoServer

this is the response viewed in firebug:

Could not locate {http://www.mydomain.com/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=catalog:dataSAR}dataSAR in catalog

This is the relevant part of my javascript:

    var wfs = new OpenLayers.Layer.Vector("WFS", {         strategies: [new OpenLayers.Strategy.BBOX()],         protocol: new OpenLayers.Protocol.WFS({             url: "http://www.mydomain.com/geoserver/wfs",             featurePrefix:"catalog",             featureType: "dataSAR",             featureNS: "http://www.mydomain.com/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=catalog:dataSAR",             geometryName: "bounds"          }),         styleMap: new OpenLayers.StyleMap({             strokeWidth: 3,             strokeColor: "#333333"         })     })      map.addLayers([basemap, wfs]);     map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 

And this is what my DescribeFeature (featureNS) looks like:

  <?xml version="1.0" encoding="UTF-8" ?>  - <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:catalog="catalog" xmlns:cite="http://www.opengeospatial.net/cite" xmlns:cstars="cstars" xmlns:demo="demo" xmlns:geointcomp="geointcomp" xmlns:gml="http://www.opengis.net/gml" xmlns:gn="http://geonetwork-opensource.org" xmlns:osm="osm" xmlns:test="test" xmlns:topp="http://www.openplans.org/topp" elementFormDefault="qualified" targetNamespace="catalog">   <xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://www.mydomain.com:80/geoserver/schemas/gml/3.1.1/base/gml.xsd" />  - <xsd:complexType name="dataSARType"> - <xsd:complexContent> - <xsd:extension base="gml:AbstractFeatureType"> - <xsd:sequence>   <xsd:element maxOccurs="1" minOccurs="0" name="id" nillable="true" type="xsd:int" />    <xsd:element maxOccurs="1" minOccurs="0" name="type" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="name" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="altId" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="arcId" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="startDate" nillable="true" type="xsd:dateTime" />    <xsd:element maxOccurs="1" minOccurs="0" name="endDate" nillable="true" type="xsd:dateTime" />    <xsd:element maxOccurs="1" minOccurs="0" name="boundsText" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="acqLocation" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="bounds" nillable="true" type="gml:GeometryPropertyType" />    <xsd:element maxOccurs="1" minOccurs="0" name="arcLocation" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="procLocation" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="procVersion" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="procLevel" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="dataFormat" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="sensingMode" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="beamCount" nillable="true" type="xsd:int" />    <xsd:element maxOccurs="1" minOccurs="0" name="beamId" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="beamMnemonic" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="polarisationMode" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="polarisationChannels" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="antennaLookDirection" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="flightDir" nillable="true" type="xsd:string" />    <xsd:element maxOccurs="1" minOccurs="0" name="orbitNum" nillable="true" type="xsd:int" />    <xsd:element maxOccurs="1" minOccurs="0" name="incidenceAngleVariable" nillable="true" type="xsd:decimal" />    <xsd:element maxOccurs="1" minOccurs="0" name="minimumIncidenceAngle" nillable="true" type="xsd:decimal" />    <xsd:element maxOccurs="1" minOccurs="0" name="maximumIncidenceAngle" nillable="true" type="xsd:decimal" />    </xsd:sequence>   </xsd:extension>   </xsd:complexContent>   </xsd:complexType>   <xsd:element name="dataSAR" substitutionGroup="gml:_Feature" type="catalog:dataSARType" />    </xsd:schema> 

Answers

You need the actual URI/URL for your workspace. From your DescribeFeature Schema it looks like "catalog" which is weird. The other option is to go to the workspace menu in the UI and look there

How to add GeoServer wfs layer on OpenLayers?

Related Articles

  • How to add GeoServer wfs layer on OpenLayers?

    How to add GeoServer wfs layer on OpenLayers?March 4

    I can't seem to add a WFS layer like this. It works when i copy all this code locally but as soon as i change the values to point to my own layer within my own GeoServer this is the response viewed in firebug: Could not locate {http://www.mydomain.co

  • Problem with wfs layer in OpenLayers

    Problem with wfs layer in OpenLayers June 12

    I'm trying to add a wfs layer and it's not working. Here is full code: WebGis .legend { padding-left: 18px; } .x-tree-node-el { border-bottom: 1px solid #ddd; padding-bottom: 3px; } .x-tree-ec-icon { width: 3px; } .gx-tree-layer-icon { display: none;

  • Is it possible to access geoserver wfs layer from localhost:8080 in to web application? June 3

    I want to add a WFS layer. I am trying to get WFS layer from localhost:8080 geoserver. but I am getting eoserver DateLineWrap in Openlayers.js file... --------------Solutions------------- I guess you want to add WMS form Geoserver to your Openlayers

  • Display a WFS layer with OpenLayersFebruary 17

    Good Morning! I have some troubles displaying a WFS layer with OpenLayers and hope someone here can give me a hint. Before moving on, I precise that I have already checked other posts, like here and here but, for any reason, it hasn't solved my probl

  • 'Access-Control-Allow-Origin' error in defining wfs layer in OpenLayers 3

    'Access-Control-Allow-Origin' error in defining wfs layer in OpenLayers 3June 2

    I want to create a wfs layer in OpenLayers 3. I define it as follow: sourceVector = new ol.source.Vector({ loader: function(extent) { $.ajax('http://localhost:8080/geoserver/iran/wfs?service=WFS',{ type: 'GET', data: { service: 'WFS', version: '1.1.0

  • Add wfs layer to openlayers map

    Add wfs layer to openlayers mapOctober 28

    (UPDATE QUESTION) Hi guys. I have a problem with WFS request, mine is follow: var wfs = new OpenLayers.Layer.Vector("WFS",{ strategies: [new OpenLayers.Strategy.Fixed()], projection: new OpenLayers.Projection("EPSG:4326"), protocol: ne

  • geoserver manager tutorial add new WFS layer November 24

    GeoServer Manager is a library to interact with GeoServer 2.x. I want to use it. but I didn't find any appropriate documentation for it. Can anyone help me by some tutorial or example? here is a few examples : geo-solutions examples for geoserver man

  • Add external WFS layer to geoserver using REST APIAugust 25

    I am trying to add an external WFS as a datasource to my geoserver via REST API. I already added a new workspace and WFS datasource. Now I want to publish a layer from that WFS on geoserver. The same works for WMS, but seems to be a bit different and

  • Problem saving added point to GeoServer WFS-T via OpenLayers?

    Problem saving added point to GeoServer WFS-T via OpenLayers?August 20

    I want to add a point and then with WFS-T, save this to db. I work with Openlayers and GeoServer. saveStrategy = new OpenLayers.Strategy.Save(); wfs = new OpenLayers.Layer.Vector( "WFS Vectore", { strategies: [new OpenLayers.Strategy.BBOX(), sav

  • WFS Layer in OpenLayers queries server for data but doesn't display the dataJanuary 30

    I have added a WFS layer to a map and can see (using Fiddler) a request being made to the server for the layer data. The server uses GML as the data format and the data being returned is valid. However, OpenLayers does not display the data. Here is t

  • Displaying wfs layer in OpenLayers 3?

    Displaying wfs layer in OpenLayers 3?May 20

    I'm working with geoserver and openlayers 3, i have a hosted layer in geoserver that i want display using ol3 as a wfs layer. it doesn't show any errors, but i dont get the map. it works with wms, but not wfs. Please can anyone help me to fix that? T

  • Can I change the width of a line in a GeoServer WMS layer through OpenLayers?

    Can I change the width of a line in a GeoServer WMS layer through OpenLayers?May 22

    I have a layer in geoserver with an SLD style, which I display in a map web app using OpenLayers2. I want to know if there is a way to change part of the style (the width of the line geometry) through Openlayers? Is it possible to manipulate easily t

  • Geoserver WFS Layer in OL3 tilted and mirrored

    Geoserver WFS Layer in OL3 tilted and mirroredFebruary 11

    I am using Geoserver (2.4.2) to display a WFS-Layer in Ol3 (3.13.0). I successfully used this example from a fellow user to get things going. Here is my modified code. I am sorry for not providing a fiddle since my Geoserver ist not accessible from t

  • How to add Geoserver WFS to Leaflet JS ApplicationJanuary 12

    I have a PostGIS database and have successfully consumed a table into GeoServer and published a WFS. Are there REST endpoints available for these WFS' akin to ESRI's feature services? How are parameters to be constructed? --------------Solutions-----

  • How do you update the maxFeatures setting of a WFS layer in OpenLayersMay 7

    I have a WFS layer which a protocol in the definition. The protocol states that the maxFeatures returned should be 1 to avoid downloading a large amount of data. I can update the value for maxFeatures using layer.protocol.maxFeatures and this registe

  • Add Google Maps Layer to OpenLayers PageOctober 22

    <script src="openlayers.js"></script> <script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script> <script type="text/javascript"> .... var google = new OpenLayers.Layer.Google

  • How to add offset to layer in OpenLayers?May 2

    As the title suggests,I have GeoJSON vectors on OpenLayers map where user should add X/Y offset (i.e 5 meters north,5 meters east).I plan to add some control for it. Since vectors are drawn map with OpenLayers.Rule object,as I searched for some offse

  • Is there a big (if any) performance difference between Geoserver SQL Layer and OpenLayers geojson Layer?June 23

    I have a table with multiline geography items in SQL Server 2008 (Routes). I want to show them on OL Google Map but I'm having trouble creating SQL Data source in geoserver (something related to TCP/IP although its opened and enabled in SQL Config).

  • why the numZoomLevels is null when I use jsonp to add esri rest layer in OpenLayers? October 11

    I am use Openlayers to add ArcGIS tilecache layers using arcgiscache class or another way which is jsonp. I can show the map properly, but when I pan, zoom or drag the map, the tiles seem to jump around, it does not look any good. Can anybody give me

  • Placing GeoServer WMS layer within OpenLayers 3March 18

    I have the following basic OpenLayers 3 code that opens a OSM background mapping and this works fine: <!doctype html> <html> <head> <title>Hello PMS</title> <link rel="stylesheet" href="../assets/ol3/css/ol.

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.710 s.