[Google Maps API v3] Re: Google maps in Drupal

2010-04-13 Thread Macke
That was the trick! When i changed the JQuery to getElementById it
worked.
Thank you all for helping me, i don´t think i ever would have figured
that out.

On 13 Apr, 01:38, William william.g...@gmail.com wrote:
 On Apr 12, 4:52 pm, Macke mar...@ageskog.se wrote:

  Hello William!

  I tried to change the code but i still get the same message. I have
  used the same code on a ordinary .php file that has nothing to do with
  Drupal and then it works.
  If i try running the JQuery $('#map_canvas') after the page is loaded
  nothing gets selected

  $('#map_canvas') is a JQuery object, and $('#map_canvas')[0] is the
 first DOM element matched by the selector (the map_canvas div)

 you are combining 3 different technologies: Google Maps, JQuery and
 Drupal, so maybe try an example with just Google Maps and Drupal
 without any JQuery.

-- 
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: Google maps in Drupal

2010-04-12 Thread Chris Apolzon
I ran into an issue where I couldn't use the jquery selector object to
set the map variable.  I was forced to fall back to
document.getElementById().  It was very odd because jquery had the
correct object, the google maps constructor just didn't like it.

On Apr 12, 2:52 am, Macke mar...@ageskog.se wrote:
 Hello William!

 I tried to change the code but i still get the same message. I have
 used the same code on a ordinary .php file that has nothing to do with
 Drupal and then it works.
 If i try running the JQuery $('#map_canvas') after the page is loaded
 nothing gets selected if i change the code to  $('div#map_canvas') on
 object get selected. But i still get the same error message when the $
 ('div#map_canvas') is used.

 On 11 Apr, 09:21, William william.g...@gmail.com wrote:



  On Apr 10, 8:32 pm, Macke mar...@ageskog.se wrote:

     map =  new google.maps.Map(('#map_canvas'), mapOptions);

  the error is using the jquery # selector without a reference to
  jquery.

  If you really want to use jquery for this, it would be:

  map =  new google.maps.Map($('#map_canvas')[0], mapOptions);

  or instead use the usual getElementById function:

  map =  new google.maps.Map(document.getElementById('map_canvas'),
  mapOptions);

-- 
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.



Re: [Google Maps API v3] Re: Google maps in Drupal

2010-04-12 Thread Jason Sanford
I think the jQuery selector always returns the jQuery object which the
Google Maps API doesn't really know what to do with.

This might be helpful.
http://stackoverflow.com/questions/939036/using-jquery-selectors-within-google-map-does-not-work

On Mon, Apr 12, 2010 at 11:18 AM, Chris Apolzon apol...@gmail.com wrote:

 I ran into an issue where I couldn't use the jquery selector object to
 set the map variable.  I was forced to fall back to
 document.getElementById().  It was very odd because jquery had the
 correct object, the google maps constructor just didn't like it.

 On Apr 12, 2:52 am, Macke mar...@ageskog.se wrote:
  Hello William!
 
  I tried to change the code but i still get the same message. I have
  used the same code on a ordinary .php file that has nothing to do with
  Drupal and then it works.
  If i try running the JQuery $('#map_canvas') after the page is loaded
  nothing gets selected if i change the code to  $('div#map_canvas') on
  object get selected. But i still get the same error message when the $
  ('div#map_canvas') is used.
 
  On 11 Apr, 09:21, William william.g...@gmail.com wrote:
 
 
 
   On Apr 10, 8:32 pm, Macke mar...@ageskog.se wrote:
 
  map =  new google.maps.Map(('#map_canvas'), mapOptions);
 
   the error is using the jquery # selector without a reference to
   jquery.
 
   If you really want to use jquery for this, it would be:
 
   map =  new google.maps.Map($('#map_canvas')[0], mapOptions);
 
   or instead use the usual getElementById function:
 
   map =  new google.maps.Map(document.getElementById('map_canvas'),
   mapOptions);

 --
 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.comgoogle-maps-js-api-v3%2bunsubscr...@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] Re: Google maps in Drupal

2010-04-10 Thread Macke
Unfortunatly i can't, i am running the site on a localhost. But i can
paste the code of what i have done.
I have the following pice of code in a .js file that i have included
in my theme:

-
var map;
var markersArray = [];

function initialize() {
  var haightAshbury = new google.maps.LatLng(37.7699298,
-122.4469157);
  var mapOptions = {
zoom: 12,
center: haightAshbury,
mapTypeId: google.maps.MapTypeId.TERRAIN
  };
  map =  new google.maps.Map(('#map_canvas'), mapOptions);

  google.maps.event.addListener(map, 'click', function(event) {
addMarker(event.latLng);
  });
}
$(document).ready(initialize);
---
My .module file that is suppose to contain the map looks like this:
---
?php
function gooMaps_block($op = 'list', $delta=0, $edit=array()) {
$print_id_tag = TRUE;
if($op==list) {
$block = array();
$block[0][info] = t(gooMaps);
$block[1][status] = TRUE;
$block[2][visibility] = 1;
return $block;
}
else if($op==view){
drupal_set_html_head('meta name=viewport content=initial-
scale=1.0, user-scalable=no /
 script type=text/
javascript src=http://maps.google.com/maps/api/js?sensor=false;/
script
');
$block = array();
$block['subject'] = t('Map');
$block['content'] = div style=\width:600px; 
height:800px\div
id=\map_canvas\ style=\width:100%; height:100%\/div/div;

return $block;
}

}
-
I hope this can make things a bit clearer. I am greatful for all help
i can get.

Sincerely,
Markus



On 9 Apr, 20:49, Luke Mahé lu...@google.com wrote:
 Would you be able to supply a link to your example?

 Thanks
 Luke



 On Fri, Apr 9, 2010 at 10:56 AM, Macke mar...@ageskog.se wrote:
  Hello!

  I have been trying to create a module in Drupal that can show a google
  map but i can't get it to work. I get the following error message:

  uncaught exception: [Exception... Could not convert JavaScript
  argument arg 0 [nsIDOMViewCSS.getComputedStyle] nsresult: 0x80570009
  (NS_ERROR_XPC_BAD_CONVERT_JS) location: JS frame ::
 http://maps.gstatic.com/intl/sv_se/mapfiles/api-3/0/36/main.js::
  nj :: line 33 data: no]

  I would appreciate some help with this, i have no idea what the
  problem is.

  --
  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.comgoogle-maps-js-api-v3%2b­unsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-maps-js-api-v3?hl=en.- Dölj citerad 
 text -

 - Visa citerad text -

-- 
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.