Showing posts with label OpenStreetMap. Show all posts
Showing posts with label OpenStreetMap. Show all posts

Saturday, February 14, 2015

OpenStreetMaps and OpenLayers vs Google Maps API

As noted in several previous blog posts here I wanted to try to get a OFFLINE mapping system working with the "Driveby System".  I believe now that I've found that mapping system in OpenStreetMaps using OpenLayers.

The reason it's nice to have a LIVE map while your driving with the "Driveby System" is mainly so that you can SEE how well the system has recorded the data while you're driving.  Being able to see the results of your live drive test is handy in knowing if you missed a street, or if you should drive a street more times to get a better, more dense results (perhaps you drove too fast the first time for example).  Driving too fast results in gaps in the map.  The idea with the system is to get as continuous/dense a heatmap result as possible. (e.g. without gaps, and WITH having smooth transitions from quiet to noisy areas).

The results are quit good!  The setup is NON-Trivial (meaning it takes following quiet a long setup of directions at least with Ubuntu 14.04).  I now feel the effort was worth the time spent (about 6 hours on my slow laptop) and about 4 hours experimenting with HTML and Javascript and my PHP code including the brief learning curve to read up on how to do a heatmap using OpenLayers.

I used the following URLs to get my system setup and running:

The results are almost as accurate as Google Maps API.  I say 'almost' because it appears at least in my area that OSM may have some outdated street detail.  For example, their map tiles show a street that continues past where it actually does.  Also some of the streets don't line up exactly where my GPS shows they actually are.  On my OSM heatmap using OpenLayers this shows my path that I drove slightly offset from the actual REAL street (according to my GPS, which seems to line up VERY well on Google Maps API).

These short comings are really kind of  'ok'.  I mean it's fairly obvious in the results where you actually where vs what was rendered in the Heatmap.  At certain zoom levels they look just fine.  However when you zoom in very tight, the path I drove with my GPS doesn't line up 100% with the road shown on the map.  

Lets not forget that we'll now have TWO mapping options!  OSM/OpenLayers while live drive testing, and Google Maps API later when you are back to a stable internet connection.   I don't plan on removing the Google Maps API work I've done from Driveby.  I'm simply adding more functionality to provide options.  OPTIONS In my humble opinion are ALWAYS a good thing :-)

I think the benefits outweigh any negative issues.  For example using OSM and OpenLayers means that no live internet connection is required.  Which is AWESOME, and was the primary goal of this exercise.  The map tiles are downloaded and stored locally on my laptop well before I go for a drive test and once installed remain there.  So there is no need at all to have any internet connection.  This is important for many reasons.  Cell Data access is expensive (for some folks).  Cell Data access is unreliable in some areas of the country especially when you are attempting to drive test an area that is remote which may end up being a common use area for a system like this.  Using a tethered Internet Connection (lets face it) can be a pain in the ass causing more frustration than ultimate usefulness!  Been there done that!

Another nice aspect of using OpenLayers is that it renders a much nicer looking heatmap than my experiences with Google Map API v3.

I plan on including config setup for use with OSM and OpenLayers in the Driveby System code which is now available on GIT HUB (minus the new OSM / OL stuff just yet, because I'm still working on it's inclusion into the Driveby Project.

Saturday, February 7, 2015

Driveby System - Work on open source mapping without need for live internet access

One of the biggest complaints I have about using my own "Driveby System" that maps the noise floor of various frequencies in order to locate sources of Power Line Noise is that currently it relies on Google Maps API.  This means that in order to view the maps from the collected data the system requires a live internet connection.  

This is fine in practice, because the data being collected is stored permanently on an attached SSD Drive.  Driveby has the ability to 'review' previous drive tests currently.  So when I return home and once again have an internet connection the mapping works just fine.


Also I have setup the networking to work both with a USB or Bluetooth connected internet connection via a smartphone or tablet capable of sharing it's internet connection.  However, in tests so far this has been problematic.  Loss of cellular internet connection seems to occur regularly (at least around here).  


This forces me to have to mentally remember all the streets I've drive tested in town.  And well....at 52 my memory isn't as good as it used to be.  


SOOOOO.....


I'm looking at trying to use a mapping system that allows the user to download locally the map-tiles that it requires.  Say within a 20 mile radius of the drive test area. (or more depending on the space available on the system).


I think that something like OpenStreetMap might be something I can use.  I've read that it's possible to save locally the map tiles.  


Another option is to use Google Earth (installed) and convert my map/noisefloor data to KML.


I'm still reviewing the best options at this point.  I like Google Earth, as I've done A LOT with KML in the past 10 years.  So that's fairly familiar.  There are also some nice features in GE that could be leveraged in the future.  However, because this is fairly bulky app to install and kind of hogs memory when it's running....I think it'd be a good idea to keep searching.


I've seen some really nice heatmap's done on OpenStreetMap but I've never used this system before so there's likely to be a learning curve there.  


Anyway, I just wanted to share some thoughts on what I'm thinking about doing AFTER the first release of the "Driveby System" code.



Update

So looks like so far that I can't get OSM to install properly on either the TK1 or the Odroid XU3.  SO most likely OpenStreetMap is 'out' as a candidate.

UGH....so now to try to get Google Earth using KML to work.  Trouble is I think GE is semi-tied to having internet access too...blah!


Update 2015-02-13



Today I was able to get a OSM tile server up and running locally on my laptop using this.

Now I'm looking further into how to use OSM with this new mapping tile server. (again this is setup so that mapping would be possible WITHOUT an Internet connection.


The Tile server serves up maps on a web-server that would be running locally on my laptop and I hope to be able to provide coordinates to it to get back a zoomed in map to within a few miles of my location similar to how I'm doing with Google Maps API at currently.


Then the next phase is to work on adding a layer that would be like the 'heatmap' API in Google Maps.



SUCCESS!  Using OSM and OpenLayers I have a completely standalone 'tile server' that can map for me without Internet Access to the outside world.


This process requires A LOT of patience working through the URL noted in the 2015-02-13 Update above.  However, IT DOES WORK, and it actually works WONDERFULLY for so far.

I am now working on setting up HEATMAPS with the OpenLayers v3 API Once all of this is completed, I'll also update the recently released GIT HUB code for the Driveby System. (see other posts about that on this blog).

This is going to be awesome!  I can already feel like this will work really really well.  The API and the setup noted above all seem to work as directed and specified in their respective documentation.  (a rare thing in this world!)