Select to view content in your preferred language

Custom data feeds samples and documentation

4070
27
04-29-2023 09:06 AM
MarcBateEA
New Contributor III

I downloaded the Enterprise SDK v11.1 and only found the command line utility for creating the custom data feeds nodejs project, however, the documentation seems to be from an older version maybe even 10.9.1, and no documentation on custom data feeds, and no samples.

Where are the samples? I don't see them on github either, and the online documentation for the SDK doesn't have anything on custom data feeds either.

 

Tags (2)
0 Kudos
27 Replies
AndrewAdamson22
New Contributor

Running into the same.  Were you able to register?

0 Kudos
EliasRex
New Contributor III

I was. I made the mistake of installing node packages at the top level of the project. Once I installed the packages at the provider level, I managed to register it with the server. 

0 Kudos
MarcBateEA
New Contributor III

Just an update - it turns out the ArcGIS Server Custom Data Feed runtime is just NodeJS app running on the ArcGIS Server, and the CDF feature class does not behave just like any other feature service. There are performance issues, esp with the filter widgets in WAB and ExB, and there's a caching bug in 11.1 that will cache it forever if you set any ttl value.

0 Kudos
MarcBateEA
New Contributor III

I saw you can override the key the cache uses which is helpful because we don't have a ::layer on our service, i.e. it will always be 0 and was causing the plugin source to be called again sometimes.

Model.prototype.createKey = function(req) {
let key = req.url.split('/')[1]
if (req.params.host) key = [key, req.params.host].join('::')
if (req.params.id) key = [key, req.params.id].join('::')
return key
}

How can I also have my provider optionally return a table instead of a feature service that can be added to Field Maps for example as a lookup table for a drop down, or am I pushing it here?

 

MarcBateEA
New Contributor III

I found that if you just exclude the geography from the geojson it returns a table. 

it seems like you would create a relationship class to do what I was asking in field maps between a feature class and the table created by cdf. However at least in my local host environment the table can’t be used in the go tool. It just has an x by it nothing else

0 Kudos
nicogis
MVP Frequent Contributor

Here there is the documentation & samples: - Overview ArcGIS Server Custom Data Feeds

0 Kudos
EliasRex
New Contributor III

Have you found any information or samples that include caching?

0 Kudos
nicogis
MVP Frequent Contributor

I have seen in create service property set 'true' but I don't know if it is managed this property with CDF 

"properties": {
        "disableCaching": "true"
    },

 

0 Kudos
MarcBateEA
New Contributor III

I had to figure it out myself. I allowed a url parameter to be passed called expiresDays so I can use different caching for different projects. I also have a default expiresDays in my config file

let expiresDays = req.query.expiresDays || config.expiresDays
let expires = null
if (expiresDays && expiresDays !== 0) {
expires = new Date().setDate(new Date().getDate() + expiresDays)
}
// set the fields array where I used aliases, and the array of features, then set ttl
const geoJson = {
metadata: {
idField: "OBJECTID",
fields: fields,
displayField: Object.keys(allFeatures[0].properties)[0]
},
type: "FeatureCollection",
features: allFeatures,
ttl: expires
}
By default it was caching the FeatureServer and the FeatureServer/0 as different things so it was calling my API twice. Since there's only one "layer" in the CDF I removed the part of the key with the layer in it.  I was able to override the key it uses for caching in the model.js file to fix that:

Model.prototype.createKey = function (req) {
let key = req.url.split("/")[1]
if (req.params.host) key = [key, req.params.host].join("::")
if (req.params.id) key = [key, req.params.id].join("::")
//if (req.params.layer) key = [key, req.params.layer].join('::')

return key
}
 
Tags (3)
0 Kudos
EliasRex
New Contributor III

How do you get access to the key once another request is made?

0 Kudos