πŸ“„
Docs
  • πŸ’»Gateway Server and API Docs
  • πŸ“”Client-Side Helper Functions
  • πŸ—ΊοΈMapping
  • πŸ””Notifications
  • 😎HoloLens
  • πŸ› οΈTSS Utility Routes
  • πŸ§ͺTest Routes
Powered by GitBook
On this page
  • Get Requests
  • Post Requests

Mapping

Documentation for the Map Pin Control API Endpoints

Get Requests

First, you can open the current state of the map by passing in the query get=map_img as shown below:

import requests
from PIL import Image
from io import BytesIO

url = "http://[IP]:3001/api/v0?get=map_img"

response = requests.get(url)
img = Image.open(BytesIO(response.content))
img.show()

Secondly, you can get a GeoJSON file that represents the current waypoints on the map as shown below:

import requests
import json 

url = "http://[IP]:3001/api/v0?get=map_info"

response = requests.get(url)
print(json.loads(response.text)) 

# prints a GeoJSON file 

Post Requests

The HTTP POST Requests that allow you to edit the pins of the map are as follows:

import requests 

url = "http://[IP]:3001/api/v0"

data = {
    "map": "add" # change to "rm" to remove 
    "pins": [[f"{x}x{y}"]] # where x and y are values to set for the image
    "dimensions": # your scaling factor goes here 

response = requests.get(
    'http://[IP]/api/v0'
    headers={'Content-Type': 'application/json'}
    data=data
    )

# This response, while empty, adds to the GeoJSON file so that the next time 
# you call `?get=map_img`, the image updates with those points

PreviousClient-Side Helper FunctionsNextNotifications

Last updated 1 year ago

πŸ—ΊοΈ