Skip to main content

In the TNT application at Statnett we are seeking to collect line and point geospatial features through the FeatureAPI

We have a dataset that has been populated with data about powerlines and substations, and we want to query the client for all of the features in each of these seperately. As there is no list() method in the FeatureAPI, and the search method is limited to 1000 results, we try to do this using the searchStream() method. Our query looks like this:

client.geospatial.feature.searchStream('ACLineSegment', {
limit: 10000,
output: { jsonStreamFormat: 'NEW_LINE_DELIMITED' as const }
});

 

This seems to work fine for the ‘ACLineSegment’ features but when i replace it with ‘Substation’ the call returns an empty string. I’ve tested with the regular search() and this returns features so I would expect the searchStream method to find these as well. Even stranger is that i quickly tested this functionality before the weekend and it seemed to work fine for ‘Substation’ then. This is however before the line data was uploaded.

From where I sit the most likely explanation seems to be some hickup in JavaScript SDK. Any help solving this or alternate method for listing all features of a certain FeatureType would be much appreciated.

Hi Henrik,

It would be nice if you can provide the request Id from your response. We will look into the log to see what actually happens.

In the mean time, we also provide the list endpoint with paginated results. You can find more detail at https://docs.cognite.com/api/v1/#tag/Geospatial/operation/listFeatures. However, you need to write the query with plain JS because JS SDK does not support it yet.

 


Thanks Tuan,

x-request-id: 449ea2a4-e225-937d-83c2-bf91cca09d5d

I will check out the altenative you gave as well.


Hi Henrik, 

I found some internal error when streaming request related to closed connection. To eliminate the error from client side, can you check if it works with Python SDK? https://cognite-sdk-python.readthedocs-hosted.com/en/latest/cognite.html#stream-features

Please check here for the client instantiation https://cognite-sdk-python.readthedocs-hosted.com/en/latest/cognite.html#


It is the same with the Python SDK. ‘ACLineSegment’ feature works fine here as well but ‘Substation’ seems to return an empty generator:

 

 


We made some fixes on our end. Could you try again? @Henrik Svoren 

Edit: The deployment is not ready. I’ll ping again when it is.


Hi Henrik, the fix is ready. Please test it again.


Looks like it is working as expected now! Thank you for your help 😊


Hello @Henrik Svoren ,
Though this issue seems resolved now.

I’m hoping you would be able to use the newly added geospatial list() endpoint to JS SDK version 7.11.0.

Please do let us know if you run into any issues using that.

Thanks & Regards,
Saagar Takhi.


Reply