I'm almost done with pset8 but the update function in scripts.js is not working.

This happens when I use the text box to search a place:

[24/Apr/2017 02:27:35] "GET /update?ne=NaN%2CNaN&q=&sw=NaN%2CNaN HTTP/1.1" 500 raise RuntimeError("invalid sw")

The maps neves loads.

When I simply drag to search other places It works perfectly.

function update() 
// get map's bounds
var bounds = map.getBounds();
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();

// get places within bounds (asynchronously)
var parameters = {
    ne: ne.lat() + "," + ne.lng(),
    q: $("#q").val(),
    sw: sw.lat() + "," + sw.lng()
$.getJSON(Flask.url_for("update"), parameters)
.done(function(data, textStatus, jqXHR) {

   // remove old markers from map

   // add new markers to map
   for (var i = 0; i < data.length; i++)
.fail(function(jqXHR, textStatus, errorThrown) {

    // log error to browser's console


  • How are latitude and longitude defined in the database? Are they TEXT or NUMERIC? Apr 24 '17 at 3:16
  • both are NUMERIC
    – italo
    Apr 24 '17 at 3:55

A likely cause is the sql in the search function is not returning a column named latitude or longitude (or both). Spelling and case are critical.

You must log in to answer this question.

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