Actually, rather than just using the setImage method as you are, what
you're going to want to do is set up a custom GIcon object in your
code and then pass that to the control like this:
var myIcon = new google.maps.Icon(google.maps.LocalSearch.PINS['red']);
myIcon.image = 'images/googleR_0.png';
myIcon.iconSize = new GSize(width_of_your_marker_in_px,
height_of_your_marker_in_px);
var options = {
pins : {
local : [myIcon,myIcon,myIcon,myIcon,myIcon,myIcon,myIcon,myIcon]
}
}
A couple of things that you'll want to notice about this are that
you're actually passing the icon in an array of icons, with one entry
for each of the 8 results that the search may return. This is so you
can customize each marker with a letter or number to coordinate the
icons. You can also do something similar with the labels, passing a
series of graphics that would match your markers. And finally, your
marker will be a clone of the standard red markers, just with your
image and size instead. If your marker is dramatically different, you
may consider basing it off the G_DEFAULT_MARKER or even going
completely from scratch. There are tutorials available online to do
this.
Finally, I should note that this is based on the old version of the
LocalSearch control. The new one may have changed things or even
scrapped this functionality altogether. Unfortunately, since it's
obfuscated, it's very difficult to tell without trying it.
Jeremy R. Geerdes
Effective website design & development
Des Moines, IA
For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
[email protected]
Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.
If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!
And check out my blog, Adventures in Web Development, at
http://jgeerdes.blogspot.com
!
On Nov 20, 2009, at 5:36 PM, Jeff S (Google) wrote:
> Unfortunately I'm not sure about how best to handle dimension changes
> on marker icon, you might have better luck with this question in the
> Google Maps API group: http://groups.google.com/group/Google-Maps-API
>
> Please let me know if you don't hear back in that group.
>
> Thank you,
>
> Jeff
>
> On Nov 18, 2:06 pm, ioustinos <[email protected]> wrote:
>> I have managed to change the image of the markers by doing this in
>> the
>> markersSet function.
>> for(var i=0;i<markers.length;i++){
>> //markers[i].marker.setImage("images/
>> googleR_0.png");
>>
>> }
>>
>> The problem is that the png that i want to use has different
>> dimensions than the default one. How can i change the icon?
>
> --
>
> You received this message because you are subscribed to the Google
> Groups "Google AJAX APIs" group.
> To post to this group, send email to [email protected]
> .
> To unsubscribe from this group, send email to
> [email protected]
> .
> For more options, visit this group at
> http://groups.google.com/group/google-ajax-search-api?hl=
> .
>
>
--
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=.