javascript - Custom Google Marker not visible on Google Map API V3 -
i have add multiple markers place on google maps api according sql data returned returned me.the code works fine debugged , adding marker map not visible. not showing error in firebug nor @ console of back-end (asp.net). please me out frustrating me crazy.
function initialize() { var mapoptions = { zoom: 16, center: new google.maps.latlng(30.658354982307571, -96.396270512761134), disabledefaultui: false, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid('map_canvas'), mapoptions); init_publicmap(); var iconbase = '/webcontent/images/iconsbase/'; var iconhoneybees = { url: iconbase + "honeybeesicon.jpg", // url scaledsize: new google.maps.size(35, 40), // scaled size origin: new google.maps.point(0, 0), // origin anchor: new google.maps.point(0, 0) // anchor }; var iconfruitnuts = { url: iconbase + "fruits&nuts.jpeg", // url scaledsize: new google.maps.size(35, 40), // scaled size origin: new google.maps.point(0, 0), // origin anchor: new google.maps.point(0, 0) // anchor }; var iconforagegrass = { url: iconbase + "forage_grass.jpg", // url scaledsize: new google.maps.size(35, 40), // scaled size origin: new google.maps.point(0, 0), // origin anchor: new google.maps.point(0, 0) // anchor }; var iconfieldcrops = { url: iconbase + "fieldcrops.png", // url scaledsize: new google.maps.size(35, 40), // scaled size origin: new google.maps.point(0, 0), // origin anchor: new google.maps.point(0, 0) // anchor }; var iconnurserygreen = { url: iconbase + "nursery_greenhouse.jpg", // url scaledsize: new google.maps.size(35, 40), // scaled size origin: new google.maps.point(0, 0), // origin anchor: new google.maps.point(0, 0) // anchor }; var iconvegetable = { url: iconbase + "vegetable.png", // url scaledsize: new google.maps.size(35, 40), // scaled size origin: new google.maps.point(0, 0), // origin anchor: new google.maps.point(0, 0) // anchor }; var icons = { "vegetables": { icon: iconvegetable }, "greenhouse , nursery": { icon: iconnurserygreen }, "field crops": { icon: iconfieldcrops }, "fruits , nuts": { icon: iconforagegrass }, "forage, grassland": { icon: iconfruitnuts }, "honeybees": { icon: iconhoneybees } }; function addmarker(feature) { var marker = new google.maps.marker({ position: feature.pos, icon: icons[feature.type].icon, map: map }); return marker; } //createpolygons(map); function init_publicmap() { pagemethods.queryproducers("all", "all", queryproducers_success, fail); } function customfeature(lat, long, type) { this.type = type; this.pos = new google.maps.latlng(lat, long); } function queryproducers_success(val) { var featuresloc = json.parse(val[1]); var infowindow = new google.maps.infowindow(); (var = 0; < featuresloc.length; i++) { var customfeatureloc = new customfeature(); customfeatureloc.type = featuresloc[i].croptype; customfeatureloc.pos = new google.maps.latlng(featuresloc[i].lat, featuresloc[i].long); var marker = addmarker(customfeatureloc, map); google.maps.event.addlistener(marker, 'click', (function(marker, i) { return function() { infowindow.setcontent(featuresloc[i].cropname); infowindow.open(map, marker); } })(marker, i)); } } function fail(val) { } }
please let me know going wrong..!!
Comments
Post a Comment