extracting latitude longitude from geocoding object

112 views
Skip to first unread message

domnic James

unread,
Jan 3, 2011, 12:08:50 PM1/3/11
to Google Maps JavaScript API v3
Hi,
I am trying to extract the latitude longitude from the JSON object
via javascript.. is there any possible way of extracting the
coordinates.. I am able to display the lat ,lng as an alert on the
screen but I need to return it as a string.. here is the code snippet
which works

map.setCenter(results[0].geometry.location);


result =
results[0].geometry.location;
alert(result);

Another question:
for the above example if I were to return a latLng object convert this
object to C#. what kind of class must this be serialized to ?

I am have already created a functional working project using the
webservices directly, but for my purposes at this point in time I need
fetch the coordinates via javascript..


thanks in advance

geoco...@gmail.com

unread,
Jan 3, 2011, 4:20:41 PM1/3/11
to Google Maps JavaScript API v3
On Jan 3, 9:08 am, domnic James <domjb...@gmail.com> wrote:
> Hi,
>   I am trying to extract the latitude longitude from the JSON object
> via javascript.. is there any possible way of extracting the
> coordinates.. I am able to display the lat ,lng as an alert on the
> screen but I need to return it as a string.. here is the code snippet
> which works
>
>  map.setCenter(results[0].geometry.location);
>
>                                                 result =
> results[0].geometry.location;
> alert(result);

Geocoding is asynchronous. The coordinates are available in the
callback function.

>
> Another question:
> for the above example if I were to return a latLng object convert this
> object to C#. what kind of class must this be serialized to ?
>
> I am have already created  a functional  working project using the
> webservices directly, but for my purposes at this point in time I need
> fetch the coordinates via javascript..

Perhaps you can provide a link to that (or better yet, the map that
you are trying to get the coordinates into a string) so we can see
where you are running into trouble.

-- Larry

>
> thanks in advance
Reply all
Reply to author
Forward
0 new messages