Dec 10, 2010 at 1:04 AM

I'm trying to set the size that a jpg will be displayed in Page_Load. I think this is the ScaledSize property on MarkerImage. This doesn't seem to affect the size of my jpg, it seems to be the native size of the file.

Am I missing something?





here is the relavent code:

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        MarkerImage markerImage = new MarkerImage
                                          ScaledSize = new GoogleSize(5, 5),
                                          Anchor = new GooglePoint(8, 8),
                                          Url = "http://localhost:1431/Images/Site/Person.jpg"
        GoogleMarker marker = new GoogleMarker(38, -77) {Icon = markerImage};



and from the aspx file:


<%@ Register TagPrefix="artem" Namespace="Artem.Google.UI" Assembly="Artem.Google" %>



        <artem:GoogleMap ID="mapControl" runat="server" Width="250px" Height="350px" Key="ABQIAAAAVpgZ2iytmAG8yd5uKP8UgBQjmosEuNnzm3f-Y6na6BN2yhghrxSlR_TfwVojo5QIv_MpteVg6HaYPA    " Latitude="38.8924833632168" Longitude="-77.0343053278883" Zoom="16" IsSensor="False">



Dec 10, 2010 at 6:10 AM

Hi Brian

Here is what GoogleMaps API sais about MarkerImage:

"Defines an image to be used as the icon or shadow for a Marker. 'origin' and 'size' are used to select a segment of a sprite image and 'anchor' overrides the position of the anchor point from its default bottom middle position. The anchor of an image is the pixel to which the system refers in tracking the image's position. By default, the anchor is set to the bottom middle of the image (coordinates width/2, height). So when a marker is placed at a given LatLng, the pixel defined as the anchor is positioned at the specified LatLng. To scale the image, whether sprited or not, set the value of scaledSize to the size of the whole image and set size, origin and anchor in scaled values. The MarkerImage cannot be changed once constructed."

Please note the bolded text part.
If doesn't work, let me know. I will test and fix it before the final release of v5.0


Dec 10, 2010 at 4:54 PM

I can't get Size or ScaledSize to do anything. Origin does work.

Dec 11, 2010 at 4:37 PM


I think I found the problem. GoogleMarker.js -> Artem_Google_Marker$_toImage has two if statements that are wrong. I believe they should be:

 if (state.ScaledSize)
                scaledSize = new google.maps.Size(state.ScaledSize.Width, state.ScaledSize.Height);
if (state.Size)

                size = new google.maps.Size(state.Size.Width, state.Size.Height);


Great work on this!