Why Town Council Clerks might be ebaying soon
- Cutting grass verges
- Looking after local footpaths
- Street cleaning (such as litter picking, sweeping and graffiti removal)
- Parks and open spaces
- Cleaning bus shelters
- Public conveniences
- Tourism activities
Upgrade to Google Maps v3 - Oily rag view
Google maps has just celebrated its 5th birthday and at the Google I/0 event this year they announced the launch of Google Maps Version 3 (Gmaps v3), and the differences between v2 and v3 are quite momentous.
I thought I'd give you a heads-up on some of the key points and point out some gotchas you can avoid. I'm a jobbing PHPer and know enough about JS to get me by, especially as I rely on jQuery more and more - and I am going to presume your skills are similar to mine. I was no great Gmaps v2 ninja, but could work out how to do most things. I also worked as a GIS tester for about a year when I started out in IT, which has always meant Gmaps made some sense to me.Too busy to read on? Short version: Adopt html5-repurposed Gmaps V3, win mobile, lose IE6.
You'd better read the next line twice.
Upgrading Gmaps from v2 to v3 meant me rewriting every single line of JS but I cut out more than I rewrote.Yep, backward compatibility (bc) went out the window, maybe there are some pockets of code you can keep the same, but I did not find any, and support for IE6 and FF2 is dropped. I will start by giving you three of the headline reasons you, as a developer, may want to overhaul your Gmaps code.You don't need to submit a google licence key - a constant thorn in my side when trying to test things locally. Gmaps v2 meant Google gives you a key you can call from 'localhost' but when you have multiple domains running on 'localhost' this does not work - I had to constantly edit my hosts file and make the current website the first one on the list in order to stop the nagging "key not reconised" alert. Plus, that is one less stonking great global var knocking around my CMS, and for each client that's one less thing to apply for. This was big news for me. Streetview no longer needs Flash - yep, Streetview is done in straight HTML (and JS probably). I have loathed proprietary standards since being bitten by them when I first started learning about t'internets. I already wrote about the arrival of Google Streetview in the UK and its importance for local councils. Now I could rip out all that conditional code, all those extra GUI warnings and help hints about how to install Flash, turn it on etc. It make me feel, so, ahhhhh! CLEAN! Plus, I can provide Streetview even on smaller maps. Gmaps v3 is optimised for mobile devices - they claim its faster, I have not tested this nor will I ever have time to do that, but I believe them and to have something which gets me better maps on Android and iPhone devices is just all win. Certainly Gmaps v3 seems a lot slicker to me now.In Gmaps v2 I had hundreds of markers kept in xml files, and the associated data for each point was popped up into ExtInfoWindows after an Ajax call back to PHP scripts on the server. This provided me with the right mix of immediacy and responsiveness (showing the marker) and content (showing the data in a pop up on the map).
It was fiddly to set up and test and it seemed so complex, over engineered and convoluted that I dreaded having to adjust or debug it. But, hey, it worked and I and my client were happy.Gmaps v3 is rebuilt and stripped down to its bare necessities, and if you want the niceties of absolute control over DOM elements you enjoyed in v2 then you will be able to find most of them for v3 managing markers and layers etc - but these are things you will need to write yourself. One of the best aspects of Gmaps v3 is its support for KML and geoRSS. I was aware of KML in v2 of course, but if you are serving up a lot of map points and associated data, then you really should be at least testing out what can be achieved with KML now. In short the KML file allows you to make a kind of template which includes declarations for ...- the icon to be used
- the bubble-text (think "InfoWindow")
.... and bundle that along with all the data that both the marker need and your pop up window needs.
Now, 'scuse my oily-rag explanation for what goes on back in the black-box world of Google maps, but if we were down the pub this is how I'd explain to you what I think is happening. When a map is requested from Google any KML file is bundled off back to Google and munged up with the map tiles and the whole thing is somehow optimised and cleaned up and squirted back to the user depending on their user-agent and screen-size. The output is also cached at their end in case it is requested again shortly afterwards. There is an awful lot going on in that Gmaps black-box so if you are thinking of doing some KML testing let me warn you of a few KML Gotchas.You cannot test by using locally hosted KML files.All KML files must be served from a internet facing server. Localhost or 127.0.0.1 wont hack it. All links will open in a new windowYes, even internal links although there is a claimed jQuery workaround, I cannot get this to work at the moment.All home made icons will be resized No matter what you do your icons wll be resized to 32 x 32 pixels, so produce your .png icon with clear space around it to make up the difference to 32 x 32.KML map icons cannot currently have shadows So build the shadow into your 32 x 32 icon allowance as described above, or live with icons without shadows.You cannot set the zoom level in the KML fileYou might think that was a pretty basic requirement, but you can do it in your scripts very simply, applying a condition on map.getZoom() to map.setMap(map) or map.setMap(null)KML expects reversed lat, lng order
Yeah, maybe like me, you even got your database fields in the correct order of lat then lng so that you never ever get confused any longer about which way round they go, but natively, KML expects then as Lng, lat, Height. Might save you a bit of hair pulling.
Google caches your KML for a period of time
The work-around when testing is to change the url slightly each time by appending a GET argument to the url or use <?php echo time(); ?> to output 'http:// <yourwebsite> /maps/test.kml?123' and so on.All of the above are potential time-sinks and could put you off discovering what is a really great way to bundling off to Google all the data it needs to intelligently package it ready for use by most browsers and mobile devices.
You will be reading the KML spec - mostly you will be studying the sometimes hard to find Gmap supported elements table. OK, so what did I gain by going through this process? Well, lets start with what I saved:I saved about 32k worth of (mostly) minified JS includes, which contained;- ExtInfoWindow library (and 6 graphics files)
- PHP and JS Ajax files
- Icon definition files
- MarkerManager
- A JS Flash sniffer
I lost some control over my map icons, but was able to bundle up and post off to Google all my kml files, with their associated styles and icons and that takes care of the infoWindows too.
What did I gain?- Slicker maps
- a better separation of concerns
- a lot less code to read and maintain
If you need convincing at this point then take a look at this map from the examples on the Gmaps v3 documentation and take a look at the source code. Georss example.
There may seem little to choose from in the trade-off between v2 and v3. I can quite see how you can make your v3 Gmaps applications look and behave just like your old v2 apps using elements of the growing Gmaps support libraries - but that would be kind of missing the point. If you buy into the v3 philosophy then you will will likely look seriously into using KML, and your output - certainly initially - will probably not look as good. It may be an uphill struggle to convince your boss that the extra effort will be worth it - but cite those big 3 reasons I mentioned at the top of this post, no key required, Streetview support without Flash, mobile-device ready might help you. Or pick from the reasons Google show in their Basics intro. Gmaps v3 feels a lot more object orientated a bit more like a good framework in as much as you seek out and add the extra elements you need. Everything seems to extend upon, what Pattern enthusiasts may find the strangely named MVCObject(). In my book MVC is a structural paradigm, and I'd expect to see a ViewObject or even a ControllerObject - but lets not dwell upon that. Coming from the PHP world I am used to world class online documentation, but I found myself thrashing around quite a bit moving between the Gmaps and KML references which are two distinct sets of API docs. The key document you will need is the table which shows the subset of KML which Gmaps v3 currently supports, which is so important I have linked to it twice in this post. Gmaps v3 continues to be built upon, and you may find some of the drawbacks mentioned have since been fixed or improved. I will be watching out for updates from the Google Maps Blog anticipating more KML features being supported by Gmaps v3. There are other fascinating additions to Gmaps such as Fusion Tables offering the option of query-able KML stores, which hold immense promise for those that believe that website content isl increasingly emerging from distributed and shared resources. Overall I found Gmaps v3 is a great improvement and I urge you to join the Gmaps v3 Google Group, subscribe to the daily update and become familiar with the problems that others (like myself) are overcoming.Godalming council gets Street View - a first? - but why?
- javascript turned on
- updated version of flash (9 or greater) plugged in to their browser
- a firewall that does not strip flash or scripting out
- ask councillors to help identify and correct the location of things
- ask the public to move things to the correct location (more on this later)
- ask the public to report problems (but to whom?)
- find things for yourself
- all businesses
- all community places
- Flickr photos
Godalming is on the map.
Yesterday I finally got the "Godalming Town Council map of the area" launched.
http://www.godalming-tc.gov.uk/map/
The issues for non-JS enabled browsers were finally ironed out and tested, but the biggest hold up was getting the geotagged Flickr Group Pool images from Godalming and Farncombe to display correctly on the map, and of course to lead back to the original image on the owners' Flickr account.
Even after half a day it was the 4th most visited page on the site yesterday. I think "navigation by map" will be something that Visitors will probably use more than residents, but who knows.
We have plans to describe more of the town using this map.
Maps are a great way to bring a place to life - to make it somehow seem 'more real' - and of course it is even better if they can be used to draw people into your site.
Beta version of SuperMap
- Roads and points of interest on each road including
- Postboxes
- Recycling points
- Car parks
- Junctions
- Community places
- Businesses
- A-Z
- Search
- Document Search
- Government categories
- Navigate by map
Council web sites fail usability test
- vested interests
- internal squabbles about what goes on the home page
- the strangling of proper news and information by overzealous PR gatekeepers who deem it "unworthy"
- dogged determination to not link to other sites (see the MySilo antipattern)
- crap CMS systems not fit for purpose
- ignorance of the importance of standards, and their place in usability
- design by committee
- lack of interface/programming skills inhouse
- a plethora of "warm bodies'' shunted around end up in the "web department" or being given the job of "updating the website" ('warm bodies' a management antipattern)

