Skip to main content
Solved

Problem using js-sdk FeatureAPI searchStream method to list all features


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.

Best answer by tuan.nguyen

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

View original
Did this topic help you find an answer to your question?

8 replies

  • Practitioner
  • 6 replies
  • October 17, 2022

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.

 


  • Author
  • Committed
  • 3 replies
  • October 18, 2022

Thanks Tuan,

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

I will check out the altenative you gave as well.


  • Practitioner
  • 6 replies
  • October 18, 2022

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#


  • Author
  • Committed
  • 3 replies
  • October 19, 2022

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

 

 


  • Practitioner
  • 6 replies
  • October 20, 2022

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.


  • Practitioner
  • 6 replies
  • Answer
  • October 24, 2022

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


  • Author
  • Committed
  • 3 replies
  • October 24, 2022

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


Saagar  Takhi
Practitioner
  • Practitioner
  • 6 replies
  • November 3, 2022

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


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings