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

Circular regions on maps

msutton
7-Bedrock

Circular regions on maps

Hi Everyone.

I have been using the google maps widget for displaying simple location data, markers and paths on the google maps widget. Next what i want to do is have an over lay to this that places circular regions over the location markers who's size is dependant on one of my properties. I'm not sure if this would be easiest to do using a region who's centre is defined by the location marker, radius from the property and then calculate the geofence ( i think this could work out quite time consuming) Or i use the Marker as my circle and instead of having the standard marker i have one who's size changes depending on the input property. I'm happy to use Open StreetMaps or google maps as i have seen an example in open street maps (not on thingworx) that coloured the path green to red based on CO2.

Any help or pointers would be much appreciated. Hoping that someone has already cracked something similar to this.

Thanks Matt

2 REPLIES 2
ankigupta
12-Amethyst
(To:msutton)

Hi Matthew Sutton​,

Are you looking for something like: Re: Animation In Thingworx?

It would be great if you can share any screenshot (if available) of your requirement

Thanks,

Ankit Gupta

Hi Ankit

Sorry i don't have any images. I just did some poking around and i found a useful document on creating a region and i think this is the way i want to go. https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS225480 In addition to this i will create the region using the create circular geofence code snippet. I have written this into a script but it does for some reason not show on the map even though it is using the same fundamental process as the manual region creation. see my code below. I have output the geofence infotable and it looks correct and works as it should. i have even taken these values and input them manually into the update data table entries service and this worked as well. Maybe you can spot a problem?

Thanks Matt

// location:LOCATION

var location = new Object();

location.latitude = 50.00;

location.longitude = -0.39;

location.elevation = 0;

location.units = "WGS84";

// createCircularGeoFence(location:LOCATION,radius:NUMBER,units:STRING,resolution:INTEGER):INFOTABLE

var geofence = createCircularGeoFence(location, 1, "km", 10);

var values = me.CreateValues();

values.LocationRegion = geofence; //INFOTABLE

values.ID = 1; //NUMBER [Primary Key]

var params = {

  sourceType: undefined /* STRING */,

  values: values /* INFOTABLE*/,

  location: undefined /* LOCATION */,

  source: undefined /* STRING */,

  tags: undefined /* TAGS */

};

me.AddOrUpdateDataTableEntries(params);

Announcements


Top Tags