In an experiment with Prolog I would like to use the data provided from OSM to calculate, for example, the shortest path to traverse a collection of points of interest. I have an idea how to do that with Prolog, and even how to access my Prolog program from a Java servlet (responsible of rendering the page with the map, or provide information to it if needed).
However, since I am new to OSM I still do not know how to let the users select a certain amount of nodes from the map, and how to answer (I mean, how to draw in the map) the shortest path to traverse them (given a user selected starting node). Could someone give me a hint about how I can ask, using an OSM map, many points of interest from a user and later draw a path between them as an answer ?
Thanks in advance!
Related
I want to create a path-finding algorithm to find the shortest distance between a business location and supplier location. I plan on converting the map into a graph but I am not sure what the nodes would be in this case, the roads?
I have researched the A* path finding algorithm but I don't know what the nodes are supposed to be
I am asking on here so that I can be directed to a solution or available information
I'm a beginner in redis-graph and presently I'm working on K-shortest path algorithm which is implemented in JAVA(where a graph is created using hashmap) and as the dataset is quite large(27 million rows) I need to a database to store a graph and for the same reason I plan to use redis-graph, but redis-graph uses cypher query language. How can integrate both these applications?
Any other suggestion(s) would be welcome.
Although you can use RedisGraph to hold the graph for you at the moment there's no way of finding K shortest paths from node A to node B, I've implemented a shortest path algorithm within RedisGraph but have yet to expose it to clients, I'm not sure of the approach you had in mind for finding K shortest paths, *I've implemented one using a cost edge flow-network, you can find my javascript implementation here
I'll might include a k-shortest path algo within RedisGraph, I need some time to think about that, in any case, using the current sub-set of Cypher supported by RedisGraph finding K shortest path is not possible,
You'll might be able to retrieve a relevant sub-graph from RedisGraph to your Java application find path I out of K and once no additional paths can be found, extend that sub-graph be retrieving additional nodes / edges from RedisGraph.
I need to be able to count all the houses/addresses that exist inside a polygon. I've thought it through and it seems possible to find if a single address exists inside a polygon (by finding if the geolocation intersects with it?)
Is it possible to pull a list of all the addresses in an area and check if they intersect? Or might there be some other method?
If I were to try to do this on the browser client, I would get an array of OpenLayers.LonLat objects or OpenLayers.Geometry.Point objects. I would iterate over that array and ask if each object was within a polygon by calling the containsPoint function of OpenLayers.Geometry.Polygon. I would count or collect the points that fall within the polygon.
Geospatial operations like you are describing are something we do on the server using open source GeoTools. We tend to use OpenLayers almost exclusively for map visualization.
I may have not answered your question entirely because I sense you are trying to get that list of addresses/points in the first place for an area on the map, and I don't think you've provided enough information to answer that part of the question.
As part of my academic project, I have to build a routing engine based on data supplied from OSM. I have looked at the data model of OSM and I'm all fine with it. However, I'm having trouble converting an OSM XML file into a graph structure (nodes and edges) that I can use to apply search algorithms (Dijkstra, A* etc.) on. I would like the graph to be stored in memory to allow fast read/write.
So can anyone shed light or suggest techniques on how this can be done, or even provide pointers for further research.
Please note that I'm not allowed to re-use existing routing engines as this would defeat the purpose of doing the project.
All you need to do is:
create a node for every <node> item
every <way> entry is a sequenced list of <nd> items, each of which is a backreference to a node. So for each <way>, you iterate pairwise through its <nd>s and create an arc between the two nodes referenced.
You can do this in one pass using a streaming XML parser, since the XML data defines all the nodes before the ways.
The data doesn't intrinsically include distances, so you need to calculate that from the latlon of each node. You should also take account of the road type (highway=*) and the access info (access=*) in your routing, and you probably also want to ignore ways that are not traversable (eg waterway=stream) but that's all down to your specific situation.
http://wiki.openstreetmap.org/wiki/Elements
I have been looking for "MapReduce implementation of Shortest path search algorithms".
However, all the instances I could find "computed the shortest distance form node x to y", and none actually output the "actual shortest path like x-a-b-c-y".
As for what am I trying to achieve is that I have graphs with hundreds of 1000s of nodes and I need to perform frequent pattern analysis on shortest paths among the various nodes. This is for a research project I am working on.
It would be a great help if some one could point me to some implementation (if it exists) or give some pointers as to how to hack the existing SSSP implementations to generate the paths along with the distances.
Basically these implementations work with some kind of messaging. So messages are send to HDFS between map and reduce stage.
In the reducer they are grouped and filtered by distance, the lowest distance wins. When the distance is updated in this case, you have to set the vertex (well, some ID probably) where the message came from.
So you have additional space requirement per vertex, but you can reconstruct every possible shortest path in the graph.
Based on your comment:
yes probably
I will need to write another class of the vertex object to hold this
additional information. Thanks for the tip, though it would be very
helpful if you could point out where and when I can capture this
information of where the minimum weight came from, anything from your blog maybe :-)
Yea, could be a quite cool theme, also for Apache Hama. Most of the implementations are just considering the costs not the real path. In your case (from the blog you've linked above) you will have to extract a vertex class which actually holds the adjacent vertices as LongWritable (maybe a list instead of this split on the text object) and simply add a parent or source id as field (of course also LongWritable).
You will set this when propagating in the mapper, that is the for loop that is looping over the adjacent vertices of the current key node.
In the reducer you will update the lowest somewhere while iterating over the grouped values, there you will have to set the source vertex in the key vertex by the vertex that updated to the minimum.
You can actually get some of the vertices classes here from my blog:
Source
or directly from the repository:
Source
Maybe it helps you, it is quite unmaintained so please come back to me if you have a specific question.
Here is the same algorithm in BSP with Apache Hama:
https://github.com/thomasjungblut/tjungblut-graph/blob/master/src/de/jungblut/graph/bsp/SSSP.java