Last active
August 13, 2025 21:09
-
-
Save jokoon/79817bb2ea061da3a55d073ffe67582c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>city_cold</title> | |
| <link rel="stylesheet" href="/static/lifilou.nogit/leaflet.css"/> | |
| <script src="/static/lifilou.nogit/leaflet.js"></script> | |
| <script src="/static/simple-ajax.js"></script> | |
| <style type="text/css"> | |
| #mapid { height: 800px; width:800px } | |
| .leaflet-marker-icon {font-family: "Small fonts";} | |
| .my-div-icon {height: 0; width: 0; | |
| text-shadow: | |
| #fff 0px 0px 1px, | |
| #fff 0px 0px 1px, | |
| #fff 0px 0px 1px, | |
| #fff 0px 0px 1px, | |
| #fff 0px 0px 1px, | |
| #fff 0px 0px 1px; | |
| /*font-size: 90%;*/ | |
| line-height: 1; | |
| } | |
| .cheap { | |
| /*color: #8f7;*/ | |
| color: #fff; | |
| text-shadow: | |
| #000 0px 0px 2px, | |
| #000 0px 0px 2px, | |
| #000 0px 0px 2px, | |
| #000 0px 0px 2px, | |
| #000 0px 0px 2px, | |
| #000 0px 0px 2px; | |
| } | |
| .expensive { | |
| color: red; | |
| } | |
| #where, .leaflet-popup-content {font-family: monospace;} | |
| </style> | |
| </head> | |
| <body> | |
| <div id="mapid"></div> | |
| <script type="text/javascript"> | |
| 'use strict'; | |
| var mymap = L.map('mapid').setView([47, 1.85], 6); | |
| // DONT REMOVE THIS NEXT COMMENT | |
| //GAGABOUDOU | |
| L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
| maxZoom: 19, | |
| attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' | |
| }).addTo(mymap); | |
| var popup = L.popup(); | |
| var markers = []; | |
| var exclude = true; | |
| for (const [city, value] of Object.entries(city_data)) { | |
| var [pop, latlon, price] = value; | |
| var [lat, lng] = latlon; | |
| var class_style = 'my-div-icon'; | |
| if (exclude) { | |
| if ( | |
| // false | |
| // price>7.5 | |
| // price>8. | |
| // || pop < 12000 | |
| price>9.5 | |
| || pop < 25000 | |
| ) { | |
| continue; | |
| } | |
| } | |
| else { | |
| if (price < 8.5) { | |
| // class_style= 'my-div-icon-cheap' | |
| class_style+= ' cheap' | |
| } | |
| else { | |
| class_style+= ' expensive' | |
| } | |
| } | |
| class_style+= ' cheap' | |
| var circle = L.circle([lat, lng], { | |
| color: 'red', | |
| fillColor: '#f03', | |
| fillOpacity: 0.5, | |
| // radius: 5 | |
| radius: 10 | |
| }); | |
| circle.addTo(mymap); | |
| markers.push(circle); | |
| // price | |
| // console.log(city, pop, price); | |
| var city_name = city+' '+Math.round(pop/1000)+'k_'+price; | |
| var dat_icon = L.divIcon({html:city_name, className: class_style}); | |
| var text = L.marker([lat, lng], {icon:dat_icon}) | |
| text.addTo(mymap); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment