individual image / icon google maps api

I am testing the last days with the google api 3.x.

I have this code for my api with google maps.

this part I changed to get an individual image for all entries:

function makeMarker(options) { var pushPin = new google.maps.Marker({ icon: '/individual-icon-for-all.png', map: map });

I want to use an individual image/icon for each entry. How can I do that?

<script> /** * map */ var mapOpts = { mapTypeId: google.maps.MapTypeId.ROADMAP, scaleControl: true, scrollwheel: false } var map = new google.maps.Map(document.getElementById("map"), mapOpts); // We set zoom and center later by fitBounds() /** * makeMarker() ver 0.2 * creates Marker and InfoWindow on a Map() named 'map' * creates sidebar row in a DIV 'sidebar' * saves marker to markerArray and markerBounds * @param options object for Marker, InfoWindow and SidebarItem * @author Esa 2009 */ var infoWindow = new google.maps.InfoWindow(); var markerBounds = new google.maps.LatLngBounds(); var markerArray = []; function makeMarker(options) { var pushPin = new google.maps.Marker({ icon: '/individual-icon-for-all.png', map: map }); pushPin.setOptions(options); google.maps.event.addListener(pushPin, "click", function() { infoWindow.setOptions(options); infoWindow.open(map, pushPin); if (this.sidebarButton) this.sidebarButton.button.focus(); }); if (options.sidebarItem) { pushPin.sidebarButton = new SidebarItem(pushPin, options); pushPin.sidebarButton.addIn("sidebar"); } markerBounds.extend(options.position); markerArray.push(pushPin); return pushPin; } google.maps.event.addListener(map, "click", function() { infoWindow.close(); }); /** * Creates an sidebar item * @constructor * @author Esa 2009 * @param marker * @param opt ions object Supported properties: sidebarItem, sidebarItemClassName, sidebarItemWidth, */ function SidebarItem(marker, opts){ var tag = opts.sidebarItemType || "button"; var row = document.createElement(tag); row.innerHTML = opts.sidebarItem; row.className = opts.sidebarItemClassName || "sidebar_item"; row.style.display = "block"; row.style.width = opts.sidebarItemWidth || "180px"; row.onclick = function(){ google.maps.event.trigger(marker, 'click'); } row.onmouseover = function(){ google.maps.event.trigger(marker, 'mouseover'); } row.onmouseout = function(){ google.maps.event.trigger(marker, 'mouseout'); } this.button = row; } // adds a sidebar item to a <div> SidebarItem.prototype.addIn = function(block){ if(block && block.nodeType == 1)this.div = block; else this.div = document.getElementById(block) || document.getElementById("sidebar") || document.getElementsByTagName("body")[0]; this.div.appendChild(this.button); } // deletes a sidebar item SidebarItem.prototype.remove = function(){ if(!this.div) return false; this.div.removeChild(this.button); return true; } /** * markers and info window contents */ makeMarker({ position: new google.maps.LatLng(53.086 , 8.978), title: "Blumen", sidebarItem: "Blumen", content: "<p class='partner2'>Blumen</p>", }); /** * fit viewport to markers */ map.fitBounds(markerBounds); </script>

-------------Problems Reply------------

Just include in the options you pass to the function

makeMarker({
position: new google.maps.LatLng(53.086 , 8.978),
icon: '/icon-for-this-marker.png',
title: "Blumen",
sidebarItem: "Blumen",
content: "<p class='partner2'>Blumen</p>",
});

Category:google maps Views:0 Time:2012-03-21

Related post

  • Removing an individual marker from Google Map - API v3 2011-06-18

    I want to remove an individual marker from Google map. I am using version 3 API. I know how I can remove all the markers by maintaining a markerArray and setting map null for all. For removing one by one, I am thinking to make a key value pair combin

  • Google Maps API - Problems with class GLatLngBounds 2008-08-19

    I am having some trouble with the Google Maps API. I have an array which holds a ojbect I created to store points. My array and class: var tPoints = []; function tPoint(name) { var id = name; var points = []; var pointsCount = 0; ... this.getHeadPoin

  • Google Maps API - Finding Waypoint That Caused Error 2009-04-21

    We have been developing an ASP.NET application that works with the Google Maps API to assist in logistics and planning for a small shipping company in our area. One of the features is for the company to input a list of customers and the system will p

  • Is it OK? clearOverlays() in GMap API V2 to Google Maps API V3? 2009-06-04

    I use Google Maps API V3. I migrate My site GMap API V2 -> V3. but coped because I used the clearOverlays() method to delete an existing object at once in the V2 , and it deleted an object in what had been abolished in V3 individually. V2 map.clea

  • Google Maps API v3: InfoWindow not sizing correctly 2009-10-12

    It appears my InfoWindow, when you click on the home icon on my Google Maps v3, is not properly auto-sizing to the content of the InfoWindow. It gives scrollbars when it should not. The InfoWindow should be properly auto-sizing. Any ideas on why? Per

  • Google Maps API Reverse Lookup Address Details Accuracy 2009-10-18

    I am using Google Maps API for reverse lookup of an address, specifically Country, City and ZIP code. The problem I have is that with geocoder when you input a specific lat lng you get a range of results based on the address detail accuracy. For exam

  • Google Maps API (Google Directions) not working for particular location 2009-12-08

    While I m trying to draw a route for multi locations using google Map API, the route not available for some locations so the google maps not returning the map. I got the same result while trying by using the lattitude and longitude. One such location

  • google maps api v2 - dynamic load (tens of thousands of) markers 2010-04-12

    how made with JavaScript+PHP+MYSQL and Google Maps API v2 dynamic load of markers? atm I have map follow example http://googlemapsapi.martinpearman.co.uk/infusions/google_maps_api/basic_page.php?map_id=8 but my marker_data_01.php (where are all marke

  • Whats the API Key for in Google Maps API V3? 2010-05-04

    In the older version of the API, I'd have to insert the javascript into the page using something like this for just basic functionality to work: http://maps.google.com/maps?file=api&v=2&key=GoogleMapsAPIKey Where I had to configure the API ke

  • Google Maps API v3 - How to clear overlays? 2010-06-01

    In Google Maps API v2, I was using map.clearOverlays() to remove the marker and draw them again. How can I do that using Google Maps API v3 ? Thanks --------------Solutions------------- See here for details but you now have to iterate through the mar

  • Google maps api - polygon mouseover 2010-06-01

    I am using google maps API v3 and have created several polygons on the map. I want the functionality that when the user hovers over a given area (polygon) the individual polygon changes color. Is there any way to do this? (Later I'd like to be able t

  • Google maps api,Postgis,Multipolygon 2010-06-24

    Hello all PostGis WKT format of Multipolygon is: MULTIPOLYGON( ((20.229 39.409,20.2241 39.401,20.220 39.410,20.229 39.409)), ((20.209 39.407,20.223 39.400,20.211 39.402,20.209 39.4076)) ) Google Maps api v3 Polygon is: var triangleCoords = [ new goog

  • Google Maps API Marker Images not showing in Internet Explorer 2010-08-13

    I'm using Google Maps API Javascript V3 and I have a problem where in Internet explorer, my marker images aren't appearing but according to Adobe Browserlab, other browsers have no problem. The coordinates are being read from a div called "hidden". H

  • How to use google maps api to add markers based on certain conditions 2011-02-21

    Hey, Can someone help me with developing the following requirements? I have a database that contains parking lot information. For easy interpretation assume that each parking lot has two attributes called id and address. Through a spring controller I

  • Is it possible to query a MySQL database using the results from map.getBounds() with Google Maps API v3? 2011-03-13

    I have a MySQL database that contains a large number of polygons, one for each district on a map. They are all quite complicated and it's unrealistic to simply load them all at once. I've looked into using MarkerManager for Google Maps API v3 and thi

  • Save and Delete markers using Google map API V3 2011-03-18

    I got a trouble using GMAP V3, when I realized that I need to save the changes in the map in a database, I found no way to do that. Before start to workaround I would like to listen some ideas firsrt.. and there no better place to do this, the comunn

  • Scaling marker size with marker icons from a sprite in Google Maps API v3 2011-07-25

    I'm playing with the Google Maps API (v3) and I've run into an issue with marker icons. I'm trying to vary the size of my markers depending on their individual data attributes. The icons themselves are in a sprite that contains three different circul

  • How to access overlay argument in Google Maps API v3 2011-07-29

    I have the following code in the Google Maps API javascript v2: mylistener = GEvent.addListener(map2,'click',mapClick); ...... ...... function mapClick(section, clickedPoint){ .... if (section == null)) .... } As you can see, I use the argument secti

  • google maps api multiple markers with info windows 2012-02-02

    just getting my teeth sunk into google maps API. I am attempting to plot a couple of markers on a map. Done. I am however recycling a variable/object for each marker. I initially create marker with options and add to map, then take the same marker va

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.169 (s). 11 q(s)