StreetViewService many requests to make

9 views
Skip to first unread message

Martin

unread,
Sep 25, 2010, 5:26:26 AM9/25/10
to Google Maps JavaScript API v3
Hi.

I have a simple question regarding using StreetViewService() to obtain
the nearest streetview to a location.

I have made some panoramas of the local area and am hoping to add them
to a map as custom streetviews.
For test purposes i have just four panoramas to add to my map but once
the code is working i expect to have between 100 and 150.

So each time my map is loaded it will need to get the nearest
streetview to each of my panoramas and i'm wondering what limits/
restrictions there are with the StreetViewService().

Can i simply create an instance of StreetViewService() for each
panorama when i create a normal map marker and wait for the callback
to execute and add the panorama to the streetview?

Or would it be best to create a single instance of StreetViewService()
and once i have created all my map markers, then to iterate through
them sending a getPanoramaByLocation() request one at a time. Waiting
for each request to complete before making another request?

Given that a streetview panorama ID is guaranteed to be valid only for
the current browser session, my map could become very slow to
initialise. Each custom streetview not being available until the
getPanoramaByLocation() request has completed.
I cannot cache ID of nearest streetview for future session, so it
looks to me as if my map will have to make many requests - is this
correct?

Thanks.

Martin.
Reply all
Reply to author
Forward
0 new messages