nearest map pins converted to javascript