[Google Maps API v3] Re: Having troubles with path

2011-03-07 Thread Rick Donohoe
Thankyou, thats all sorted!

Another issue I've had is when I first started developing this I put the map 
div inside a table as that was the only way it worked.

I've now removed it from the table, added the 'function detectBrowser() {' 
property inside initialize, and within my style sheet I have:

.html 
{ 
height: 100%;
}

.body 
{
height: 100%; 
margin: 0px; 
padding: 0px;
font-family: Verdana, Geneva, sans-serif;
color:#333;
}

#map_canvas 
{ 
height: 100%; 
} 

So why is my map no longer showing?

(Im not sure if this helps you guys at all, but I thought the section on 
developing for iPhones wasn't very detailed. I've had to guess I added it at 
the top of initialize?!?)

Cheers,

Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-03-05 Thread Rick Donohoe
Did you manage to see anything?

Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-03-05 Thread Rossko
 Did you manage to see anything?

I see the javascript error, don't you?  It would pay to find out how
to use the basic tools your browser provides, while you are
developing.

I get pathArray[i].setMap is not a function in
 pathArray[i].setMap(null);

You have made pathArray[] as an array of arrays of lat/Lng objects.
An array of latLngs is not a polyline object, and won't have the
methods of a polyline object, such as setMap()

I was wrong when I said that loop would work, I assumed pathArray was
an array of polylines and it isn't.  The principle is correct, but of
course you need to give it an array of polylines.

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



[Google Maps API v3] Re: Having troubles with path

2011-03-04 Thread Rossko
 for (i=0; ipathArray.length; i++)
     {
         pathArray[i].setMap(null);                            
     }

That should work.
Don't forget that you need to clear pathArray[] afterwards, else you
will add all the old lines back on to the map again when you add the
new ones.

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



[Google Maps API v3] Re: Having troubles with path

2011-03-04 Thread Rick Donohoe
I want to keep all the lines saved in pathArray, so I don't want to clear it 
at any time.

I just want to distinguish between when to show the poly lines within 
pathArray, and when not to (conditional to their bounds).

Does that make sense Rossko? 

I figured this method would cycle through and remove all overlays withing 
the array, then the method after would cycle through it a second time and 
add any within the bounds back onto the map. The for loop we have discussed 
displays nothing on the map, and the code dosen't reach the second part to 
add the route on the map(which it could reach fine before).

Any other suggestions?

Cheers,

Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-03-04 Thread Rossko
 Any other suggestions?

Show us an example with the behaviour you describe ; the removal code
you are on about is currently commented out at http://www.my-walk.com/index.php

You might like to think about the consequences of using what we could
call sparse arrays, where only some indexes are populated, and what
happens when you iterate through the array with a simple for-loop.
That's not a maps issue, its basic javascript.

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



[Google Maps API v3] Re: Having troubles with path

2011-03-04 Thread Rick Donohoe
Ok so i assume you have seen the behaviour when it is commented out, Ive 
uncommented it and now nothing is shown at all on the map.

You may notice Ive still comented out where I add to the array at numbers 
16, 32, 33, 34 as that was still causing an issue. Annoyingly...

When this is finalised I want the results to show up below the map (which 
are within the map bounds) and I want the user to hover over the results, 
and when they do the poly line is shown on the map, but only whilst they 
hover over. If the user clicks on the results, they are passed to a seperate 
page where the route is properly displayed and the bounds are appropiate to 
the route. (This is working already with the show route links below the 
map).

This of course may be completely irrelevant, but figured I'd share it with 
you if you are offering design decisions/ideas.

Thanks Rossko,

Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-03-04 Thread Rossko
No idea what you've done now, can't view source in the browser here,
but this might help with the previous problem
http://www.google.com/search?q=javascript+iterate+sparse+array

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



[Google Maps API v3] Re: Having troubles with path

2011-03-04 Thread Rick Donohoe
Oh apologies!! Try it now...

Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-03-03 Thread Rick Donohoe
Yeah, just changed it to this and it worked:

var coordinates = ? echo ($row[coordinates]); ?;

:D

The issue I have now is that if the user moves the map (Google Maps 'idle' 
event), the code will draw any routes of which have a center within the 
current bounds. The issue here is if I move the tiniest bit, the routes are 
still within the bounds and it draws them AGAIN.

I obviously need a remove Overlays style method at the beginning of the 
addRoute method, but my current code is not working.

for (i=0; ipathArray.length; i++)
{
poly = new google.maps.Polyline({
path: pathArray[i]
poly.setMap(null);
});
}

Ive also tried:

for (i=0; ipathArray.length; i++)
{
pathArray[i].setMap(null);
}

any ideas guys??

Thank you very much,

Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-03-02 Thread Rossko
I've tried to look at www.my-walk.com/index.php yesterday and today,
it seems to go into an endless loop on my browsers.

 Ive put an alert inside the for loop in the code above, and it is not
 showing. The path error must be because the path only contaisn one
 latlng value.

Last that I could look, no path data was arriving at the browser (do
'view source') this is an issue with your php, not the map.
This (at the browser) doesn't look correct
 var coordinates = '.$row[coordinates].'
'coordinates' is just a string of characters, dollar signs square
brackets and all.

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



[Google Maps API v3] Re: Having troubles with path

2011-03-01 Thread Rick Donohoe

Why does that link go to google 404??

www.my-walk.com/index.php

That should hopefuly be better.
With Larrys help a few days ago I got the paths fine. Below it is
created with path.push(latlng);

?php
$r = mysql_query (SELECT * FROM routes);
while($row = mysql_fetch_assoc($r))
{
?

var coordinates = '.$row[coordinates].'
coordinates = coordinates.replace(/[(]/g, );
coordinates = coordinates.replace(/[)],/g, );
var temp = [];
var temp2 = [];
temp = coordinates.split();
temp2 = temp[0].split(,);
var latlng = new google.maps.LatLng(parseFloat(temp2[0]),
parseFloat(temp2[1]));
var bounds = new google.maps.LatLngBounds();
bounds.extend(latlng);
path.push(latlng);
// -1 gets rid of the last string which is empty space
for (var i = 1; i  temp.length-1; i++)
{
temp2 = temp[i].split(,);
var latlng = new 
google.maps.LatLng(parseFloat(temp2[0]),
parseFloat(temp2[1]));
bounds.extend(latlng);
path.push(latlng);
}

// Ideally want the path added at the location of it's id, 
instead
of using push
//pathArray['.$row[id].'] = path;
boundsArray.push(bounds);
pathArray.push(path);
?php..

each time it goes thorugh this while loop it should finish with an
array 'path' and an array 'bounds'. I want to store these arrays in
another 2 arrays, named boundsArray and pathArray.
At the moment im just pushing them on, but I want to store them by
route['id']. So far there is only 3 routes with ids like 29, 32, 36,
as these are auto increment ones. This means the array will have lots
of blank space. Will this be a problem??

I hope this makes more sense and the map is a better link!!

Thanks,
Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-03-01 Thread Rossko
 Why does that link go to google 404??

It's just the group interface ; it works better with the http prefix.

 At the moment im just pushing them on, but I want to store them by
 route['id']. So far there is only 3 routes with ids like 29, 32, 36,
 as these are auto increment ones. This means the array will have lots
 of blank space. Will this be a problem??

General javascript question, not a maps issue.  Essentially, not a
problem of itself.

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



[Google Maps API v3] Re: Having troubles with path

2011-03-01 Thread Rick Donohoe

Good to hear that wont be an issue.

Ive put an alert inside the for loop in the code above, and it is not
showing. The path error must be because the path only contaisn one
latlng value.

Why isn't it getting inside??

For my addRoutes method (Once map is idle), ive put an alert before
the poly.setMap(map) method, and it alerts 3x, which is the correct
amount of routes.

Am I correct in saying that after pathArray.push(path), I will need to
add path = [], to clear the path array? for each while loop? Would
bounds be the same or does the var bounds = new
google.maps.LatLngBounds() line achieve this already?

Thanks guys,

Rick

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



[Google Maps API v3] Re: Having troubles with path

2011-02-28 Thread Rossko
 Map:www.my-walk.com/index.php

Doesn't seem to be any path data in that page

 Inside the addRoute method I would like some code that says if the
 path is within the bounds of the map, draw its polyline and add it to
 the map.

See the reference
http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds
bounds objects have a method to test for intersection with another
bounds.
Cycle through your candidate polys and test each one.   It's imperfect
and could result in some polys being added that actually remain out of
view, but it will probably serve.

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



[Google Maps API v3] Re: Having troubles with path

2011-02-28 Thread geocode...@gmail.com
On Feb 28, 4:32 pm, Rossko ros...@culzean.clara.co.uk wrote:
  Map:www.my-walk.com/index.php

 Doesn't seem to be any path data in that page

  Inside the addRoute method I would like some code that says if the
  path is within the bounds of the map, draw its polyline and add it to
  the map.

 See the 
 referencehttp://code.google.com/apis/maps/documentation/javascript/reference.h...
 bounds objects have a method to test for intersection with another
 bounds.
 Cycle through your candidate polys and test each one.   It's imperfect
 and could result in some polys being added that actually remain out of
 view, but it will probably serve.

Here are some examples that do that (warning load and parse complex
kml, and not the simplest of examples):
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_us_counties01_highlight.html?lat=33.678198lng=-114.15285124218751zoom=8

(not quite as complex kml):
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linkto.html?filename=VoterDistricts_address.xml

  -- Larry

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