0

Is there anything wrong with the code below? The markers are not showing up in the map.

function addMarker(place)
{

var latLng = {lat: parseFloat(place.latitude), lng: parseFloat(place.longitude)};


var marker = new google.maps.Marker({
      position: latLng,
      map: map,
      title: 'Hello World!'
    });

markers.push(marker);
}

1 Answer 1

1

This can happen if latitude and/or longitude are TEXT columns. They need to be NUMERIC columns, otherwise the select SQL in the update route returns no rows and addMarker doesn't get called.

5
  • the latitude and longitude are both numeric (i have tried making them real as well) but it doesnt work. In the js console in chrome i get a "internal error 500". RuntimeError: (sqlite3.OperationalError) no such column: longitude [SQL: 'SELECT * FROM places\n WHERE 42.326382141580844 <= latitude AND latitude <= 42.427577090806075 AND (-71.25743593750002 <= longitude AND longitude <= -70.99376406250002)\n GROUP BY country_code, place_name, admin_code1\n ORDER BY RANDOM()\n LIMIT 10'] Commented Apr 22, 2017 at 13:32
  • Sounds like the column in mashup.db is not named 'longitude'. Check for a spelling difference. Commented Apr 22, 2017 at 14:58
  • the spellings are the same. Commented Apr 22, 2017 at 15:02
  • Then maybe you have 2 databases? That error message is very specific. Paste the .schema places result from sqlite3 mashup.db run from the same directory where you execute flask run into the question. Commented Apr 22, 2017 at 15:12
  • i recreated the places table from scratch and now its working. Anyways thank you. Commented Apr 22, 2017 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .