Reading Latitude/Longitude values !!!

Apr 30, 2009 at 10:02 PM

Hi Velio :

Thanks for your email.

Just installed 4.0 & started to dig into it. I know this was not possible in 3.5.

How doI read the Latitude & Longitude values after creating a new marker in 4.0 ?

Code Snippet:

GoogleMap1.Markers.Add(new GoogleMarker(address));

<o:p> Can you provide me with a Sample/code snippet to accomplishthis?</o:p>

Thanks

Bruce

Coordinator
May 1, 2009 at 12:13 PM
Hi,

I found bugs in the JS code for firing the marker, polygon and polyline events.
I'm working on that now and will soon issue a fix of release 4.0.
Then I will publish a sample of how you can achieve that.

Regards
Coordinator
May 1, 2009 at 5:16 PM
Edited May 1, 2009 at 5:18 PM
Hi,

First you have to get the new revision of GoogleMap Control 4.0.1 - just download the new files and build I have uploaded there.

Then only you have to do is add handler for the markers' event GeoLocationLoaded, as fallowing:

<artem:GoogleMap ID="GoogleMap1" runat="server" Latitude="42.1229" Longitude="24.7879"

    EnableScrollWheelZoom="true" OnClick="HandleAny">

    <MarkerEvents OnGeoLocationLoaded="HandleAny"/>

</artem:GoogleMap>


Here is an example of the server-side event handler:

protected void HandleAny(object sender, GoogleEventArgs e) {

 

    GoogleMarker marker = sender as GoogleMarker;

    if (marker != null) {

        double lat = marker.Latitude;

        double lng = marker.Longitude;

        // TODO process the lat/lng of the marker

    }

}


From that on, you will receive that server-side event for every marker added.
As you can see, the sender of the event is the actual marker which location was resolved.

Hope this helps

Regards
Jun 21, 2010 at 3:15 PM
Edited Jun 22, 2010 at 8:35 AM
Hello,
I got the same problem - i create my markers like brucedhara with a given adress.
but the event handler won't work on my project. the event doesn't even fire to the method "handleany"
here is what i got:

<artem:GoogleMap runat="server" ID="GoogleMap1" Key=removed; Address="Informing AG, Sumpfstr. 32, 6300 Zug" Width="550px" Height="450px" Zoom="4" DefaultMapView="Hybrid" BorderStyle="Dashed" BorderColor="LightGreen" BorderWidth="2" EnableScrollWheelZoom="true" OnClientDragEnd="getCoordiantes" OnClick="HandleAny"> <MarkerEvents OnGeoLocationLoaded="HandleAny"/> <Directions> <artem:GoogleDirection RoutePanelId="map_route" /> </Directions> </artem:GoogleMap>

and the event handler is the code which is posted above.

anybody knows how to get this to work?
thanks for any advice

regards,
greenlion
Oct 6, 2010 at 11:24 AM

I tried to use the above method too and it seems that the methods is never called... Suggestions??

 

Regards

May 4, 2011 at 11:25 PM

Hello,

When i try to implement the above I get the error

 

Object of type 'System.EventArgs' cannot be converted to type 'Artem.Web.UI.Controls.GoogleEventArgs'.

any ideas?

 

L