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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Need quick support on google map live tracking

vijay5
11-Garnet

Need quick support on google map live tracking

Dear Team,

 

My requirement is to show live tracking data on google maps in thingworx.

 

And I get continuous feed data from the device.

 

Need to show live tracking line of the vehicle on mashups.

 

Request you to provide support on this ASAP

 

Thanks, Regards,

Vijay

ACCEPTED SOLUTION

Accepted Solutions

Dear Team,

 

Thanks for your support on resolving the issue.

 

Thanks, Regards,

Vijay

View solution in original post

4 REPLIES 4

Hello,

 

For that you'll need the following:

 

  1. A value stream that will keep the history of the movement, e.g. "VehicleLocationValueStream"
  2. A thing template for your vehicle things, e.g. "VehicleThingTemplate". Depending on how you are receiving location data from your device, it will be either a GenericThing, or a RemoteThing (need more details).
    1. On that thing template you will need to define a property called "location" of type LOCATION. Make sure that this property is logged (there's a checkbox for it)
    2. You'll need to specify VehicleLocationValueStream as a value stream for this thing template
  3. A thing corresponding to your vehicle, e.g. "Vehicle-0001", somehow receiving data from your device and saving it in "location" property.
    1. Wait for some time to receive some data and test it by executing service "QueryLocationPropertyHistory" on that thing. Use "location" as propertyName parameter and leave the rest by default. You should get a list of location readings. If you don't get any results, then troubleshoot your device connectivity before going to point (4).
  4. A mashup to track vehicle location, e.g. "VehicleTrackingMashup". Depending on your UI requirements, you may want to add vehicle selection, etc. Here I'll describe only the most basic version for displaying position of a single Vehicle-0001:
    1. On this mashup you need to add a service "QueryLocationPropertyHistory" from thing "Vehicle-0001" to the DATA tab. Make sure that you select "Mashup Loaded?" checkbox when doing that.
    2. After you added it, when you select this service in the bottom-right corner you need to specify propertyName = "location", so that it queries your location (you've already tested it above, if not -- do it now)
    3. An Auto Refresh widget that you need to add to your mashup. Configure it to fire every 10 seconds (see RefreshInterval property), and bind it to that "QueryLocationPropertyHistory" service (drag-and-drop its Refresh event).
    4. A Google Maps widget
      1. Make sure that you installed the corresponding Extension from Marketplace
      2. Once you have it on your mashup, you need to bind "All Data" from "QueryLocationPropertyHistory" service to its "RouteData" property. Just drag "All Data" from the right part of the mashup builder and drop it on the Google Maps widget, then select RouteData as the target.
      3. While on the widget, you have to specify "RouteLocationField" by selecting "value" in the dropdown list.
      4. At this moment you should be able to save your mashup and view it. You should see the blue line connecting the locations that you've seen when you tested that QueryLocationPropertyHistory from Composer. This track will be refreshed every 10 seconds thanks to Auto Refresh widget that you configured earlier.

I hope I didn't forget anything, let me know whether it works or not.

 

Regards,
Constantine

Dear Constantine,

 

Thank you very much for your immediate support and its working but I am not able to show any(car) icon when route is progressing. How to show the icon?

 

Right now I am simulating route data by incrementing linearly. So my guess is since the data is incrementing linearly the line as shown in the picture is linear. And when integrating with the real feed we will see the wavy nature of the curve? Please correct me on this if I am wrong

 

Very greatful if you can provide support on this ASAP and please find the attached image.

 

Thanks, Regards,

Vijay

Hello Vijay,

 

  1. To see separate points, try to mutate your location components randomly every time you store it in the value stream, e.g. { latitude: lat * (1 + Math.random() * 0.01, longitude: lon * (1 + Math.random() * 0.01 }
  2. You can see the points, if you bind the result of QueryLocationPropertyHistory also to Data property of the Google Maps widget. If you only need to see the last location, then you'll need to call a separate service for that, which returns only one row in the INFOTABLE.

 

/ Constantine

Dear Team,

 

Thanks for your support on resolving the issue.

 

Thanks, Regards,

Vijay

Announcements


Top Tags