[Google Maps API v3] Re: How to drag a google map marker onto a google map
Hey just found this post http://groups.google.com/group/google-maps-js-api-v3/browse_frm/thread/ee85aeb374f961cc/8183c71aa94aba40?lnk=gst&q=drag+marker#8183c71aa94aba40 There is a comment that links to exactly what I was looking for. Hope this helps someone. On Jun 26, 3:42 pm, The Net Duck wrote: > Hi, > > I saw a tutorial on this a long time ago but can't seem to find it. I > would like to have a box (maybe a div) with a google mapmarkerthat Idraginto > a google map. Thismarkershould be draggable in the google > map. > > How can I do this? Is there a tutorial for something like this > somewhere? -- 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] How to drag a google map marker onto a google map
Hi, I saw a tutorial on this a long time ago but can't seem to find it. I would like to have a box (maybe a div) with a google map marker that I drag into a google map. This marker should be draggable in the google map. How can I do this? Is there a tutorial for something like this somewhere? -- 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] How do you select an Icon?
Hi, I have many icons on a map, as well as my user can right click to add another icon to the map that is draggable. I'm trying to create a way for my user to select a location on a map to use for their post. I wanted them to be able to click on an icon and that icons color would change signifying it was selected. Is there a method that has "select true" or something like this for a google map? Also what might be a good way to allow them to select a location. Right clicking seemed in constant because it doesn't work the same with with firefox on a mac. Thanks - The Net Duck -- 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: How can I search for a city so I can zoom to it?
Thank you so much! this was just what I was looking for ;) - The Net Duck On Sep 21, 3:43 pm, Luke Mahé wrote: > Hello Mr Duck :) > > You will want to have a look at the Geocoding service > -http://code.google.com/apis/maps/documentation/javascript/services.ht... > > Here is an example of similar to what you > want:http://code.google.com/apis/maps/documentation/javascript/examples/ge... > > -- Luke > > On Wed, Sep 22, 2010 at 7:34 AM, The Net Duck wrote: > > > > > I have an application that needs users to be able to zoom to a city or > > state they are looking for. Or better yet, a complete address (kind of > > like google maps regular site would be perfect actually). I was > > wondering how I could incorporate these things into my site. > > > This is even possible? > > > Thanks > > > -- > > 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...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-maps-js-api-v3+unsubscr...@googlegroups.com > unsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-maps-js-api-v3?hl=en. -- 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...@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] How can I search for a city so I can zoom to it?
I have an application that needs users to be able to zoom to a city or state they are looking for. Or better yet, a complete address (kind of like google maps regular site would be perfect actually). I was wondering how I could incorporate these things into my site. This is even possible? Thanks -- 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...@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] Geolocation within a Bounds
Hi I would like to geolocate all the addresses within a bounds. For instance I would like to select an area on the map and have the map return to me all of the address within those bounds. Is this possible? Can I do this with only one geolocation request? Thanks - The Net Duck -- 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...@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] Info windows don't zoom properly on a mobile device
HI I'm using v3 and I have info windows that I would like to pop up on my when my user clicks on a marker. I have that working just fine and I'm using the panTo() method to center the marker on the map when it's clicked. The problem is, it works on a desktop computer but when I go to a mobile device it will pan to the center then move back to it's original place! Has anyone run into this? or is this some bad code I've somehow written. What throws me off is it's inconsistency. It works on a desktop but not on a mobile device. Many thanks The Net Duck -- 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...@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] Using MarkerClusterer seems to not work, what could be going wrong?
Hi, I need to cluster markers together for POI(Points Of Interest) on one of my routes that has a lot of POI. I saw the example on google maps v3 page => http://code.google.com/apis/maps/documentation/v3/demogallery.html It's the one called "MarkerClusterer". I thought this was great so I downloaded the markerclusterer.js file into my javascript folder (I'm developing with Ruby on Rails). I have a js file called "marker_map.js" that uses this. Here is what's in that file. The first post is just want I think you need to see, the second is my whole marker_map.js file http://pastebin.com/5hNbzAZU and everything http://pastebin.com/EH7sNe0Y It's frustrating because I get 0 javascript errors in firebug but no markers are visible! What's going on? Do I need to change the image that is being used or something? that's all I could think of but maybe i'm making a mistake. Any help is really welcome i'm kind of in a pickle. Thanks! - The Net Duck -- 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...@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: How can I set the zoom level based on distance?
Wow thanks this was really helpful! On Apr 22, 8:03 pm, Esa wrote: > You can use Circle() as a helper to avoid maths. > > Create an instance of Circle() with 25 miles radius. > > var circle = new Circle({radius: 40234, center: thePoint}); > > Center and zoom the map to the bounds of the circle. > > map.fitBounds(circle.getBounds()); > > -- > 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...@googlegroups.com. > To unsubscribe from this group, send email to > google-maps-js-api-v3+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/google-maps-js-api-v3?hl=en. -- 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...@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] How can I set the zoom level based on distance?
HI I'm trying to zoom my map in our out based on the distance my users set. For instance, a user might say they want to see a map with objects around them at 50 miles or maybe 20 miles etc. I want the google map to only zoom out to 25 miles from their given point. I have their given point but I don't know how to manipulate the zoom level in such a way that they only see X distance from their current point. Thanks! - The Net Duck -- 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...@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] What makes google maps load faster?
Hi, I am creating a google maps application for a hand held device and am trying to optimize performance. I was wondering where does the real "cost" ( cost being load time) come in? Is it more so the coordinates that are being transferred via JSON to my device or drawing the polylines to connects the dots? I know both come into play but what is more expensive as far as load time goes. Thanks The Net Duck -- 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...@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: Is there a way to thin out a poly array with google maps api?
Also, I hope this doesn't sound like I want your code but, is your polycluster.js file opensource? I would love to use it ;) If not, I understand. - The Net Duck On Apr 3, 6:44 am, bratliff wrote: > On Apr 3, 12:07 am, The Net Duck wrote: > > > > > > > HI > > I would like to be able to do two things and I don't know if it's > > possible with google maps api or if I need to build something myself. > > > thing 1) > > I would like to be able to "thin out" coordinates on a poly line > > based on zoom level. This is because I don't need the amount of detail > > when I'm zoomed out and am serving this as a mobile friendly site so > > would like to use as little processes as possible. > > > thing 2) > > I have many different polylines (I call them routes), and would > > like to only draw a polyline based on my maps "bounds". Is there a way > > to only draw a line this way? or is this something that I need to do > > by checking the coords that go into the creation of my polylines > > agents some "bounds" objects etc. > > > Thanks so much! > > - The Net Duck > > PolyCluster uses the following to perform point reduction: > > x=l.x[i+1]-l.x[i-1]; > y=l.y[i+1]-l.y[i-1]; > > z=x*(l.y[i]-l.y[i+1]+l.y[i]-l.y[i-1])-y*(l.x[i]-l.x[i+1]+l.x[i]- > l.x[i-1]); > > z=(z*z)/(x*x+y*y); > > where "z" is the square of the number of pixels away from the > "interpolation" line connecting the two immediate neighbors. You can > discard points for which "z" is less than the square of some > threshold. By using pixels rather than Lat/Lon coordinates, > projection distortion is avoided. The X & Y deltas are given the same > weight. > > It is much quicker than Douglas-Peucker because it is non-recursive. > It can be done in a single pass. It is symmetric which means it > discards the same points in either direction. If two polys share a > common boundary, it will not produce gaps and/or overlaps. Douglas- > Peucker was designed for polylines but not for polygons. > > You can see several demos at: > > http://www.polyarc.us > > An improved "US Highways" demo will be available soon. -- 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...@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: Is there a way to thin out a poly array with google maps api?
Wow thanks Bratillf, did you come up with that? That's really amazing. You mentioned pixels, in this equation are the X and Y's still just lat and lng coords? Ben, The routes are for Byways.org I they aren't always consistent with google maps routes. The Net Duck On Apr 3, 6:44 am, bratliff wrote: > On Apr 3, 12:07 am, The Net Duck wrote: > > > > > > > HI > > I would like to be able to do two things and I don't know if it's > > possible with google maps api or if I need to build something myself. > > > thing 1) > > I would like to be able to "thin out" coordinates on a poly line > > based on zoom level. This is because I don't need the amount of detail > > when I'm zoomed out and am serving this as a mobile friendly site so > > would like to use as little processes as possible. > > > thing 2) > > I have many different polylines (I call them routes), and would > > like to only draw a polyline based on my maps "bounds". Is there a way > > to only draw a line this way? or is this something that I need to do > > by checking the coords that go into the creation of my polylines > > agents some "bounds" objects etc. > > > Thanks so much! > > - The Net Duck > > PolyCluster uses the following to perform point reduction: > > x=l.x[i+1]-l.x[i-1]; > y=l.y[i+1]-l.y[i-1]; > > z=x*(l.y[i]-l.y[i+1]+l.y[i]-l.y[i-1])-y*(l.x[i]-l.x[i+1]+l.x[i]- > l.x[i-1]); > > z=(z*z)/(x*x+y*y); > > where "z" is the square of the number of pixels away from the > "interpolation" line connecting the two immediate neighbors. You can > discard points for which "z" is less than the square of some > threshold. By using pixels rather than Lat/Lon coordinates, > projection distortion is avoided. The X & Y deltas are given the same > weight. > > It is much quicker than Douglas-Peucker because it is non-recursive. > It can be done in a single pass. It is symmetric which means it > discards the same points in either direction. If two polys share a > common boundary, it will not produce gaps and/or overlaps. Douglas- > Peucker was designed for polylines but not for polygons. > > You can see several demos at: > > http://www.polyarc.us > > An improved "US Highways" demo will be available soon. -- 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...@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: Is there a way to thin out a poly array with google maps api?
Wow Ben thanks for the help, Well I have observed this one my local machine. I am doing road routes by converting them from GeoRuby objects to json then creating polyline objects out of them. I have some routes that go from St. Louis to california so that is a lot of different coordinates that has to get passed so I'm trying to thin it down before it gets drawn. Are you saying that this automatically happens? Or is this something I need to implement. - The Net Duck On Apr 2, 7:31 pm, Ben Appleton wrote: > You can simplify polylines using the Ramer-Douglas-Peucker algorithm, which > discards vertices that are not needed for your zoom level. The API does > this in the server for driving directions, and in the browser for other > polylines. > > For efficiency the API will not draw offscreen polylines. > > Are you generally concerned about latency or have you observed slow > performance on a mobile? > > Ben > > On 3 Apr 2010 10:07, "The Net Duck" wrote: > > HI > I would like to be able to do two things and I don't know if it's > possible with google maps api or if I need to build something myself. > > thing 1) > I would like to be able to "thin out" coordinates on a poly line > based on zoom level. This is because I don't need the amount of detail > when I'm zoomed out and am serving this as a mobile friendly site so > would like to use as little processes as possible. > > thing 2) > I have many different polylines (I call them routes), and would > like to only draw a polyline based on my maps "bounds". Is there a way > to only draw a line this way? or is this something that I need to do > by checking the coords that go into the creation of my polylines > agents some "bounds" objects etc. > > Thanks so much! > - The Net Duck > > -- > 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...@googlegroups.com. > To unsubscribe from this group, send email to > google-maps-js-api-v3+unsubscr...@googlegroups.com unsubscr...@googlegroups.com> > . > For more options, visit this group > athttp://groups.google.com/group/google-maps-js-api-v3?hl=en. -- 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...@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] Is there a way to thin out a poly array with google maps api?
HI I would like to be able to do two things and I don't know if it's possible with google maps api or if I need to build something myself. thing 1) I would like to be able to "thin out" coordinates on a poly line based on zoom level. This is because I don't need the amount of detail when I'm zoomed out and am serving this as a mobile friendly site so would like to use as little processes as possible. thing 2) I have many different polylines (I call them routes), and would like to only draw a polyline based on my maps "bounds". Is there a way to only draw a line this way? or is this something that I need to do by checking the coords that go into the creation of my polylines agents some "bounds" objects etc. Thanks so much! - The Net Duck -- 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...@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: Too much recursion when setting bounds for my google map
Fixed the problem. sorry for the waste of time. Apparently I was treating some of the incoming data as a 2D array when it was a 3D array. On Apr 1, 3:51 pm, The Net Duck wrote: > Also, when I don't call "size_map()" it doesn't have the recursion > error. but it does't size my map. > > On Apr 1, 3:48 pm, The Net Duck wrote: > > > Hi > > I have a array of latlng objects that I run through and extend bounds > > so that these paths always show up on the map ie the map resizes to > > fit the lines. When I do this I get a "too much recursion" error in > > firebug. I was wondering how I could fix this? > > > Here is the code. > > document.observe('dom:loaded', function() { > > // this stuff gets executed on the body's on on load time}); > > > // lat, lng is the center point of the map when starting > > function initialize_map(lat, lng) > > { > > // in the form ... (lat, lng) > > var latlng = new google.maps.LatLng(lat, lng); > > var myOptions = { > > zoom: 8, > > center: latlng, > > mapTypeControl: true, > > mapTypeControlOptions: {style: > > google.maps.MapTypeControlStyle.DROPDOWN_MENU}, > > navigationControl: true, > > navigationControlOptions: {style: > > google.maps.NavigationControlStyle.ANDROID}, > > mapTypeId: google.maps.MapTypeId.ROADMAP > > }; > > > // Global Variables > > window.map = new > > google.maps.Map(document.getElementById("map_canvas"), myOptions); > > window.bounds = new google.maps.LatLngBounds();} > > > // this creates a new marker given the info. > > // icon_type is either; > > // amer > > // other > > // user > > // Be aware that if you change the icon_file_name you need ot make > > sure to account for that in this code. > > function place_marker(icon_type, description, lat, lng) > > { > > // create the marker > > var image = "../images/" + icon_type + "_icon.png"; > > var latlng = new google.maps.LatLng(lat, lng); > > var marker = new google.maps.Marker({ > > position: latlng, > > map: map, > > title:description, > > clickable: true, > > icon:image > > }); > > > // create the info window when clicked on. > > var info_window = new google.maps.InfoWindow({ > > content: description > > }); > > > google.maps.event.addListener(marker, 'click', function() { > > info_window.open(map,marker); > > }); > > > } > > > function draw_route(route, color) > > { > > if (route.type == "LineString"){ > > create_polyline(route.coordinates, color).setMap(map); > > } > > else if (route.type == "MultiLineString"){ > > route.coordinates.each(function(line){ > > create_polyline(line, color).setMap(map); > > }); > > } > > > set_map_bounds(route.coordinates); > > > } > > > function create_polyline(coordinates, color) > > { > > // Building the path for the polyline > > var line_path = build_line_path(coordinates); > > // Building the polyline > > var byways_route = new google.maps.Polyline({ > > path: line_path, > > strokeColor: color, > > strokeOpacity: 1.0, > > strokeWeight: 2 > > }); > > > return byways_route; > > > } > > > function set_map_bounds(coordinates) > > { > > var line_path = build_line_path(coordinates); > > > // extends the bounds checking each coord in line path > > for (var i = 0; i < line_path.length; i+=1){ > > bounds.extend(line_path[i]); > > } > > > } > > > function build_line_path(coordinates) > > { > > var line_path = coordinates.map(function(coord){ > > return new google.maps.LatLng(coord[1], coord[0]); > > }); > > > return line_path; > > > } > > > function size_map() > > { > > map.fitBounds(bounds); > > > } > > > Please be aware that "draw_route" gets called many times by my Rails > > view page and the incoming "route" contains a Json array of lat / lng > > coords that are accessed with the "coordinates" call > > > Thank you ! > > > - The Net Duck -- 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...@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: Too much recursion when setting bounds for my google map
Also, when I don't call "size_map()" it doesn't have the recursion error. but it does't size my map. On Apr 1, 3:48 pm, The Net Duck wrote: > Hi > I have a array of latlng objects that I run through and extend bounds > so that these paths always show up on the map ie the map resizes to > fit the lines. When I do this I get a "too much recursion" error in > firebug. I was wondering how I could fix this? > > Here is the code. > document.observe('dom:loaded', function() { > // this stuff gets executed on the body's on on load time}); > > // lat, lng is the center point of the map when starting > function initialize_map(lat, lng) > { > // in the form ... (lat, lng) > var latlng = new google.maps.LatLng(lat, lng); > var myOptions = { > zoom: 8, > center: latlng, > mapTypeControl: true, > mapTypeControlOptions: {style: > google.maps.MapTypeControlStyle.DROPDOWN_MENU}, > navigationControl: true, > navigationControlOptions: {style: > google.maps.NavigationControlStyle.ANDROID}, > mapTypeId: google.maps.MapTypeId.ROADMAP > }; > > // Global Variables > window.map = new > google.maps.Map(document.getElementById("map_canvas"), myOptions); > window.bounds = new google.maps.LatLngBounds();} > > // this creates a new marker given the info. > // icon_type is either; > // amer > // other > // user > // Be aware that if you change the icon_file_name you need ot make > sure to account for that in this code. > function place_marker(icon_type, description, lat, lng) > { > // create the marker > var image = "../images/" + icon_type + "_icon.png"; > var latlng = new google.maps.LatLng(lat, lng); > var marker = new google.maps.Marker({ > position: latlng, > map: map, > title:description, > clickable: true, > icon:image > }); > > // create the info window when clicked on. > var info_window = new google.maps.InfoWindow({ > content: description > }); > > google.maps.event.addListener(marker, 'click', function() { > info_window.open(map,marker); > }); > > } > > function draw_route(route, color) > { > if (route.type == "LineString"){ > create_polyline(route.coordinates, color).setMap(map); > } > else if (route.type == "MultiLineString"){ > route.coordinates.each(function(line){ > create_polyline(line, color).setMap(map); > }); > } > > set_map_bounds(route.coordinates); > > } > > function create_polyline(coordinates, color) > { > // Building the path for the polyline > var line_path = build_line_path(coordinates); > // Building the polyline > var byways_route = new google.maps.Polyline({ > path: line_path, > strokeColor: color, > strokeOpacity: 1.0, > strokeWeight: 2 > }); > > return byways_route; > > } > > function set_map_bounds(coordinates) > { > var line_path = build_line_path(coordinates); > > // extends the bounds checking each coord in line path > for (var i = 0; i < line_path.length; i+=1){ > bounds.extend(line_path[i]); > } > > } > > function build_line_path(coordinates) > { > var line_path = coordinates.map(function(coord){ > return new google.maps.LatLng(coord[1], coord[0]); > }); > > return line_path; > > } > > function size_map() > { > map.fitBounds(bounds); > > } > > Please be aware that "draw_route" gets called many times by my Rails > view page and the incoming "route" contains a Json array of lat / lng > coords that are accessed with the "coordinates" call > > Thank you ! > > - The Net Duck -- 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...@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] Too much recursion when setting bounds for my google map
Hi I have a array of latlng objects that I run through and extend bounds so that these paths always show up on the map ie the map resizes to fit the lines. When I do this I get a "too much recursion" error in firebug. I was wondering how I could fix this? Here is the code. document.observe('dom:loaded', function() { // this stuff gets executed on the body's on on load time }); // lat, lng is the center point of the map when starting function initialize_map(lat, lng) { // in the form ... (lat, lng) var latlng = new google.maps.LatLng(lat, lng); var myOptions = { zoom: 8, center: latlng, mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.ANDROID}, mapTypeId: google.maps.MapTypeId.ROADMAP }; // Global Variables window.map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); window.bounds = new google.maps.LatLngBounds(); } // this creates a new marker given the info. // icon_type is either; //amer //other //user // Be aware that if you change the icon_file_name you need ot make sure to account for that in this code. function place_marker(icon_type, description, lat, lng) { // create the marker var image = "../images/" + icon_type + "_icon.png"; var latlng = new google.maps.LatLng(lat, lng); var marker = new google.maps.Marker({ position: latlng, map: map, title:description, clickable: true, icon:image }); // create the info window when clicked on. var info_window = new google.maps.InfoWindow({ content: description }); google.maps.event.addListener(marker, 'click', function() { info_window.open(map,marker); }); } function draw_route(route, color) { if (route.type == "LineString"){ create_polyline(route.coordinates, color).setMap(map); } else if (route.type == "MultiLineString"){ route.coordinates.each(function(line){ create_polyline(line, color).setMap(map); }); } set_map_bounds(route.coordinates); } function create_polyline(coordinates, color) { // Building the path for the polyline var line_path = build_line_path(coordinates); // Building the polyline var byways_route = new google.maps.Polyline({ path: line_path, strokeColor: color, strokeOpacity: 1.0, strokeWeight: 2 }); return byways_route; } function set_map_bounds(coordinates) { var line_path = build_line_path(coordinates); // extends the bounds checking each coord in line path for (var i = 0; i < line_path.length; i+=1){ bounds.extend(line_path[i]); } } function build_line_path(coordinates) { var line_path = coordinates.map(function(coord){ return new google.maps.LatLng(coord[1], coord[0]); }); return line_path; } function size_map() { map.fitBounds(bounds); } Please be aware that "draw_route" gets called many times by my Rails view page and the incoming "route" contains a Json array of lat / lng coords that are accessed with the "coordinates" call Thank you ! - The Net Duck -- 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...@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] GeoRuby with google maps v3
Hi I'm using GeoRuby currently and store routes of different roads in the database. I was wondering if there is a solution to taking my line objects and some how drawing them on the google map v3. Each road some times separates so isn't always continuous. Normally I would handle this with a kml file but haven't seen support for v3 yet. Does anyone have a solution for this? I'm dev for a mobile application so wanted to use v3. - The net duck -- 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...@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.