-1

I'm working on a Q-learning algorithm that navigates over OSMNX nodes. My goal is to offer the Q-learning agent an step based context where on each step I can list the possible actions like: "straight, turn left, turn right...". So I would need a list of immediate connected nodes that could offer this decision context step by step. The idea is to combine POI data so the agent can be "distracted" by the surroundings.

I've tried

ox.get_nearest_node()

but that only gets me the nearest node to those coordinates but not the list of immediate connected nodes

Macumbaomuerte
  • 2,197
  • 2
  • 19
  • 22

1 Answers1

0

I'm not even sure how it works and why I have to give it a list of coordinates instead of a single coordinate

Did you read the documentation? It explains how it works and says that function returns "the graph nodes nearest to a list of points". Pretty straightforward. You could use the get_nearest_node function instead for a single point (docs).

I'd encourage you read the OSMnx documentation and the usage examples to understand how to use the package.

gboeing
  • 5,691
  • 2
  • 15
  • 41
  • 1
    Yes, I read the documentation, and I don't understand it, that's why I ask here. Anyway, if you understand the documentation, can you explain me why i need to pass a list of coordinates instead of a single coordinate? – Macumbaomuerte Sep 04 '20 at 07:01
  • If you want to find the nearest node to a single coordinate pair, rather than the nearest node to *each* coordinate pair in a list of coordinate pairs (which is what get_nearest_nodes does as per the documentation), you need to use a different function. Like I said in the answer, "You could use the get_nearest_node function instead for a single point". – gboeing Sep 04 '20 at 16:25
  • Ok, I edited the question, because it wasn't clear i guess – Macumbaomuerte Sep 08 '20 at 18:14