Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9258153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:19:25+00:00 2026-06-18T12:19:25+00:00

I have added a WFS layer to a map and can see (using Fiddler)

  • 0

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 the code that I use.

$(document).ready(
        function () {
            // allow testing of specific renderers via "?renderer=Canvas", etc
            var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
            renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
            var geographic = new OpenLayers.Projection("EPSG:4326");
            var mercator = new OpenLayers.Projection("EPSG:900913");

            map = new OpenLayers.Map({
                div: "map",
                layers: [
                    new OpenLayers.Layer.WMS("OpenLayers WMS",
                        "http://vmap0.tiles.osgeo.org/wms/vmap0",
                        { layers: "basic" }
                    ),
                    new OpenLayers.Layer.Vector("GML", {
                        strategies: [new OpenLayers.Strategy.Fixed()],
                        protocol: new OpenLayers.Protocol.WFS({
                                url: "http://localhost/MapServer/Default.aspx",
                                featureType: "Layer_ACTIVE",
                                featureNS: "http://www.tstgis.org/gml",
                                version: "1.1.0",
                                geometryName: "line"
                            }),
                            renderers: renderer
                        })
                ],
                zoom: 15
            });

            var bb = new OpenLayers.Bounds(-179.821327209473, 12.1057098342161, -56.5289154052734, 78.1442901657839);
            map.zoomToExtent(bb);
});

This test script is part of an HTML shell that is running under localhost/mapserver, so it rules out the familiar cross-domain issue.

What is going on? Note: the returned data set is pretty big (1.5 MB) and I wonder if that has anything to do with the missing display.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:19:26+00:00Added an answer on June 18, 2026 at 12:19 pm

    I had no doubt that this was a configuration issue with OpenLayers. From what I knew about OpenLayers, I had it configured properly. Turns out, it is essential, in my case, to set the featurePrefix option. The reason for this is that the namespace and prefix in the XML response (GML) for each FeatureMember Node is used to identify the appropriate reader for the response. By default, the featurePrefix is set to ‘feature’. If the response’s namespace + prefix does not match the configuration in OpenLayers, the features are not added to the layer and hence not displayed. In my case, the prefix is set to an empty string as the server does not add a prefix to the response.

    Also, setting the geometryName is critical. The default value for geometryName is ‘the_geom’ for WFS version 1.0, and null for higher versions. The geometryName is used by the server to actually locate the features. In my case, geometryName used on the server was “msGeometry”.

    Here is the working code.

    $(document).ready(
    function () {
        // allow testing of specific renderers via "?renderer=Canvas", etc
        var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
        renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
        var geographic = new OpenLayers.Projection("EPSG:4326");
        var mercator = new OpenLayers.Projection("EPSG:900913");
    
        map = new OpenLayers.Map({
            div: "map",
            layers: [
                new OpenLayers.Layer.WMS("OpenLayers WMS",
                    "http://vmap0.tiles.osgeo.org/wms/vmap0",
                    { layers: "basic" }
                ),
                new OpenLayers.Layer.Vector("GML", {
                    strategies: [new OpenLayers.Strategy.Fixed()],
                    protocol: new OpenLayers.Protocol.WFS({
                            url: "http://localhost/MapServer/Default.aspx",
                            featureType: "Data_ACTIVE",
                            version: "1.1.0",
                            geometryName: "msGeometry",
                            featurePrefix: ""
                        }),
                        renderers: renderer
                    })
            ],
            zoom: 15
        });
    
        var bb = new OpenLayers.Bounds(-179.821327209473, 12.1057098342161, -56.5289154052734, 78.1442901657839);
        map.zoomToExtent(bb);
    

    });

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added successfully data to server and get json back so that I
I have added an extra field Specification in Catalog->Product->Data tab. This text is stored
I have added the sdk files like dropbox website says, but I can't figure
I have added class to to my image using jquery in jquery $('.myimage img').addClass('img_opacity').css({position:absolute,z-index:999,opacity:0})
I have added some EditTexts using a loop, textFieldsLayout = (LinearLayout) findViewById(R.id.LinearLayout2); for(int i=1;
I have added and mediaplayer control to my c# application, and I can make
i have added a pickerview from interface builder.i am using this method to show
I have added a UIWebView along with some labels inside UIScrollView (using StoryBoards )
I have added a category to my Xcode project using File > New >
I have added a cache layer to my project . now I wonder if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.