Comments (8)
Sure, should not be too much work for real-time tracks on API endpoint like /api/tracks
. And to perform the search should be quite fast.
A bit more work to allow users to define area of interest using GUI/leaflet map. So leaving that out for now
Pasting some from your email also to have all in one place:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[
10.582742552132572,
59.68073946853113
],
[
10.582742552132572,
59.642878218853696
],
[
10.648754933525879,
59.642878218853696
],
[
10.648754933525879,
59.68073946853113
],
[
10.582742552132572,
59.68073946853113
]
]
],
"type": "Polygon"
}
}
],
"bbox": null
}
from spartid-ais.
Perfect! Thanks alot!
from spartid-ais.
Example for an area in inner Oslofjord
POST http://localhost:9101/api/tracks/within_geojson
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
10.448930617939055,
59.919122036731494
],
[
10.484020625146343,
59.760857249580965
],
[
10.530875866141656,
59.669302256280474
],
[
10.657776978556484,
59.65696500973257
],
[
10.652060393103,
59.87144398059414
],
[
10.793491722665465,
59.859533425194996
],
[
10.781565544580502,
59.931234129039865
],
[
10.448930617939055,
59.919122036731494
]
]
]
}
}
]
}
from spartid-ais.
Thanks for the work Knut!
I have updated docker and trying to use rest sensor with Home Assistant.
With the following command I only get 405 reply with the method is not allowed for the requested URL.
Are you able to see what is wrong?
Thanks for all the help!
Rest:
ais_information:
url: http://xxx.xxx.xxx.xxxt:9101/api/tracks/within_geojson
method: 'POST'
payload: '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[10.582742552132572,59.68073946853113],[10.582742552132572,59.642878218853696],[10.648754933525879,59.68073946853113],[10.582742552132572,59.68073946853113]]]]}}}'
content_type: 'application/json; charset=utf-8'
from spartid-ais.
Glad you tried it out and report back!
Related to getting a 405 (Not found) I suspect you might still run the previous version.
- Did you run
docker compose up -d --build
or similar set of commands to build and update your docker containers? - Verify log output from web container to find one line with
web-1 | <Rule '/api/tracks/within_geojson' (POST, OPTIONS) -> views.tracks_within_geojson>,
From my log with successful request to I get
web-1 | [2024-03-06 20:56:44,654] INFO in _internal: 172.18.0.1 - - [06/Mar/2024 20:56:44] "POST /api/tracks/within_geojson HTTP/1.1" 200 -
The payload you posted also had a mixup in ] and } in the last part. So I had to modify it to get it to work
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
10.582742552132572,
59.68073946853113
],
[
10.582742552132572,
59.642878218853696
],
[
10.648754933525879,
59.68073946853113
],
[
10.582742552132572,
59.68073946853113
]
]
]
}
}
]
}
I fixed another error with the database connection not working inside docker, so better pull from Github again before testing.
Best of luck with getting it running on your machine!
from spartid-ais.
Again thanks Knut.
You were right, the build command solved the docker image.
Now able to get the positions for only geobox.
Earlier I had modified leaflet.html with zoom and other geoposition and linking it through docker volumes to the web container but not able to do the same. How can I change the initial view area when loading the page?
I see as well that you have made the page more mobile friendly, perfect!
I was thinking of using the mmsi to retrieve data of the actual ship with webscraping from marinetraffic.org in Home Assistant.
Or do you know if this is possible to add as functionality to your solution making it a one stop shop?
Thanks for your work, much appreciated!
from spartid-ais.
Glad you got it to work.
For default settings as zoom and center position I think this could be implemented with configuration file and/or environment variables. I will look into this in another issue
About webscraping marinetraffic.org I'm a bit unsure about licensing of images and data etc. So I think spartid-ais
will not implement this to get into licensing trouble. Only safe thing would be to provide a link using mmsi like https://www.vesselfinder.com/vessels/details/9014690 (not sure why, but marinetraffic.org linked to vesselfinder.com)
from spartid-ais.
Hi again!
After much try and error I'm still not able to use the information provided by rest_command.
Rest command does not return values, so I'm only able to see the result when manually running the rest_command as a service.
When I try to reuse it in a sensor it fails again with following message:
<!doctype html> <title>415 Unsupported Media Type</title>
Unsupported Media Type
Did not attempt to load JSON data because the request Content-Type was not 'application/json'.
Could you please give some tips of how I'm going to reuse the reply from rest_command or other sensor to run a template alla this?: "{{ value_json.features[0].properties.mmsi == 257169200 }}"
Screenshot from restful command:
from spartid-ais.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spartid-ais.