Monday 31 October 2011

Wifi coverage maps

I have been working on a small project for a Community Interest Company who deliver Fi-Wi and who want to display the coverage area of their wifi. They want to show the coverage as bands for their speed of connection: 10Mb, 20Mb, 30Mb etc. They cover a number of areas across the country, especially rural areas. I needed to display a polygon over an OSM map. Their website already has a map on it, using Cloudmade tiles, but with no coverage area on it yet. I took a look at GeoJSON as a way to handle description of polygons and looked at the way OpenLayers handles it. I created a GeoJSON feature collection by hand and tried to display it with OpenLayers. After a frustrating couple of hours I hadn't persuaded it to display my polygons, so I turned to Leaflet. In a few minutes, starting from scratch, I had a map with my polygon on it.

I needed to manage many polygons so I created an AJaX feed to send a GeoJSON feature collection for a bounds box. That way when a map is displayed any of the polygons that should appear on it get sent for that map. The coverage polygons are stored in a database with their maximum extents for north, south, east and west which can them be used to decide which polygons are served for the current bounds box of the displayed map. As usual AJaX is quick and effective. Debugging is fairly easy too since a call to the AJaX server returns a GeoJSON file which is easy to read.

The remaining job was to create a polygon editor so the guys who manage the website can manage the shape of the polygons easily as well as adding new ones as their business expands. This was more intricate, though I'm not sure that I have yet done as much as I would like.

I've enjoyed working with this problem, I hope it helps the company. It has also convinced me that Leaflet is a much more pleasant way to display maps with overlays than wrangling OpenLayers, which may be powerful and very flexible but it always causes me problems.

2 comments:

Anonymous said...

I've been doing a lot of work with OpenLayers recently, and I feel I'm finally getting to grips with it. It's pretty easy to display GeoJSON and I've also been using OpenLayers for feature editing in my most recent work - it works surprisingly nicely. But the caveat is that it's really easy to tie yourself in knots trying to wrestle it to your desires.

The biggest downsides to OpenLayers are a combination of documentation (poor), tutorials (lacking) and outdated approaches in mailing list archives (misleading).

Chris Hill said...

gravitystorm, I agree about the documentation and so on, but there is more than that. OpenLayers is very powerful and flexible, but I don't need that power and flexibility most of the time so it is just stuff that gets in the way or that trips me up. I will use OL again, there will be times when the power it offers means it can handle something Leaflet can't, but there are times when I wonder if the effort really is worth it.