Is it possible to programmatically generate markers in Google? For example, I have a database of services and locations that I want to plot on a Google Map using PHP.
Using the Maps API v3, I have created a map and plotted the services fine using markers and info windows, but what I really want to do is generate numbers (1,2,3,4... etc.) in the default marker bubbles based on the order they get retrieved from the DB. Also, I'd like to change the colour of the marker icon programmatically based on the service type in the database.
I'm using PHP, so don't know if there's a script to do this, but I had hoped that Google would provide this custom marker generation through the API.
The Maps API requires that you use an image (rather than arbitrary DIV) to display markers, so you would need to render the images server side.
A simple way to do this is to use the Google Charts API to render marker icons: http://code.google.com/apis/chart/docs/gallery/dynamic_icons.html#pins
Example output:
Generated with: https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=C|FF0000|000000
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