locked
IOT Central Device Location RRS feed

  • Question

  • I am trying to update a device property (location) via the c# API client. The updates are always successful and the provided value is visible in the read-only text field. However, I cannot view the location on the map located in the dashboard area. 

    What is the acceptable format when uploading the device location data? 

    I've tried providing the full address and geo coordinates (35°16′53″N, 114°43′34″W) but the map did not render after updating the property via the API. 

    When I copy the data from the device property into an application property, I was able to generate a map based on the application property field.

    Thanks in Advance!

    Monday, March 11, 2019 4:03 PM

Answers

  •  I was able to update the property by specifying the geo coordinates as below;

    TwinCollection reportedProperties = new TwinCollection();
    reportedProperties["Location"] = new { lon= 122, lat= 45 };

    Thanks

    • Marked as answer by lasajay Wednesday, March 13, 2019 8:10 AM
    Wednesday, March 13, 2019 8:09 AM

All replies

  • Hi have you come across this StackOverflow thread? It should help 
    Tuesday, March 12, 2019 2:04 AM
  • Hi,

    Yes I saw the thread but the recommended format { "lat": 122,  "lon": 45 } didn't work.

    It did update the device property value to { "lat": 122,  "lon": 45 } but this could not be resolved by the map. I also tried  { "latitude": 122,  "longitude": 45 }, 45, 122 and 122, 45 combinations.

    I assume it just updated the property with the text value rather than evaluating the geo coordinates.

    I also came across the following reported issue =>https://github.com/MicrosoftDocs/azure-docs/issues/23782
    I believe you commented on it on the 31st of Jan, the issue still remains open.

    Cheers

    Tuesday, March 12, 2019 2:19 AM
  • Wednesday, March 13, 2019 12:32 AM
  •  I was able to update the property by specifying the geo coordinates as below;

    TwinCollection reportedProperties = new TwinCollection();
    reportedProperties["Location"] = new { lon= 122, lat= 45 };

    Thanks

    • Marked as answer by lasajay Wednesday, March 13, 2019 8:10 AM
    Wednesday, March 13, 2019 8:09 AM