Create a feature class in Spatiotemporal Data Store

2957
9
01-03-2019 04:23 PM
JerryStafurik
New Contributor II

I have a feature class in a file geodatabase, that I would like to use as a template to create a new feature class in a Spatiotemporal data store and publish a feature service in Portal using this feature class.

If I use the 'Copy to Data Store' tool from GeoAnalytics Tools, this fails as the feature class is empty.  If I create a 'dummy' record, it will create a new feature class in the data store, but creates new system fields (OBJECTID1, shapeLenght1, etc.), while keeping the existing system fields (OBJECTID, shapeLength).  These fields also get published in the feature service, which is very confusing for end users, and not best practice in terms of data duplication, etc.  I cannot change the structure of the feature class either, to remove the fields.

If I share a layer from ArcGIS Pro, I don't get a choice to publish to the Spatiotemporal data store.

How can I create a new empty and clean (without field duplication) feature class in the Spatiotemporal data store, which I can use to publish a feature service from in Portal using ArcGIS Pro or ArcPy?

0 Kudos
9 Replies
SarahAmbrose
Esri Contributor

Hi Jerry Stafurik‌,

I have two ideas about how you can do this. One though GeoAnalytics, and one without GeoAnalytics.

  1. Through GeoAnalytics. Create a text file with the field names you are interested in, and one dummy row. For example, I created one that looked like this:
    Field1,Field2,Field3
    1,10.6,Hello
    I then registered it as a big data file share, and used that as the input to Copy to Data Store. It created a layer with the following fields:
    Field1, Field2, Field3, globalid, OBJECTID
  2. The other way to do this, is to create a layer using the portal sharing API. You can use this endpoint to create a service: Create Service—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers . To specify that you want to save it to spatiotemporal add the following:
    "options":{"dataSourceType":"spatiotemporal"}


    So your JSON might look something like this (sorry about the formatting - I recommend copying it in to a JSON viewer 😞

{                "currentVersion": 10.6,                "serviceDescription": "",                "hasVersionedData": false,                "supportsDisconnectedEditing": false,                "hasStaticData": true,                "maxRecordCount": 2000,                "supportedQueryFormats": "JSON",                "capabilities": "Query",                "description": "",                "copyrightText": "",                "allowGeometryUpdates": false,                "syncEnabled": false,                "editorTrackingInfo": {                                "enableEditorTracking": false,                                "enableOwnershipAccessControl": false,                                "allowOthersToUpdate": true,                                "allowOthersToDelete": true                },                "xssPreventionInfo": {                                "xssPreventionEnabled": true,                                "xssPreventionRule": "InputOnly",                                "xssInputRule": "rejectInvalid"                },                "tables": [],                "name": "mylayer",                "options":{"dataSourceType":"spatiotemporal"}  }

         And then you can populate the values using the add to definition endpoint of the service. https:/<url>/<hosted server WA>/rest/admin/services/Hosted/mylayer/FeatureServer/addToDefinition . Make sure /admin/ is included in your URL, otherwise you won't see the addDefinition option. 

Additionally, the following table outlines some of the differences between spatiotemporal and relational. At 10.6.1, you are not able to delete columns from a layer hosted in the spatiotemporal big data store. 

Please let me know if you have any follow up questions. 

Sarah Ambrose

Product Engineer, GeoAnalytics Team

JerryStafurik
New Contributor II

Hi Sarah,

Thanks for your response.  Using the sample 'Create Service' JSON for the REST API interface, will create a feature service without a table in the data store.  How can I specify the table/feature class to be created, including the field definitions?

Thanks,

   Jerry

0 Kudos
SarahAmbrose
Esri Contributor

Hi Jerry Stafurik,

You can use the REST call addToDefinition on the feature service. The documentation for that call is outlined here: Add to Definition (Feature Service)—ArcGIS REST API: Services Directory | ArcGIS for Developers 

You will access it by going to the following URL of the FS you created, https:/<url>/<hosted server WA>/rest/admin/services/Hosted/mylayer/FeatureServer/addToDefinition, and modify the JSON to outline the feature service you are interested in creating. 

- Sarah

0 Kudos
LeonAus
New Contributor III

Hi Sarah,

When I try and use the addToDefinition call on my 10.6.1 portal feature service (using the admin page or a python script) I get this response:

{  "error": {   "code": 403,   "subcode": 2,   "message": "Access to admin resources are not allowed, Signed Request needed for 'AddToDefinition' with table",   "details": []  } }

How do I get past this problem? I have successfully signed into the admin page so I don't think it's a permission issue.

(I am not the only person getting this problem - https://community.esri.com/thread/244629-portal-1071-throws-error-with-addtodefinition-endpoint-in-r... )

Thanks,

Leon.

0 Kudos
GauravMaske1
Esri Contributor

Hi Leon / Jerry,

Please try the answer provided in the this following thread and let me know if works for you  - Portal 10.7.1 throws error with AddToDefinition endpoint in REST API.

0 Kudos
AmarG1
by
New Contributor II

Hi Sarah,

When I do AddToDefinition on feature service created in STBDS with "supportsLod":true in "advancedQueryCapabilities", the created feature layer has the setting to false. What is the correct way to set Lod?

Following is a portion of my AddToDefinition:

{
    "layers": [
          {
              "allowGeometryUpdates": false,
               "capabilities": "Create,Editing,Uploads,Query,Update,Delete,Extract",

                ...

              "advancedQueryCapabilities":{

                       ...

                      "supportsLod":true,

                        ...

              },

             "lodInfos": [...],

             ...

     ]

}

--Thanks

0 Kudos
GillPaterson
New Contributor III

Hi,

Is the portal sharing API Create Service still the best option for creating a feature service with a spatiotemporal datasource in 10.8? 

Thanks,

Gill

0 Kudos
GauravMaske1
Esri Contributor

Yes. It is still the only option to create feature service with a spatiotemporal data source without using GeoAnalytics or GeoEvent Server.

GillPaterson
New Contributor III

Thank you!

0 Kudos