cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Unable to store location in a data table

sdinh
6-Contributor

Unable to store location in a data table

I have a data table with a field called location but I'm not able to store location value.  It seems like location is read-only field.  At run-time I uuse google GEO API and translate the address to geolocation.  Before a call AddDataTableEntry I placed a warning log and my location.longitude and location.latitude exist and have valid data; however, when I query my table it only shows location of 0.0,0.0,0.0,WGS84.  Why?

Here's step to reproduce
1) Create a DataShape with a field call location of type Location
2) Create a DataTable with DataShape from 1
3) Create a Thing with a service, say, called PopulateData
4) In service PopulateData put this code:
var location=new Object();
location.longitude=[get valid longitude from google and hard-code it here]
location.latitude=[get a valid latitude from google and hardcode it here]
location.units = 'WGS84';
5) Assign location to params
6) Invoke service AddDataTableEntry (params)
7) Retrieve you DataTable entries and the location always have the value of 0.0,0.0,0.0,WGS84

2 REPLIES 2
sdinh
6-Contributor
(To:sdinh)

I was able to store the hardcoded value of longitude=1.0 and latitude=1.0 but when I populate those data using the actual data coming back from google api the location always show 0.0,0.0,0.0,WGS84

abalousek
6-Contributor
(To:sdinh)

Sinh was able to pound thru the issue - turns out it was a type casting problem with the Google API return value that was resolved with a parseFloat function call...

Top Tags