简体   繁体   中英

OSMNX: How to get inmediate possible directions from coordinate for a Q-learning algorithm

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM