searoute-py icon indicating copy to clipboard operation
searoute-py copied to clipboard

[BUG] Some Ports Are Located in the Middle of Land

Open DeepeshKalura opened this issue 7 months ago • 1 comments

While visualising the port data from searoute/data/ports_dict.py, I noticed that some ports are incorrectly positioned in locations that are far from the sea, essentially in the middle of landlocked regions.

Example:

India > Delhi is listed as a port, but it is located inland, far from any sea

Image

Expected Behavior: Ports used in searoute calculations should ideally be coastal or valid maritime-accessible locations.

Steps to Reproduce:

  • Load ports from searoute/data/ports_dict.py
  • Visualize them on a map
  • Observe several ports (e.g., Delhi) appearing on land, far from the coast
from searoute.data.ports_dict import node_list, edge_list
import logging

logging.basicConfig(level=logging.INFO)

import folium

def visualize_on_folium(node_list, edge_list, output_file="map.html"):
    # Center map roughly in the middle of your nodes
    lats = [coords[1] for coords in node_list]
    lons = [coords[0] for coords in node_list]
    m = folium.Map(location=[sum(lats)/len(lats), sum(lons)/len(lons)], zoom_start=4)

    # Add nodes
    for (lon, lat), attrs in node_list.items():
        folium.CircleMarker([lat, lon], radius=5,
                            popup=f"{lat}, {lon}",
                            color="blue",
                            fill=True).add_to(m)

    # Add edges
    for u, neighbors in edge_list.items():
        for v in neighbors:
            folium.PolyLine([[u[1], u[0]], [v[1], v[0]]],
                            weight=2,
                            opacity=0.7).add_to(m)

    m.save(output_file)
    return output_file


if __name__ == "__main__":
    visualize_on_folium(node_list, edge_list, "port.html")
    # Optionally open in browser
    # webbrowser.open(f"file://{html_file}")

DeepeshKalura avatar May 13 '25 07:05 DeepeshKalura

@DeepeshKalura These ports that appear as "inland" are in fact even dry ports (container, multimodal ...) or river ports, however they exist according to this list https://service.unece.org/trade/locode/in.htm (list of ports in IN) also they are of different types as explained here : https://service.unece.org/trade/locode/Service/LocodeColumn.htm#Function (ref. to Function column in previous link)

I'm already splitting them between a terminal unit or non-terminal unit and allowing to filter based on that port_params. In addition what could be done is to add a new definition for each type of port in the attributes as for the terminal (True/False)

genthalili avatar May 14 '25 17:05 genthalili