Name | fmo-livemap JSON |
Version |
0.3.0
JSON |
| download |
home_page | |
Summary | Simple way to draw a line on a map in real-time |
upload_time | 2024-02-26 20:35:18 |
maintainer | |
docs_url | None |
author | Gudjon Magnusson |
requires_python | >=3.7, <4 |
license | |
keywords |
map
real-time
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Draw a on a map in real-time
Install the library
```bash
pip install fmo-livemap
```
Run the server
```bash
livemap server
```
You can view the map in your browser at `localhost:5689`.
## Draw a line with a script
This simple script will connect to the map, create a new line and update it every 2 seconds
```python
gps_data = [
[38.91168232416608, -76.47992628575723,],
[38.91167723745552, -76.47998040159345],
[38.911660346950676, -76.48003362018159],
[38.91163193259245, -76.48008505529343],
[38.91159245603817, -76.48013384887776],
[38.91154255338108, -76.4801791845924],
[38.91148818673626, -76.48022588905636],
[38.91142387753969, -76.48026912019613],
[38.91135045470874, -76.48030791267406],
[38.911268963041756, -76.48034139145376],
[38.91118060039576, -76.48036874891672],
[38.9110867003822, -76.48038926174374],
[38.91098871241652, -76.48040230666497],
[38.9108881794186, -76.48040737474784],
[38.91078671350825, -76.48040408391331],
[38.910685970081836, -76.48039218939842],
[38.9105876206919, -76.48037159191706],
[38.91049332518039, -76.48034234331065],
[38.91040470353717, -76.48030464952399],
[38.9103233079686, -76.48025887079041],
[38.91025059566554, -76.48020551896194],
]
import time
from livemap.client import Map
# Setup a connection to the map server
map = Map("http://127.0.0.1:5689")
# Create an empty line
my_line = map.polyline("myline", [])
# Extend the line with new coordinates over time
for p in gps_data:
my_line.extend(p)
time.sleep(2)
```
You can change the color of the line: `map.polyline("myline", [], color='red')`
## Load a geojson file
When the server is running, use the cli to load a file
```bash
livemap load-file mydata.json
```
This assumes the server is running at `http://127.0.0.1:5689`, but you can override it
```bash
livemap load-file -h 127.0.0.1 -p 5555 mydata.json
```
You can change the color of the line
```bash
livemap load-file mydata.json --color red
```
This is a sample geojson file that works with the `load-file` command:
```json
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[
-75.7949705,
38.0574904
],
[
-75.7950745,
38.0572349
],
[
-75.7951317,
38.0572322
]
]
}
}
]
}
```
Raw data
{
"_id": null,
"home_page": "",
"name": "fmo-livemap",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7, <4",
"maintainer_email": "",
"keywords": "Map,real-time",
"author": "Gudjon Magnusson",
"author_email": "gmagnusson@fraunhofer.org",
"download_url": "https://files.pythonhosted.org/packages/6e/c9/58b971485d2ad4804079fcb647abaa49368c1b2a65bc09568785599c63b0/fmo-livemap-0.3.0.tar.gz",
"platform": null,
"description": "# Draw a on a map in real-time\n\nInstall the library\n```bash\npip install fmo-livemap\n```\n\nRun the server\n```bash\nlivemap server\n```\nYou can view the map in your browser at `localhost:5689`.\n\n\n## Draw a line with a script\n\nThis simple script will connect to the map, create a new line and update it every 2 seconds\n```python\ngps_data = [\n [38.91168232416608, -76.47992628575723,],\n [38.91167723745552, -76.47998040159345],\n [38.911660346950676, -76.48003362018159], \n [38.91163193259245, -76.48008505529343],\n [38.91159245603817, -76.48013384887776],\n [38.91154255338108, -76.4801791845924],\n [38.91148818673626, -76.48022588905636],\n [38.91142387753969, -76.48026912019613],\n [38.91135045470874, -76.48030791267406],\n [38.911268963041756, -76.48034139145376],\n [38.91118060039576, -76.48036874891672],\n [38.9110867003822, -76.48038926174374],\n [38.91098871241652, -76.48040230666497],\n [38.9108881794186, -76.48040737474784],\n [38.91078671350825, -76.48040408391331],\n [38.910685970081836, -76.48039218939842],\n [38.9105876206919, -76.48037159191706],\n [38.91049332518039, -76.48034234331065],\n [38.91040470353717, -76.48030464952399],\n [38.9103233079686, -76.48025887079041],\n [38.91025059566554, -76.48020551896194],\n]\n\nimport time\nfrom livemap.client import Map\n\n# Setup a connection to the map server\nmap = Map(\"http://127.0.0.1:5689\")\n\n# Create an empty line\nmy_line = map.polyline(\"myline\", [])\n\n# Extend the line with new coordinates over time\nfor p in gps_data:\n my_line.extend(p)\n time.sleep(2)\n```\n\nYou can change the color of the line: `map.polyline(\"myline\", [], color='red')`\n\n## Load a geojson file\n\nWhen the server is running, use the cli to load a file\n```bash\nlivemap load-file mydata.json\n```\n\nThis assumes the server is running at `http://127.0.0.1:5689`, but you can override it\n\n```bash\nlivemap load-file -h 127.0.0.1 -p 5555 mydata.json\n```\n\nYou can change the color of the line\n```bash\nlivemap load-file mydata.json --color red\n```\n\nThis is a sample geojson file that works with the `load-file` command:\n```json\n{\n \"type\": \"FeatureCollection\",\n \"features\": [\n {\n \"type\": \"Feature\",\n \"properties\": {},\n \"geometry\": {\n \"type\": \"LineString\",\n \"coordinates\": [\n [\n -75.7949705,\n 38.0574904\n ],\n [\n -75.7950745,\n 38.0572349\n ],\n [\n -75.7951317,\n 38.0572322\n ]\n ]\n }\n }\n ]\n}\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Simple way to draw a line on a map in real-time",
"version": "0.3.0",
"project_urls": null,
"split_keywords": [
"map",
"real-time"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "604a106e5378fa77e708dc44a4a68a73a3345f300cad395470faa98f17e5c2ba",
"md5": "f66189d59b3f0f35b240c8d70de2fdea",
"sha256": "12579ffd73a5d5c293c1724358e396bcc18161794a15963e9159b09dfa6a92af"
},
"downloads": -1,
"filename": "fmo_livemap-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f66189d59b3f0f35b240c8d70de2fdea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7, <4",
"size": 7229,
"upload_time": "2024-02-26T20:35:17",
"upload_time_iso_8601": "2024-02-26T20:35:17.058738Z",
"url": "https://files.pythonhosted.org/packages/60/4a/106e5378fa77e708dc44a4a68a73a3345f300cad395470faa98f17e5c2ba/fmo_livemap-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6ec958b971485d2ad4804079fcb647abaa49368c1b2a65bc09568785599c63b0",
"md5": "85b16fcdab1b555d84e0906732097e23",
"sha256": "36bfb3be200204ae3e1beec3fa2eee4c63c5a49627b8aac0c3e4f0f0d25bcfef"
},
"downloads": -1,
"filename": "fmo-livemap-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "85b16fcdab1b555d84e0906732097e23",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7, <4",
"size": 6317,
"upload_time": "2024-02-26T20:35:18",
"upload_time_iso_8601": "2024-02-26T20:35:18.221687Z",
"url": "https://files.pythonhosted.org/packages/6e/c9/58b971485d2ad4804079fcb647abaa49368c1b2a65bc09568785599c63b0/fmo-livemap-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-26 20:35:18",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fmo-livemap"
}