{"id":21559807,"url":"https://github.com/dasiths/python_tak_datapackage_example","last_synced_at":"2025-10-20T02:37:41.443Z","repository":{"id":55204731,"uuid":"522784403","full_name":"dasiths/python_tak_datapackage_example","owner":"dasiths","description":"Approaches For Overlaying Images On TAK Client Map Using KML/KMZ And COT Data Packages","archived":false,"fork":false,"pushed_at":"2022-08-11T08:04:12.000Z","size":177,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T23:04:22.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dasiths.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-09T03:08:57.000Z","updated_at":"2024-08-26T18:51:18.000Z","dependencies_parsed_at":"2022-08-14T16:02:36.898Z","dependency_job_id":null,"html_url":"https://github.com/dasiths/python_tak_datapackage_example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dasiths/python_tak_datapackage_example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasiths%2Fpython_tak_datapackage_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasiths%2Fpython_tak_datapackage_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasiths%2Fpython_tak_datapackage_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasiths%2Fpython_tak_datapackage_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dasiths","download_url":"https://codeload.github.com/dasiths/python_tak_datapackage_example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dasiths%2Fpython_tak_datapackage_example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266205048,"owners_count":23892389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T09:09:31.106Z","updated_at":"2025-10-20T02:37:36.404Z","avatar_url":"https://github.com/dasiths.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Approaches For Overlaying Images On TAK Client Map Using KML/KMZ And COT Data Packages\r\n\r\nThis repo is an example on how to overlay images on a TAK (Team Awareness Kit) client like WinTak or ATAK.\r\n\r\n### Requirements\r\n\r\n- Python 3.5+\r\n- TAK Client. Tested with [WinTak v4.6](https://tak.gov/products).\r\n- TAK Server (Only required for Data Package relay). Tested with [FreeTak Server](https://github.com/FreeTAKTeam/FreeTakServer).\r\n- Install python dependencies\r\n  ```bash\r\n  pip install -r requirements.txt\r\n  ```\r\n\r\n## 1. KML/KMZ Overlay\r\n\r\nKML ([Keyhole Markup Language](https://en.wikipedia.org/wiki/Keyhole_Markup_Language)) is an XML notation for expressing geographic annotation and visualization within two-dimensional maps and three-dimensional Earth browsers.\r\n\r\nA [KMZ](https://developers.google.com/kml/documentation/kmzarchives) file consists of a main KML file and zero or more supporting files that are packaged using a Zip utility into one unit, called an archive.\r\n\r\nWinTak supports adding KML layers to the map can even automatically pull it from the http server and refresh it every X number of seconds.\r\n\r\nIn this example, we generate an image every second, create a KMZ file and host it via a simple http server running on port 8000.\r\n\r\n- Open a terminal to the root of the repo and start the KMZ generation script. It will create a new image overlay every second.\r\n  ```bash\r\n  python3 ./test_kmz.py\r\n  ```\r\n- Start the simple http server in `kmz-server-root `\r\n  ```bash\r\n  cd kmz-server-root \r\n  python3 -m http.server 8000\r\n  ```\r\n- Open WinTak. \r\n  - Go to `Menu` (Hamburger Menu)\r\n  - Import Manager\r\n  - KML Network Link\r\n  - Manage Network Links\r\n  - In the side panel that appears on the right, click the [+] button to add a new link.\r\n    - Enter the following details\r\n      - Name: `Example`\r\n      - URL: `http://localhost:8000/kmz/plt.kmz`\r\n      - Auto Refresh (Ticked)\r\n      - Interval: 1 second(s)\r\n    - Click `Add`\r\n  - You should now be able to see an image overlay at the `lat -72.953233112081065 long 41.636485101307905` (Around **Springfield, New York, USA**) coordinates that updates roughly every second.\r\n\r\n*Note: You might have to delete and re-add the KML layer and network link manually when you restart WInTak as there is a bug in 4.6 that stops the image overlay refreshing upon restart.*\r\n\r\n## 2. COT Data Packages\r\n\r\nAnother approach is to utilize COT Data Packages. The advantage of this approach is that it relays the messages through a TAK Server rather than having the client fetch/pull it like the KML/KMZ approach before.\r\n\r\nThis method requires more orchestration though. The python client needs to upload the zipped up data package, hash and finally send a COT message to TAK Server initiate the relaying. Once this is done, WinTak will prompt the user that there is a data package available for download. When the user accepts it, WinTak will download and display the data package.\r\n\r\n- To begin, update the `test_datapackage.py` to point to your TAK Server hosts, REST API (8080) and TCP (8087) ports.\r\n  ```python\r\n    takServerHost = \"localhost\"\r\n    takServerTcpPort = 8087\r\n    takServerUrl = \"localhost:8080\"\r\n  ```\r\n- open the `data-package-template/FILES/message.cot` and update the start/time/stale to current values. Start date needs to be earlier than now while stale time needs to be later then now.\r\n  ```xml\r\n    \u003cevent version=\"2.0\" uid=\"{uid}\" type=\"a-h-S-C\" time=\"2022-08-03T02:20:13.00Z\" start=\"2022-08-03T02:25:11.95Z\" stale=\"2023-10-24T02:25:11.95Z\" how=\"h-g-i-g-o\"\u003e\r\n  ```\r\n- Make sure your TAK client (WinTak) is connected to the TAK Server.\r\n- Run the following from the repo root\r\n  ```bash\r\n  python3 ./test_datapackage.py\r\n  ```\r\n\r\nWinTak should now prompt you to download a data package. Accept it. Navigate to the LAT/LONG of the cot message payload `lat=\"41.9545621\" lon=\"-73.12329\"` and you should see the point appear. Hovering/Clicking on it will display the image overlay.\r\n\r\n![Point on map](./docs/target.jpg)\r\n\r\n**Important: The filenames are case sensitive and cot messages are very sensitive to new line/line feed/carriage return characters. We highly recommend you minify the cot/xml files.**\r\n\r\nInstructions to manually generate and publish a data-package can be found [here](./docs/data-package-steps.md). The python script simply implements the steps there.\r\n\r\n## Contributing\r\n\r\nPlease raise an issue here or create a fork PR to fix as required. You can contact me via twitter @dasiths.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdasiths%2Fpython_tak_datapackage_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdasiths%2Fpython_tak_datapackage_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdasiths%2Fpython_tak_datapackage_example/lists"}