Skip to main content
Solved

Adding Geolocation using pythonSDK


Forum|alt.badge.img+4

Hi Team, I need to add feature of geolocation to asset using python SDK can you help me with getting the geometry format if i have latitude and longitude information available with me . 

I have added the geolocation the asset but the same is not reflected to cdf ui .

Best answer by Anita Hæhre

Hi @vidhi.c.jain I hope the above resolved. I’ll be closing this ticket for now as we’ve not heard back from you in a while. Feel free to open it again should you have any related questions. 

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

4 replies

  • Practitioner
  • 6 replies
  • April 3, 2023

Hi, you can reference this code to create an asset with geo_location

from cognite.client import CogniteClient
from cognite.client.data_classes import GeoLocation, Geometry
c = CogniteClient()
geometry = Geometry(type="LineString", coordinates=[[30, 10], [10, 30], [40, 40]])
asset = Asset(name="my_pump", geo_location=
GeoLocation(type="Feature", geometry=geometry)
)

you can take a look at different supported Geometry object at https://github.com/cognitedata/cognite-sdk-python/blob/c95086e952d9e63aa72e7c68911d32e92ecfbbca/cognite/client/data_classes/shared.py#L53

PS: I haven’t tested the code yet. But it should provide you an idea how to work with geo_location of Asset


Forum|alt.badge.img+4
  • Author
  • Committed
  • 13 replies
  • April 3, 2023

Hi @tuan.nguyen , thanks for the reply , i have already tried the same , the issue now is when i retrieve the asset using sdk i can see geolocation updated but when i go to see in CDF UI , i cannot see the same .


  • Practitioner
  • 6 replies
  • April 3, 2023

Hi @vidhi.c.jain , which CDF application/UI are you using?


Anita Hæhre
Seasoned Practitioner
Forum|alt.badge.img+1
  • Head of Academy and Community
  • 590 replies
  • Answer
  • April 13, 2023

Hi @vidhi.c.jain I hope the above resolved. I’ll be closing this ticket for now as we’ve not heard back from you in a while. Feel free to open it again should you have any related questions. 


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