> I am accessing them via GeoTools so I want a GeoTools based solution.

This is what I do initially to try and identify the "primary key"

String key = "[fixme]";
List<AttributeDescriptor> adl = schema.getAttributeDescriptors();
for (AttributeDescriptor attribute : adl) {
    if ( attribute.getType().isIdentified()
         ||
         attribute.getLocalName().equalsIgnoreCase("OBJECTID")) {
          key = attribute.getLocalName();
          break;
     }
}


On 13 Mar 2024, 09:03, at 09:03, SPDBA <si...@spdba.com.au> wrote:
>Mark,
>
>They are not WFS, they are ESRI ArcGIS Feature Services.
>
>I am accessing them via GeoTools so I want a GeoTools based solution.
>
>Simon
>
>⁣39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia
>(P) 03 62 396 397
>(M) 0418 396 381
>(W) www.spdba.com.au​
>
>On 13 Mar 2024, 04:05, at 04:05, Mark Prins <mc.pr...@gmail.com> wrote:
>>On 09-03-2024 03:20, SPDBA wrote:
>>> GeoTools people.
>>> I've a simple question.
>>> I'm connecting to an ArcGIS feature web service.
>>> What I want to discover is which field in the published attributes
>is
>>
>>> the primary key. The sites I am looking at can have OBJECTID fields
>>of
>>> type esriFieldTypeOID, but often the name is otherwise: rid, gid,
>>fid,
>>> oid etc etc. The common thing is that one field is of type
>>> esriFieldTypeOID.
>>> Looking at the source with GeoTools the data type is returned as
>>> java.lang.Integer (AttributeDescriptor) which is fair enough in one
>>> sense but not useful to distinguish a field from all other integer.
>>So,
>>> is there a way of discovering what field is of type
>>> esriFieldTypeOID?
>>
>>it's unclear to me if you are talking about the esri native rest
>>service
>>interface aka "FeatureServer" or the OGC standard WFS interface of
>AGS.
>>The REST interface provides the esri types as metadata of a layer[0];
>>the WFS is limited to the types specified in the GML standard.
>>Some WFS services use the primary key value to produce the gml:id
>>attribute of a feature, this is exposed in GeoTools as the fid afaik
>>
>>[0]
>>https://sampleserver6.arcgisonline.com/arcgis/rest/services/CommercialDamageAssessment/FeatureServer/0
>>
>>
>>or as json
>>https://sampleserver6.arcgisonline.com/arcgis/rest/services/CommercialDamageAssessment/FeatureServer/0?f=pjson
>>
>>
>>
>>_______________________________________________
>>GeoTools-GT2-Users mailing list
>>GeoTools-GT2-Users@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>------------------------------------------------------------------------
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>GeoTools-GT2-Users mailing list
>GeoTools-GT2-Users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to