Thought this would be easy, but can't figure it out.

36 views
Skip to first unread message

George

unread,
Oct 10, 2011, 11:24:43 PM10/10/11
to google-map...@googlegroups.com
Hi, I just wanted to make a page that got my geolocation and then marked the nearest hotels.  I tried to merge 2 of the samples together (http://code.google.com/apis/maps/documentation/javascript/examples/map-geolocation.html and http://code.google.com/apis/maps/documentation/javascript/examples/place-search.html) but I can't get them to work together on one page.  Is that not possible?  I may just not know enough about javascript to make it work.
 
Anyway, seperately they work fine...but I would like it to do it automatically on one page.  Or how to pass the data from geolocation page to hotel page. Ultimately I want to use this for a mobile device.  Does anyone have a sample or webpage that does this?
 
Please help!

geoco...@gmail.com

unread,
Oct 10, 2011, 11:50:59 PM10/10/11
to Google Maps JavaScript API v3
On Oct 10, 8:24 pm, George <adamlong2...@gmail.com> wrote:
> Hi, I just wanted to make a page that got my geolocation and then marked the
> nearest hotels.  I tried to merge 2 of the samples together (http://code.google.com/apis/maps/documentation/javascript/examples/ma...andhttp://code.google.com/apis/maps/documentation/javascript/examples/pl...)
> but I can't get them to work together on one page.  Is that not possible?

Certainly should be.

> I may just not know enough about javascript to make it work.
>
> Anyway, seperately they work fine...but I would like it to do it
> automatically on one page.  Or how to pass the data from geolocation page to
> hotel page. Ultimately I want to use this for a mobile device.  Does anyone
> have a sample or webpage that does this?
>
> Please help!

Where is the map you created that doesn't work? (link please)
What javascript errors are you getting on it?

-- Larry

davie strachan

unread,
Oct 11, 2011, 5:38:20 AM10/11/11
to Google Maps JavaScript API v3
Hi
are you developing this using localhost??
the localhost IP address is not valid for geolocation
Regards Davie

On Oct 11, 4:50 am, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Oct 10, 8:24 pm, George <adamlong2...@gmail.com> wrote:
>
> > Hi, I just wanted to make a page that got my geolocation and then marked the
> > nearest hotels.  I tried to merge 2 of the samples together (http://code.google.com/apis/maps/documentation/javascript/examples/ma......)

George

unread,
Oct 11, 2011, 11:12:28 AM10/11/11
to google-map...@googlegroups.com

On Tuesday, October 11, 2011 2:38:20 AM UTC-7, davie strachan wrote:
Hi
are you developing this using localhost??
the localhost IP address is not valid for geolocation
Regards Davie

  - Yes, I was using localhost, but it seemed to work fine; it found my location via HTML5 (or at least approximate).  That was close enough for my testing.  I'm having more of problem of then using the variables again (of my location) to set the search location for "hotels" (or any search type).  Like I said before, on thier own the 2 samples I posted work fine...I just can't figure out how to combine them. 
  
 

> Where is the map you created that doesn't work? (link please)
> What javascript errors are you getting on it?
>
>   -- Larry

 
 -- I didn't post the map I created because it didn't work and I didn't want to lead anyone down the wrong direction.  That's more of what I needed since mine didn't work.  I tried everything I could think of and probably about 10 different variations, but never got it to work.  I didn't get any javascript error messages (I'm just using notepad), but the map would either not display anything or only display the geolocation.  It would never add the additional markers for the search locations.  The code I used is from those links though.  Since they worked on thier own, I was just trying to merge them; unsuccessfully. 
Reply all
Reply to author
Forward
0 new messages