Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to create custom building's map for iOS

I see some ways to do it:

1) Draw using OpenGL programmatically.

2) Draw using QuartzCore and CoreAnimation programmatically.

3) Draw map in AutoCad and then somehow connect it to iOS.

4) Draw map using SVG.

Requirments are supporting pathfinding and gps navigation.

For first 2 ways I think that it's expensive in terms of performance way, redraw all elements on scaling; and I don't think that this way may have GPS-navigation support.

Using AutoCad pictured maps is hard to understand for me how to connect it with graphs\paths for pathfinding.

My colleagues will develop this app on web using SVG. I found it - https://github.com/SVGKit/SVGKit , but still have no idea how it will support pathfinding and navigation.

I would appreciate any help.

like image 420
Aft3rmath Avatar asked Oct 05 '22 00:10

Aft3rmath


1 Answers

Generally there are two types of map application:

A) They display a map, (with or without a user position) without needing to calculate a path like a navigation system does (see point B)

B) Application that use the vectors of a map and calculate something: e.g to find a best path. The shortest connection, e.g A navighation system , etc.

Application for A) are usually less complex then that of B), because the vectors can be somewhat inacurate, have no conections, have small gaps, have no logic between the edges, etc.

1) To only display a building map, you would only need a list of edges. (An edge is pair of coordinates (x1,y1) - (x2,y2). How ever you get that. E.g MapInfo Professional format mif/mid.
Or even you could dispaly a pdf that contains the map of the builing. Right with the built in PDF View, (also with SVG but more difficult).

Things get much more complicated if it is not a relative map, but also a map that is positioned with an reference coordinate system, like latitude/longitude (WGS84).
In that case you would use a Tool (mapInfoProfessional, to import AutoCad DXF Files, and apply 3 GPS measured reference points at the corner of the house, and convert that to LatLong WGS84 coordinates system.
With ios you cannot measure that 3 Points because you cannot average a position, ios stops sending when you are standing still at one corner of the house. You could try to extract the positions from a google earth satellite foto if you are living in a region where google Sattelite fotos have high resolution. (But this might violate the license conditions of that Satellite Foto provider (Topic: derived data))

Finally you now have a list of edges in Lat Lon coordinate System.

For Displaying I personally would either do with 1) OpenGL) or 2) Quartz2D.

Now the Path finding part.

Probaly you need a second "map" that defines the possible paths inside the building. This structure must be a connect graph (points with connected neighbours). Computer games do it that way. (Some even allow you to display that path in developper mode)

The path can be drawn, in a different layer of the floor plan. But this path has higher requirements: No gaps are allowed, all must be perfect connected.

Call that layer "Path" and export it as own plan.
Now use only this path layer, and import, and create a graph of nodes with connect neighbours.

Use Dijkstra Algo to search for shortest path.

like image 136
AlexWien Avatar answered Oct 10 '22 03:10

AlexWien