https://github.com/iwpnd/starlite-tile38
Starlite application showcasing tile38
https://github.com/iwpnd/starlite-tile38
api crud pyle38 spatial starlite tile38
Last synced: 18 days ago
JSON representation
Starlite application showcasing tile38
- Host: GitHub
- URL: https://github.com/iwpnd/starlite-tile38
- Owner: iwpnd
- Archived: true
- Created: 2022-01-24T07:30:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-31T14:08:38.000Z (over 1 year ago)
- Last Synced: 2025-04-26T23:03:05.425Z (28 days ago)
- Topics: api, crud, pyle38, spatial, starlite, tile38
- Language: Python
- Homepage:
- Size: 480 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Starlite-Tile38
Showcase using Tile38 via pyle38 in a Starlite application.
Report Bug
·
Request Feature
Table of Contents
## About The Project
Showcase of using [Tile38](https://github.com/tidwall/tile38) with [Pyle38](https://github.com/iwpnd/pyle38) in a [Starlite](https://github.com/starlite-api/starlite)
application. Can be used as is, or be extended upon with other methods in the [pyle38 repertoire](https://github.com/iwpnd/pyle38#commands) of commands.### Built With
- [Starlite](https://github.com/starlite-api/starlite)
- [Pyle38](https://github.com/iwpnd/pyle38)
- [Tile38](https://github.com/tidwall/tile38)## Getting Started
### Installation
1. Clone and install
```sh
git clone https://github.com/iwpnd/starlite-tile38.git
poetry install
```
2. Setup environment
```sh
mv .env.dist .env
```
3. Start your local stack
```python
poe up
```
4. Test it!
```sh
poe test
```## Usage
Once the application is started you can checkout and interact with it via on [localhost:8001/schema/redoc](http://localhost:8001/schema/redoc).
Or you can use it with [http](https://httpie.io/)/[curl](https://curl.se/):
### Create a vehicle
```sh
echo '{ "data": { "type": "Feature", "geometry": {"type": "Point", "coordinates": [13.37, 52.25]}, "properties": {"id": "truck"}}}' \
| http post http://localhost:8001/vehicles> {data:"type":"Feature","geometry":{"type":"Point","coordinates":[13.37, 52.25]},"properties":{"id":"truck"}}
```### Get vehicle by id
```sh
http get http://localhost:8001/vehicles/truck> {data:"type":"Feature","geometry":{"type":"Point","coordinates":[13.37, 52.25]},"properties":{"id":"truck"}}
```### Get all vehicles
```
http get http://localhost:8001/vehicles> { data: ["type":"Feature","geometry":{"type": "Point", "coordinates": [13.37, 52.25]},"properties":{"id":"truck"}]}
```### Get vehicles within radius
```
http get http://localhost:8001/search?lat=13.37&lon=52.25&radius=1000> { data: ["type":"Feature","geometry":{"type": "Point", "coordinates": [13.37, 52.25]},"properties":{"id":"truck"}]}
```Or you use it with [httpx](https://www.python-httpx.org/)/[requests](https://docs.python-requests.org/en/master/):
```python
import httpxvehicle = {
"type": "Feature",
"geometry": {"type": "Point", "coordinates": [13.37, 52.25]},
"properties": {"id": "truck"},
}# store a vehicle
r = httpx.post(
url="http://localhost:8001/vehicles",
json={"data": vehicle}
)print(r.json())
> { data: ["type":"Feature","geometry":{"type": "Point", "coordinates": [13.37, 52.25]},"properties":{"id":"truck"}]}# get a vehicle
r = httpx.get(
url="http://localhost:8001/vehicles/truck",
)print(r.json())
> {"data": {"type":"Feature","geometry": {"coordinates": [13.37,52.25],"type": "Point"},"properties": {"id": "truck"}}}
```You get the idea. And can use the rest.
## License
Distributed under the MIT License. See `LICENSE` for more information.
## Contact
Benjamin Ramser - [@imwithpanda](https://twitter.com/imwithpanda) - [email protected]
Project Link: [https://github.com/iwpnd/starlite-tile38](https://github.com/iwpnd/starlite-tile38)