Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hi All,
I am getting Lat and Long of a plant location from Database which are of VARCHAR . I am trying to convert them to Location datatype in Thingworx, but getting following error.
Unable To Convert From java.lang.String to LOCATION
Can someone help me on this ?
Hi,
Location is a little bit more complex base type. It is actualy a JSON with 4 Objects:
Like this:
{ "location": { "latitude": 0.1111, "longitude": 0.2222, "elevation": 0.3333, "units": "WGS84" } }
So iff you want to change its value in ThingWorx JS code you should create new Location property and assing value like it would be a JSON:
me.myLocationProperty = { "latitude": 50, "longitude": 50, "elevation": 50 }
You can now change 50, 50 & 50 hardcoded values to your paramaters from VARCHAR.
Best,
Adam
Thanks, Adam