Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
Javascript: switch, case, styling

What do you think is wrong here?

I'm trying to apply different stylings according to the line of a Geojson in Leaflet.js

Error is: Uncaught SyntaxError: missing ) after formal parameters

// WFS TFL

var startatzoom_tfl = 10;
var featureLayer_tfl = new L.GeoJSON(
null, {
       switch (feature.properties.name){
       
       case 'Bakerloo' : style: function(){return { color: #B36305, weight: 13, opacity: 0.7 }}; 
       case 'Central' : style: function(){return { color: #E32017, weight: 13, opacity: 0.7 }}; 
       case 'Circle' : style: function(){return { color: #FFD300, weight: 13, opacity: 0.7 }}; 
       case 'District' : style: function(){return { color: #00782A, weight: 13, opacity: 0.7 }}; 
       case 'Elizabeth' : style: function(){return { color: #9364CD, weight: 13, opacity: 0.7 }}; 
       case 'Hammersmith & City' : style: function(){return { color: #F3A9BB, weight: 13, opacity: 0.7 }}; 
       case 'Jubilee' : style: function(){return { color: #A0A5A9, weight: 13, opacity: 0.7 }}; 
       case 'Metropolitan' : style: function(){return { color: #9B0056, weight: 13, opacity: 0.7 }}; 
       case 'Northern' : style: function(){return { color: #000000, weight: 13, opacity: 0.7 }}; 
       case 'Piccadilly' : style: function(){return { color: #003688, weight: 13, opacity: 0.7 }}; 
       case 'Victoria' : style: function(){return { color: #0098D4, weight: 13, opacity: 0.7 }}; 
       case 'Waterloo & City' : style: function(){return { color: #95CDBA, weight: 13, opacity: 0.7 }}; 
       case 'DLR' : style: function(){return { color: #00A4A7, weight: 13, opacity: 0.7 }}; 
       case 'London Overground' : style: function(){return { color: #EE7C0E, weight: 13, opacity: 0.7 }}; 
       case 'London Trams' : style: function(){return { color: #84B817, weight: 13, opacity: 0.7 }}; 
       case 'Emirates Cable Car' : style: function(){return { color: #E21836, weight: 13, opacity: 0.7 }}; 
                                                                      
                                                                      },

    onEachFeature:
         function popUpsome(feature, layer) {
             if (feature.properties && feature.properties.name) {
        layer.bindPopup('<h3>' + feature.properties.name + '</h3><br>' + feature.properties.name + '<br><i>' + feature.properties.name + '</i>', {maxWidth: 200}) ;
                        layer.bindTooltip(feature.properties.name);
             }
         }
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!