I want to draw the possible path between two Beacons


#1

Can we draw a path between the two beacons in indoor map?
I want to show the possible path between beacons whose are in my indoor map.
I have some information about my beacons and for searching for some item on and draw path on floor map.


#2

Hi @SumeetMourya!

If you are using EILIndoorLocationScene for drawing the location you can use SKSpriteNode or similar graphical nodes for displaying the path.

If you are using EILIndoorLocationView for drawing you can use the drawObjectInBackground:withPosition:identifier: or drawObjectInForeground:withPosition:identifier:

There is currently no support method for estimating shortest path between two points. However, you can implement some simple algorithm like A* (https://en.wikipedia.org/wiki/A*_search_algorithm).


#3

I have the same question…


#4

Thanks for the reply.
But I don’t have too much experience with Indoor SKD, Do we have method to get all the connection to create the graph for all the beacons whose are present, If have all the connection then I can implement the shortest path on the basis of those data.


#5

Do you mean something like that?

The EILLocation object has a beacons property, which is an array of EILPositionedBeacon objects. Each EILPositionedBeacon has a position property, which is an EILOrientedPoint, which has x and y properties. So you just need to take two beacons, extract their x’s and y’s, and draw a line between the two.

Like Marcin said, EILIndoorLocationScene extends SKScene, i.e., it uses Sprite Kit to do its drawing. Here’s something I found on drawing a line in Sprite Kit:

https://stackoverflow.com/questions/19092011/how-to-draw-a-line-in-sprite-kit

I guess you’d need to replace the CGPathMoveToPoint(pathToDraw, NULL, 100.0, 100.0); and CGPathAddLineToPoint(pathToDraw, NULL, 50.0, 50.0); with the x’s and y’s instead of 100.0/50.0.

And instead of doing [self addChild:yourline];, you’d call addChild on the EILIndoorLocationScene object.


#6

Thanks Yes something like this, but it direct create the line on give points

Take the example of this above image I want to draw a line between A->B1 or A->B.
I need implement the in the way to draw the valid path which follow the map.


#7

Hi @SumeetMourya!

For now the easiest way would be to use a grid:

  • You create a grid point every 0.5 m / 1.0 m.
  • Throw away points lying outside location
  • In your graph you assume that points lying within 0.5/1 * Sort(2) are connected.
  • Find closest points to the starting & ending points.
  • Run A* algorithm.

#8

Hi, is there any example code for EILIndoorLocationScene? I want to learn how to use EILIndoorLocationScene. Thanks a lot!


#9

Hi,
How can I draw a line in android?
Thanks