Storing AIS-Catcher Data in PostgreSQL #297
Replies: 2 comments 1 reply
-
Hi, @Parabellum123. AIS Catcher already has the option to store a lot of data in a PostgreSQL database. Take a look at the documentation: https://github.com/jvde-github/AIS-catcher?tab=readme-ov-file#writing-ais-messages-to-a-postgres-database |
Beta Was this translation helpful? Give feedback.
1 reply
-
I was able to successfully transfer data to my database with the help of someone who assisted me directly. The issue was with connecting to the PostgreSQL table, which I had overlooked. Thank you to those who responded to my comment |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I'm currently working on a project where I need to capture AIS (Automatic Identification System) data using AIS-Catcher and store it in a PostgreSQL database. I've managed to get AIS-Catcher running, but I'm having trouble figuring out the best way to save the captured data directly into my PostgreSQL database.
Here’s a quick overview of my setup:
Here’s a snippet of my Python code:
`import subprocess
import socket
import json
import psycopg2
from datetime import datetime
import os
def run_ais_catcher():
ais_catcher_dir = r"C:\Users\User\Downloads\AIS-catcher.x86 (edge win 32)"
ais_catcher_exe = "AIS-catcher.exe"
command = [
os.path.join(ais_catcher_dir, ais_catcher_exe),
"-N", "8100",
"-v", "10", "-X", "-u", "127.0.0.1", "10110", "-u", "127.0.0.1", "10111"
]
subprocess.Popen(command, cwd=ais_catcher_dir)
def connect_to_db():
conn = psycopg2.connect(
dbname="ship_ais",
user="andigit",
password="kmzway87aa",
host="localhost",
port="5432"
)
return conn, conn.cursor()
def receive_and_store_data():
TCP_IP = '127.0.0.1'
TCP_PORT = 8100
BUFFER_SIZE = 1024
if name == "main":
run_ais_catcher()
receive_and_store_data()
`
The errors I'm encountering include:
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
usb_open error -3 Please fix the device permissions
Could anyone guide me on how to properly set up this pipeline to capture and store AIS data in PostgreSQL? Do I need to configure anything specific in my system settings or the code itself?
Any help or pointers would be greatly appreciated!
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions