how can I get the neighbor's node from a specific node? I need it to implement A-star algorithm. How to build the query for get this informations?
Related
I can fetch OSM street network using
G=ox.graph_from_point((lat, lng),custom_filter=road_filter,dist=20,simplify=False,retain_all=True)
The process is very slow if i have to make 1000 of such requests.I was hoping if i can load the saved osm file then query locally for the osm road networks.
In Osmnx, the only way to create a graph from a local .osm formatted XML file is:
graph = osmnx.graph_from_xml(filepath, simplify=False, retain_all=True)
There are not filters as other graph_from_*() functions, but once you got the graph you can query the Geodataframes containing nodes and edges that you get with:
nodes, edges = osmnx.graph_to_gdfs(graph, nodes=True, edges=True)
While fetching a driving route from OSRM, is it possible to fetch the names of the roads that feed into that path (so crossings and side roads)? If so, how can this be done?
Unfortunately you can only retrieve the names of the roads that are part of the route. This information is available if you pass the option steps=true.
The .routes[].legs[].steps[] object (RouteStep) has a property name that contains the street name.
Greetings fellow SO users,
I am extracting data with import.io from a site which contains city names. What I want to accomplish is to get the coordinates to each city from Nominatim and finally create/get a JSON response which contains the city name and the corresponding coordinates for each.
So I basically need to use the result from one API as the input for another (Nominatim).
Or in other words: feed a JSON list of city names to OSM's Nominatim and get back the coordinates to each city.
I wonder if this is even possible or what other options I have. Finally this would be used with leaflet to put some markers at a map.
There are tutorials for Nominatim, how to query etc. but only one query at a time. Is it even possible to query a whole list of places?
What you want to achieve in here is what we call Chained APIs. So you will need two APIs, where the input of the second one is the output of the first one.
In this case you will need some custom processing between the two APIs. From the first API you are getting the city name and from here you need to generate a list of URLs in the format http://nominatim.openstreetmap.org/search?q=CITY&format=xml one per each CITY.
After that you can use the Bulk Extract feature in import.io and pass the whole list of URLs to be queried against the API.
Having in hand the shape of the road and rural roads in the target region, followed the workshop documentation is available in pgrouting the site, I created the required fields, ran the pgr_createTopology, and other verification queries pgr_analyzeGraph and pgr_nodeNetwork, obtaining return "OK" in all of them.
QGIS using the BD Manager, to perform queries can not obtain routes from all nodes to all nodes, just a few return a possible route and only in segments almost completely straight.
I tried using the plugin pgRoutingLayer produced by Anita Graser and Ko Nagase, but the result is identical to direct SQL query.
I am using the pgr_djikstra to locate the route.
Does anyone have any idea what could be wrong? The following image with found and not found route.
Route found
Route not found
I need to fetch zipcodes falling all along the route using MapQuest API.Plz suggest i tried to find on mapquest forum as well as on stack .I also did google but can't manage to find appropriate solution.
Ex : Suppose i define a Route from point A to Point B. Now i need to fetch all zipcodes falling in between this route.
You'll want to look at the Corridor Search, which is part of the Search API Web Service. You have two options; you can either pass in the shapePoints that make up the route (corridor) that you want to search along, or you can use the Directions API to calculate a route and then use the sessionId from the Directions API response as input into the Search request.
Here's an example using the Directions API in conjunction with the Search API:
Use the Directions API to calculate a route between two points. In this example, I'm calculating a route between Denver, CO and Aurora, CO:
http://www.mapquestapi.com/directions/v2/route?key=YOUR-APP-KEY-GOES-HERE&from=Denver,CO&to=Aurora,CO
Locate the sessionId parameter in the response.
Use the Search API to perform a corridor search on the uspostalcodes table. I'm also filtering the results from the table to include just the name of the postal code and none of the other info that is available in the table.
http://www.mapquestapi.com/search/v2/corridor?key=YOUR-APP-KEY-GOES-HERE&sessionId=YOUR-SESSION-ID-GOES-HERE&width=1&buffer=0&hostedData=mqap.uspostalcodes|||POSTCODE
You can adjust the width/buffer options as well to refine your search.
Hope this helps!