Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
        integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
        crossorigin=""/>
</head>

<body>
  <div id="map"></div>

  <div>
    <label> School type</label><br>
    <input type='checkbox' name='fltschooltype' value='primary' checked>primary<br>
    <input type='checkbox' name='fltschooltype'  value='preparatory' checked>preparatory<br>
    <input type='checkbox' name='fltschooltype'  value='high' checked>high<br><br>

    <label> School time</label><br>
    <input type='checkbox' name='fltschooltime' value='day' checked>day<br>
    <input type='checkbox' name='fltschooltime'   value='night' checked>night<br>
    <input type='checkbox' name='fltschooltime'   value='all-time' checked>all time<br><br>

    <label> School gender</label><br>
    <input type='checkbox' name='fltschoolgender'   value='male' checked>male<br>
    <input type='checkbox' name='fltschoolgender'   value='female' checked>female<br>

    <button id="btnProjectFilter" >Filter</button>
  </div>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
          integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
          crossorigin=""></script>
</body>


              
            
!

CSS

              
                #map { height: 300px;}
              
            
!

JS

              
                
var map = L.map('map').setView([30.0712316, 31.185724526], 9)

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);



var schoolGeoJson = {"features": [
  { "type": "Feature", "properties": { "Name": "school 1", "Type": "primary", "Time": "night", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.249997470759489, 30.156712441516319, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 2", "Type": "preparatory", "Time": "night", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.179781162784785, 30.204377804385128, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 3", "Type": "high", "Time": "night", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.432004029402794, 30.20532958878746, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 4", "Type": "primary", "Time": "night", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.347295217595239, 30.277665203364698, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 5", "Type": "preparatory", "Time": "night", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 31.502436075175371, 30.085404754093613, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 6", "Type": "high", "Time": "night", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 31.578578827361941, 30.215799217213114, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 7", "Type": "primary", "Time": "night", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 31.098879488586558, 30.052092300011989, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 8", "Type": "preparatory", "Time": "day", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 30.965629672260061, 30.12442791458923, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 9", "Type": "high", "Time": "day", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 31.113156254621536, 29.940733524939134, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 10", "Type": "primary", "Time": "day", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.383463024883859, 29.939781740536802, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 11", "Type": "preparatory", "Time": "day", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.562398492522295, 29.941685309341466, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 12", "Type": "high", "Time": "day", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.355861277216228, 30.049236946804992, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 13", "Type": "primary", "Time": "day", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.556687786108302, 30.312881226250987, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 14", "Type": "preparatory", "Time": "day", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 31.226418598499059, 30.32335085467664, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 15", "Type": "high", "Time": "all-time", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 31.78130890505868, 30.060658359632978, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 16", "Type": "primary", "Time": "all-time", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 31.750851804184052, 30.235786689662088, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 17", "Type": "preparatory", "Time": "all-time", "Gender": "male" }, "geometry": { "type": "Point", "coordinates": [ 30.932317218178436, 29.995937020274393, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 18", "Type": "high", "Time": "all-time", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.133143727070511, 29.81795333703829, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 19", "Type": "primary", "Time": "all-time", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.358716630423224, 29.802724786600976, 0.0 ] } },
  { "type": "Feature", "properties": { "Name": "school 20", "Type": "preparatory", "Time": "all-time", "Gender": "female" }, "geometry": { "type": "Point", "coordinates": [ 31.649010873134518, 29.798917648991647, 0.0 ] } }
]};





var schoolLayer = L.geoJson(schoolGeoJson , { pointToLayer:schoolMarker,filter:filterhotels} ).addTo(map);



function schoolMarker(json, latlng){
  var att = json.properties;
  if (att.Type=='primary') {
    var clrNest = 'red';
  }
  else if  (att.Type=='preparatory') {
    var clrNest = 'blue';
  }
  else {
    var clrNest = 'green';
  }
  return L.circleMarker(latlng, {radius:10, color:'black',fillColor:clrNest, fillOpacity:0.8})
    .bindPopup("<span>School type: "+att.Type+"</span><br>"+
               "</h4>School time: "+att.Time+"</span><br>"+
               "</h4>School gender: "+att.Gender+"</span><br>");
}


function filterhotels (json) {
  var schooltypeFilter = [];
  $("input[name=fltschooltype]").each(function(){
    if (this.checked) {
      schooltypeFilter.push(this.value);
    }
  }); 

  $("input[name=fltschooltime]").each(function(){
    if (this.checked) {
      schooltypeFilter.push(this.value);
    }
  }); 

  $("input[name=fltschoolgender]").each(function(){
    if (this.checked) {
      schooltypeFilter.push(this.value);
    }
  }); 

  var att = json.properties;
  var cond1 = (schooltypeFilter.indexOf(att.Type) >= 0);
  var cond2 = (schooltypeFilter.indexOf(att.Time) >= 0);
  var cond3 = (schooltypeFilter.indexOf(att.Gender) >= 0);
  
  return(cond1 & cond2 & cond3);
}
$("#btnProjectFilter").click(function(){
  schoolLayer.clearLayers();
  schoolLayer.addData(schoolGeoJson);

}); 
              
            
!
999px

Console