[Geoserver-users] feature ids

Hi list

As far as I understand, when responding to a WFS GetFeature request,
geoserver generates featureids using the following scheme: feature #1
gets "<layer>.1", feature #2 gets "<layer>.2", etc.

What I'd like is control the way featureids are generated. More
particularly, I'd like geoserver to derive featureids from a certain
layer attribute (e.g. the feature name).

With mapserver you can do exactly that by expliciting the featureid to
attribute association. Using this in your mapfile:

LAYER
  NAME foo
  METADATA
    "wfs_title" "foo"
    "gml_featureid" "ID" ## <-- FID TO ATTR ASSOCIATION
    "gml_include_items" "all"
  END
  ...

Can I configure geoserver to specify such as association?

Thanks a lot,

--
Eric

Hi Eric,

How feature id's are generated are actually dependent on the underlying
datasource. For instance, in a shapefile the feature id is generated by
the "row number", in a relational database the primary key is used ( if
one exists). If all else fails GeoServer will generate its own on the fly.

Unfortunately what attribute is the feature id is not as configurable as
it is in mapserver, ie you can just mark an attribute as the id. You
said you were using postgis yesterday, correct? What I suggest is that
you try making your name column the primary key of your postgis table.

-Justin

Eric Lemoine wrote:

Hi list

As far as I understand, when responding to a WFS GetFeature request,
geoserver generates featureids using the following scheme: feature #1
gets "<layer>.1", feature #2 gets "<layer>.2", etc.

What I'd like is control the way featureids are generated. More
particularly, I'd like geoserver to derive featureids from a certain
layer attribute (e.g. the feature name).

With mapserver you can do exactly that by expliciting the featureid to
attribute association. Using this in your mapfile:

LAYER
  NAME foo
  METADATA
    "wfs_title" "foo"
    "gml_featureid" "ID" ## <-- FID TO ATTR ASSOCIATION
    "gml_include_items" "all"
  END
  ...

Can I configure geoserver to specify such as association?

Thanks a lot,

--
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

On 2/28/07, Justin Deoliveira <jdeolive@anonymised.com> wrote:

Hi Eric,

How feature id's are generated are actually dependent on the underlying
datasource. For instance, in a shapefile the feature id is generated by
the "row number", in a relational database the primary key is used ( if
one exists). If all else fails GeoServer will generate its own on the fly.

Unfortunately what attribute is the feature id is not as configurable as
it is in mapserver, ie you can just mark an attribute as the id. You
said you were using postgis yesterday, correct? What I suggest is that
you try making your name column the primary key of your postgis table.

Thanks a lot Justin, that's good news! Yes I'm using postgis. So I'm
going to try using the primary key.

--
Eric

Yeah, it's a tough trade-off, since if you let users specify any attribute they want they may not pick one that is actually unique. The spec insists that featureids are actually unique. From what I can tell mapserver doesn't support the featureid filter, which means it doesn't so much matter what they let people put there.

So we try to only use unique columns and values, that the data type guarantees will be unique. I'd like to allow a bit more configuration options, but it's quite a bit of work, and I think we cover the majority of use cases.

Chris

Justin Deoliveira wrote:

Hi Eric,

How feature id's are generated are actually dependent on the underlying
datasource. For instance, in a shapefile the feature id is generated by
the "row number", in a relational database the primary key is used ( if
one exists). If all else fails GeoServer will generate its own on the fly.

Unfortunately what attribute is the feature id is not as configurable as
it is in mapserver, ie you can just mark an attribute as the id. You
said you were using postgis yesterday, correct? What I suggest is that
you try making your name column the primary key of your postgis table.

-Justin

Eric Lemoine wrote:

Hi list

As far as I understand, when responding to a WFS GetFeature request,
geoserver generates featureids using the following scheme: feature #1
gets "<layer>.1", feature #2 gets "<layer>.2", etc.

What I'd like is control the way featureids are generated. More
particularly, I'd like geoserver to derive featureids from a certain
layer attribute (e.g. the feature name).

With mapserver you can do exactly that by expliciting the featureid to
attribute association. Using this in your mapfile:

LAYER
  NAME foo
  METADATA
    "wfs_title" "foo"
    "gml_featureid" "ID" ## <-- FID TO ATTR ASSOCIATION
    "gml_include_items" "all"
  END
  ...

Can I configure geoserver to specify such as association?

Thanks a lot,

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org

On 2/28/07, Chris Holmes <cholmes@anonymised.com> wrote:

Yeah, it's a tough trade-off, since if you let users specify any
attribute they want they may not pick one that is actually unique. The
spec insists that featureids are actually unique. From what I can tell
mapserver doesn't support the featureid filter, which means it doesn't
so much matter what they let people put there.

Yes, AFAIK mapserver doesn't support filtering on featureid. That's
the reason I've actually switched to geoserver. I hated writing
mapfile's anyway :wink:

So we try to only use unique columns and values, that the data type
guarantees will be unique. I'd like to allow a bit more configuration
options, but it's quite a bit of work, and I think we cover the majority
of use cases.

Sounds reasonable to me too.

Thanks,

--
Eric