genthalili / searoute-py

A python package to calculate the shortest sea route between two points on Earth.
Apache License 2.0
63 stars 14 forks source link

users custom ports.geojson as input #19

Closed MatthewWPL closed 10 months ago

MatthewWPL commented 1 year ago

Hi @genthalili , this is a brilliant and useful repo. I was just wondering how difficult it would be to allow the user to upload their own ports.geojson file (e.g. either for a port not in your DB or for a hypothetical future port).

It would be great to have this as an input that the user can potentially load by either a path to a local file or geojson variable in memory.

Thanks for considering this.

genthalili commented 11 months ago

Hi @MatthewWPL , thanks for the support! This sounds like a good idea, to acheave this I will need to re-organize the structure of the module and make it class oriented. Eventually something like this might work :

import searoute as sr
# default function as-is..
sr.searoute(origin, destination, ...)

# and for more control
sea_route = sr.Seaoute()
sea_route.shortest_route(origin, destination, ...) or sea_route.searoute(origin, destination, ...)

# change ports
sea_route.set_ports(...)
# then get route with new ports
sea_route.shortest_route(origin, destination, ...) or ...

Something similar, will need to think a bit for a better design and keep it simple, wihout changing much from what exists today from the usage point-of-view

genthalili commented 10 months ago

Implemented in version 1.2.0