For a number of years now I have been developing a Google Maps plugin for WordPress <end of plug>, I have even created a script to dynamically generate coloured markers with custom text. This is a great solution for hosting your own markers, but is has a lot of overhead, having to host a custom Arial font and requiring the PHP GD library installed. And even then, I still relied on Google to provide the starting coloured marker .
Google does provide an alternative, custom text and colour, but there is one problem, what if I want the classic default Google Map’s marker , the one with the large black dot. Well it isn’t there. And that is where my script, dare I say, exceeded Google.
The trick was adding the large black dot to the font. You know that ugly square box you sometimes see when you don’t have the correct fonts installed , I simply replaced this with the large black dot. Any character codes that aren’t available will simply return the default style marker .
So that’s my implementation, but how do I migrate from my script to Google’s while keeping the default style marker. I had to find an equivalent. All the obvious choices (bullet U+2022, bullet operator U+2219 and black circle U+25CF) didn’t work.
I started sifting through thousands of markers, looking for the closest representation to the default marker. What I found was kangxi radical one U+2F00, now don’t ask me why, but for some reason this produced a black dot style marker , though smaller than the default. This would have to do.
5000+ markers in a 1mb+ png file
5000+ markers in a html page (file name is the unicode)
Note: all above inline marker examples are hosted on Google or generated with my script (view the image name to find out more).
Leave a Reply