How to add new attributes/fields to an existing FeatureServices?

3840
3
Jump to solution
07-17-2015 09:19 AM
DominikSchlarmann
Occasional Contributor

Hello all,

I'm working on the provided GeoEvent Processor Tutorials from ArcGIS Online and now I am at the step, where Field Enrichers and Field Calculators are introduced (Module 4, IntroductionToGeoEvent)

So...I've configured a Field Calculator-Processor, and made the necessary settings, which create a new Field based on the FieldCalc expression:

It creates a new GeoEvent Definition with the additional field "AltitudeInMeters". But now I would like to add the created field as a new attribute to an existing FeatureService. Is this somehow possible?

Would be nice to get some feedback

Cheerio,

Dominik

0 Kudos
1 Solution

Accepted Solutions
RJSunderman
Esri Regular Contributor

Hello Dominik -

You need to look at the schema of the feature class you have exposed through your published feature service.

The original feature class, loaded into ArcMap from the map packages included with the tutorial, has a specific set of fields. You can review the feature service's schema from its endpoint in the ArcGIS REST Services Directory.

For example: http//localhost:6080/arcgis/rest/services/.../Flights/FeatureServer/0

Fields:

  • objectid ( type: esriFieldTypeOID , alias: OBJECTID , editable: false , nullable: false )
  • flightnumber ( type: esriFieldTypeString , alias: FlightNumber , editable: true , nullable: true , length: 50 )
  • starttime ( type: esriFieldTypeDate , alias: StartTime , editable: true , nullable: true , length: 36 )
  • originairportcode ( type: esriFieldTypeString , alias: OriginAirportCode , editable: true , nullable: true , length: 50 )
  • destinationairportcode ( type: esriFieldTypeString , alias: DestinationAirportCode , editable: true , nullable: true , length: 50 )
  • aircrafttype ( type: esriFieldTypeString , alias: AircraftType , editable: true , nullable: true , length: 50 )
  • altitude ( type: esriFieldTypeInteger , alias: Altitude , editable: true , nullable: true )

When you configured your Field Calculator to calculate AltitudeInMeters, and had the processor add that as a new field to the GeoEvent being processed, that added a field (to the event) which does not exist in the feature service you originally published. You need to go back to ArcMap, add the new field to your original feature class, and then publish a new feature service ... or select to overwrite the existing feature service.

Does that make sense? You cannot use GeoEvent to alter a feature service's schema. You use GeoEvent to filter, process, and enrich event data. You must then map the processed event data to match the schema of a feature service so that you update features using data available in events you have processed.

Once you have published a feature service which has both an Altitude field and an AltitudeInMeters field then, in GeoEvent, you would import a GeoEvent Definition from the new feature service ... so that you can Field Map event data from the event definition created by the Field Calculator to the event definition imported from the newly published feature service.

Hope this information helps -

RJ

View solution in original post

3 Replies
giancarlorazzino
New Contributor

Hi Dominik,

I too have the same problem. until now, I was able to write in an existing field of FeatureService.

I'm going crazy

bye

0 Kudos
RJSunderman
Esri Regular Contributor

Hello Dominik -

You need to look at the schema of the feature class you have exposed through your published feature service.

The original feature class, loaded into ArcMap from the map packages included with the tutorial, has a specific set of fields. You can review the feature service's schema from its endpoint in the ArcGIS REST Services Directory.

For example: http//localhost:6080/arcgis/rest/services/.../Flights/FeatureServer/0

Fields:

  • objectid ( type: esriFieldTypeOID , alias: OBJECTID , editable: false , nullable: false )
  • flightnumber ( type: esriFieldTypeString , alias: FlightNumber , editable: true , nullable: true , length: 50 )
  • starttime ( type: esriFieldTypeDate , alias: StartTime , editable: true , nullable: true , length: 36 )
  • originairportcode ( type: esriFieldTypeString , alias: OriginAirportCode , editable: true , nullable: true , length: 50 )
  • destinationairportcode ( type: esriFieldTypeString , alias: DestinationAirportCode , editable: true , nullable: true , length: 50 )
  • aircrafttype ( type: esriFieldTypeString , alias: AircraftType , editable: true , nullable: true , length: 50 )
  • altitude ( type: esriFieldTypeInteger , alias: Altitude , editable: true , nullable: true )

When you configured your Field Calculator to calculate AltitudeInMeters, and had the processor add that as a new field to the GeoEvent being processed, that added a field (to the event) which does not exist in the feature service you originally published. You need to go back to ArcMap, add the new field to your original feature class, and then publish a new feature service ... or select to overwrite the existing feature service.

Does that make sense? You cannot use GeoEvent to alter a feature service's schema. You use GeoEvent to filter, process, and enrich event data. You must then map the processed event data to match the schema of a feature service so that you update features using data available in events you have processed.

Once you have published a feature service which has both an Altitude field and an AltitudeInMeters field then, in GeoEvent, you would import a GeoEvent Definition from the new feature service ... so that you can Field Map event data from the event definition created by the Field Calculator to the event definition imported from the newly published feature service.

Hope this information helps -

RJ

DominikSchlarmann
Occasional Contributor

Hi RJ,

Thanks for clarification.

So it's definitively a good idea to have a detailed overview about needed attributes/number of field right at the beginning