Difference between revisions of "TruxtonSensitiveSiteList"

From truxwiki.com
Jump to navigation Jump to search
Line 18: Line 18:
 
This adds a location to the current list.
 
This adds a location to the current list.
 
It will add a record to the <code>[SensitiveSite]</code> table.
 
It will add a record to the <code>[SensitiveSite]</code> table.
 +
The [https://en.wikipedia.org/wiki/Latitude latitude] and [https://en.wikipedia.org/wiki/Longitude longitude] coordinates should use the [https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84 WGS84] ellipsoid.
 +
The <code>optional_id</code>, when present, will be the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the record and corresponds to the <code>[ID]</code> column of the <code>[SensitiveSite]</code> table.
  
 
==<code>delete()</code>==
 
==<code>delete()</code>==

Revision as of 06:32, 3 June 2021

This class lets you add list of geographic coordinates that should be alerted on. This will populate the [SensitiveSiteList] table in the database.

Attributes and Methods

description

A description of the list. This corresponds to the [Description] column of the [SensitiveSiteList] table.

id

This is the GUID of the list. This corresponds to the [ID] column of the [SensitiveSiteList] table.

name

The name of the list. This corresponds to the [Name] column of the [SensitiveSiteList] table.

add(wgs84_latitude, wgs84_longitude, distance_in_meters, name, optional_id)

This adds a location to the current list. It will add a record to the [SensitiveSite] table. The latitude and longitude coordinates should use the WGS84 ellipsoid. The optional_id, when present, will be the GUID of the record and corresponds to the [ID] column of the [SensitiveSite] table.

delete()

Deletes the list from Truxton. It will remove records from the [SensitiveSite] and [SensitiveSiteList] table.

remove(wgs84_latitude, wgs84_longitude, distance_in_meters, name)

This removes an item from the list.

save()

This will commit the information to the [SensitiveSiteList] table. It will return True if the record was saved to the database, False if there was an error.

Sample

 1 import sys
 2 sys.path.append('C:/Program Files/Truxton/SDK')
 3 import truxton
 4 
 5 def main():
 6  t = truxton.create()
 7  ssl = t.newsensitivesitelist()
 8  ssl.id = "43434343-4443-4343-4343-434343434343"
 9  ssl.name = "Test SSV"
10  ssl.description = "The description of the test SSV"
11  ssl.save()
12 
13  ssl.add(39.136001, -77.701114, 100, "Lothar's")
14  ssl.add(39.137793, -77.692892, 100, "Chik", "A30BE334-56B3-42FD-8860-92F74D47C9CC")
15 
16  ssl.remove(39.136001, -77.701114, 100, "Lothar's")
17  ssl.delete()
18 
19 if __name__ == "__main__":
20     main()