I have to develop interactive floor plan navigator and viewer for apartment buildings, which will succeed its Flash-based predecessor.
I am now in the process of evaluating techniques and technologies best suited to implement this in HTML5. I will have to support all common browsers (IE starting with 7).
Requirements:
I have been thinking of the options for implementing this. I will also need a quick way of selecting polygons for the floors (overview) an the apartments (floor plan) to allow non-developers to create new buildings.
The options I came up with:
What is the best option for cross-browser compatability?
Either SVG or Canvas will suit your needs. You'll probably have an easier time developing this in SVG simply because of how much is already done for you.
Here are some other considerations:
At this point they are pretty equal compatibility-wise, save for older versions of IE. You can get those to work with Canvas using the excanvas library, but it kinda sucks, especially if anything is going to be moving.
I'd recommend SVG solely because you will be able to get off the ground developing it much much faster for a floor-plan type of app. Everything is already a DOM object. Events, mouse handling, etc, is already done for you.
But if you really want it to work on (older?) android phones, Canvas may be the better bet for now.
I'm planning something similar for indoor navigation :)
I ended up using OpenLayers (http://openlayers.org/)
Actually OpenLayers was invented for GIS Stuff (Maps etc.) but you can easily define a X-Y-Z metric coordinate system and simply feed it with vector data.
The big benefit is that it comes with many features like drawing, different vector overlays, collision detection, distance measuring, tooltips, marks etc:
For OpenLayers 2.x (originally) see:
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/draw-feature.html
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/transform-feature.html
For OpenLayers 3.x see:
http://openlayers.org/en/v3.4.0/examples/
http://openlayers.org/en/v3.4.0/examples/draw-features.html
You can communicate over GeoJSON, GML etc. with the backend. We used PostGIS as backend to store the vector data. There's also a spatial extension for mysql (http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html).
Just define a simple X-Y-Z coordinate system with a well chosen reference point :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With