Reverse engineered APIs to interact with a Google My Maps map
Project description
gmymaps
Impetus
Google Maps has a convenient feature for saving points of interest, called My Maps. Such maps are useful for sharing locations with friends. Unfortunately, Google does not provide an API to programatically view or update a MyMaps map1, and it is unlikely to be available any time soon.
This package acts as a simple wrapper around the endpoints used by the official My Maps web app, essentially mimicking the web app's behavior.
Try it out!
- Head over to My Maps and create a My Maps map.
- On Google Drive, make the map publicly accessible by sharing it as link for anyone to edit.
Fetching map data
import gmymaps
map_id = 'your-map-id-here'
client = gmymaps.get_client()
result = client.get_map_data(map_id)
Editing points and layers
from gmymaps import PointAttrs, PointAttrType
map_id = 'your-map-id-here'
layer_id = client.create_layer(map_id)
client.update_layer(map_id, layer_id, layer_name='My New Layer')
point_id = client.create_point(map_id, layer_id)
attrs = (PointAttrs()
.add_attr(PointAttrType.NAME, "My New Point")
.add_attr(PointAttrType.DESCRIPTION, "This is an interesting place to go!")
.add_attr(PointAttrType.COORD, [1.37, 103.75]))
client.update_point(map_id, layer_id, point_id, attrs)
client.delete_point(map_id, layer_id, point_id)
client.delete_layer(map_id, layer_id)
Cookies
When attempting to access a private map, requests will be redirected to a sign-in page.
This redirection occurs even if the map is shared with a service account and
accessed using OAuth credentials from that account. To bypass this, you can save a session cookie,
similar to yt-dlp's --cookies-from-browser feature. For more details, refer to cookie.py.
Future work
- Creating convenience wrappers like
MapandLayer - Changing of point colors
- Uploading and downloading of KML files
References
1: Link to issue: https://issuetracker.google.com/issues/35820262
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gmymaps-0.1.1.tar.gz.
File metadata
- Download URL: gmymaps-0.1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.6.28
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d306ae5c9ee1bb5e5dc66806a1c1e03846537254af19561363f77e4375af275a
|
|
| MD5 |
4af2789d388b231f6c951ed4e7414de0
|
|
| BLAKE2b-256 |
c819d27953910dc5ac06f751cfde7a9c2f48e0d5220aa97b2e058ba1e767ac52
|
File details
Details for the file gmymaps-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gmymaps-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.6.28
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48572c14fa6abced4966d94e8f4894067ff51f5aab0b547a2204adf62e35eede
|
|
| MD5 |
5747e906d1be6e64d025c814f6ec18e1
|
|
| BLAKE2b-256 |
2fa8ab8695db2e24d6cfa2ec534de478a4bcb13d145dabb6861cd8146c75e96a
|