Sunday, January 23, 2011

[Google Maps API v2] Re: passing a geolocated lat,lng to a function that uses a php file

Hi.

If i understand your question then i think you could create a hidden
form field.

Once you have the location (from map 'a') populate the hidden form
field with the formatted lat and lng:

// myLatLng assumed to be a LatLng object that's already defined in
your code

document.forms.myForm.latlng.value=myLatLng.toUrlValue();

A simple form:

<form id="myForm">
<input type="hidden" name="latlng" />
</form>

That'll leave your createxml.php script to parse the POST or GET
latlng value which will be a comma separated string: 'lat,lng'.

http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLng

Martin.


On Jan 23, 2:18 pm, adeibiza <adeib...@gmail.com> wrote:
> here's the thing
>
> a) i have a simple map api that takes user location and puts it on a
> map
> b) i have another map which pulls x amount of markers from mysql
> within a certain radius of a specified lat,long using a php file to
> create the xml eg
>
> at the moment i have to manually put in the lat & lng in a link like
> this:
>
> href="javascript:getMap('createxml.php?
> lat=58.4&lng=5.66&radius=10&icontype=pubs')"
>
> createxml.php is the msql query that forms the marker xml file
>
> getMap is the function that uses: var request = GXmlHttp.create();
> request.open("GET", url, true); and puts the markers on the map
>
> i'm confident i can merge the maps j/script  but i'd like to create a
> form action so that the user can click on options of the radius/
> icontype for example but that the lat & lng is picked up from the var
> lat & lng thats been stored previously and pass it to the
> getMap(createxml.php file
>
> if this makes any sense whatsoever ;) - not sure if this is an api
> question or a javascript/php question or a mixture of both :)

--
You received this message because you are subscribed to the Google Groups "Google Maps API V2" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate