Skip to content

Problem with interpretation of parameters containing lists for WFS 2 GetFeature #7510

Open

Description

@ejn

Brief background from the OGC standards:

Currently, Mapserver cannot interpret the second form (list of individual queries (TypeA)(TypeB)). The first form (TypeA,TypeB) is accepted, but wrongly interpreted as a list of individual queries (i.e. the second form) and not as a single join query.

Test links:

  1. Join query (wrongly interpreted as two individual queries, returning all cities and all continents): https://demo.mapserver.org/cgi-bin/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=ms:cities,ms:continents
  2. Individual queries (throws an exception msWFSGetFeature(): WFS server error. TYPENAME 'cities)(ms:continents)' doesn't exist in this server.): https://demo.mapserver.org/cgi-bin/wfs?service=WFS&version=2.0.0&request=GetFeature&typenames=(ms:cities)(ms:continents)

I'm guessing that this is not covered by a CITE test, since - assuming my reading of the standards is correct - Mapserver seems to not correctly implement the standard at this point. (Bonus question: Are Join-queries even supported in Mapserver?)

A bit of code-digging shows that at the point where the TYPENAMES-Parameter is processed there is a note

TODO Need to handle type grouping, e.g. "(l1,l2),l3,l4"

/* __TODO__ Need to handle type grouping, e.g. "(l1,l2),l3,l4" */

On the other hand, parsing the FILTER-parameter does interpret the bracketed list:

paszFilter = FLTSplitFilters(pszFilter, &nFilters);

Changing the interpretation of the TYPENAMES could break some clients relying on the current (imho wrong) interpretation, but would seem the right thing to do.

Anyone any thoughts from a standards, developer or user perspective?

Activity

  1. bipashabg commented on Jun 2, 2026

    @bipashabg

    Hi, I've been looking into this issue and would like to work on a fix.
    From what I can tell:

    The (TypeA)(TypeB) form fails because the parentheses aren't stripped before the type name lookup
    The TypeA,TypeB form is incorrectly split into separate queries instead of being treated as a single join

    My plan is to fix the TYPENAMES parser at ~line 3501 to mirror how FLTSplitFilters already handles the FILTER parameter, and handle both forms correctly.
    Before I proceed I want to know, are join queries supported in MapServer? If not, I'm thinking the right behavior for TypeA,TypeB would be to return a proper OperationNotSupported exception rather than silently returning wrong data. Would be happy to know if maintainers have a different preference.

  2. ejn commented on Jun 2, 2026

    @ejn
    ContributorAuthor

    MapServer/src/mapwfs20.c

    Lines 717 to 725 in bd59d49

    xmlAddChild(psMainNode,
    msWFSConstraintDefaultValue(
    psNsOws, psNsOws, "ImplementsStandardJoins", "FALSE"));
    xmlAddChild(psMainNode,
    msWFSConstraintDefaultValue(psNsOws, psNsOws,
    "ImplementsSpatialJoins", "FALSE"));
    xmlAddChild(psMainNode,
    msWFSConstraintDefaultValue(
    psNsOws, psNsOws, "ImplementsTemporalJoins", "FALSE"));
    confirms that join queries are currently not supported - so I think that sending an OperationNotSupported exception for TYPENAMES=TypeA,TypeB (or indeed TYPENAMES=(TypeA)(TypeB,TypeC) etc.) should be appropriate.

  3. bipashabg commented on Jun 2, 2026

    @bipashabg

    Thank you for the information! I'd like to take a go at this if no one else is working on it, I would start with the (TypeA)(TypeB) parsing fix and add the OperationNotSupported response for join queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions