Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>geocoder.geocode()</code> requires a <code>LatLng</code> object. Your variable <code>latlng</code> is simply text. You'll need to find a way to convert it to a <code>LatLng</code> object. Most obvious way is probably to parse it with a regex or some other way and pass the lat and lng to <code>new google.maps.LatLng()</code>. There may be a more elegant solution, but that will work.</p> <p>If it helps, here's some quick hacking I did to your code to confirm what I wrote above. I just hardcoded your first pair of coordinates. You'll still need to write something to parse the data.</p> <pre><code>function codeAddress(latlng) { //Whoops, latlng is a string. We need it to be an object. Let's just hardcode one for demo purposes. latlng=new google.maps.LatLng(46.0724339, 13.249490000000037); geocoder.geocode( { 'latLng': latlng}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { var marker = new google.maps.Marker({ map: map, position: latlng, icon: new google.maps.MarkerImage("http://www.google.com/images/icons/product/fusion_tables-32.png") }); } }); } </code></pre> <p><strong>UPDATE:</strong> If you (@Massimo) want to do it the way you have it in your update, then you need to remove the parentheses and possibly white space. Try something more like this:</p> <pre><code>function getData(response) { numRows = response.getDataTable().getNumberOfRows(); //create an array of row values for (i = 0; i &lt; numRows; i++) { var rowtext = response.getDataTable().getValue(i,0); var sanitizedText = rowtext.replace(/[\(\)\s]/g, ""); var strArr = sanitizedText.split(","); document.getElementById("via").innerHTML = rowtext; row = new google.maps.LatLng(strArr[0],strArr[1]); codeAddress(row); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload