We can't make this file beautiful and searchable because it's too large.
This file contains 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
CID,DESCRICAO | |
A000,"Cólera devida a Vibrio cholerae 01, biótipo cholerae" | |
A001,"Cólera devida a Vibrio cholerae 01, biótipo El Tor" | |
A009,Cólera não especificada | |
A010,Febre tifóide | |
A011,Febre paratifóide A | |
A012,Febre paratifóide B | |
A013,Febre paratifóide C | |
A014,Febre paratifóide não especificada | |
A020,Enterite por salmonela |
This file contains 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
import requests | |
from bs4 import BeautifulSoup | |
import pandas as pd | |
import numpy as np | |
import pandas as pd | |
from datetime import datetime, timedelta | |
#import oauth, tweepy | |
import gspread | |
import gspread_dataframe as gd | |
from oauth2client.service_account import ServiceAccountCredentials |
This file contains 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
// adding menu but doing nothing yet | |
var popup = new mapboxgl.Popup({ | |
closeButton: false, | |
closeOnClick: true | |
}); | |
map.on('click', 'unclustered-point', function(e) { | |
// Change the cursor style as a UI indicator. | |
map.getCanvas().style.cursor = 'pointer'; | |
var coordinates = e.features[0].geometry.coordinates.slice(); | |
var description = '<h2>aptos: '+e.features[0].properties.total_aptos+'<h2>local: '+e.features[0].properties.nm_local+'</h2>'+'\n' |
This file contains 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
function initmap() { | |
updateClusters(false); | |
select_el.addEventListener('change', function(e) { | |
// Update selected aggregation on dropdown | |
select_value = select_el.value | |
updateClusters(true); | |
}) | |
map.addSource("locais-2018-mp-clean", { | |
type: "geojson", | |
data: clusterData, |
This file contains 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
var colorStops, radiusStops; | |
function updateClusters(repaint) { | |
currentZoom = map.getZoom(); | |
clusterData = turf.featureCollection(cluster.getClusters(worldBounds, Math.floor(currentZoom))) | |
let stops_domain = chroma.limits(getFeatureDomain(clusterData, select_value), 'e', 8) | |
//coloração original era definida pela linha abaixo. copiei, colei e utilizei escala logarítimica que tirei daqui: https://github.com/gka/chroma.js/ | |
var scale = chroma.scale(color).domain(stops_domain).mode('lab') | |
colorStops = createColorStops(stops_domain, scale) | |
radiusStops = createRadiusStops(stops_domain, 20, 50); | |
if (repaint) { |
This file contains 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
map.on('style.load', function() { | |
fetch(data_url) | |
.then(res => res.json()) | |
.then((out) => { | |
mydata = out; | |
// Usando a Supercluster! | |
cluster.load(mydata.features); | |
// Criando o mapa | |
initmap(); | |
}) |
This file contains 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
mapboxgl.accessToken = 'seu token vai aqui'; | |
var map = new mapboxgl.Map({ | |
container: 'map', | |
style: "seu map style vai aqui. você poderá criar um estilizado ou utilizar um padrão do Mapbox. | |
Também é possível utilizar uma solução do OpenStreet Map ou similares, que não é o escopo deste tutorial.", | |
center: [-43.01,-22.495], #escolha uma latitude/longitude inicial para seu mapa | |
zoom: 8, #escolha um zoom inicial | |
hash: true | |
}); |
This file contains 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
//Supercluster with property aggregation | |
var cluster = supercluster({ | |
radius: clusterRadius, | |
maxZoom: clusterMaxZoom, | |
initial: function() { | |
return { | |
count: 0, | |
sum: 0, | |
min: Infinity, | |
max: -Infinity |
This file contains 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
function getFeatureDomain(geojson_data, myproperty) { | |
let data_domain = [] | |
turf.propEach(geojson_data, function(currentProperties, featureIndex) { | |
data_domain.push(Math.round(Number(currentProperties[myproperty]) * 100 / 100)) | |
}) | |
return data_domain | |
} | |
function createColorStops(stops_domain, scale) { | |
let stops = [] | |
stops_domain.forEach(function(d) { |
This file contains 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
<script> | |
var select_el = document.getElementById('select-option') | |
var select_value = select_el.value | |
var clusterRadius = 40; | |
var clusterMaxZoom = 20; | |
//Propriedade a ser utilizada para gerar os pontos a serem clusterizados em nosso aquivo GeoJSON. Precisa ser uma variável do tipo NUMÉRICO. | |
var propertyToAggregate = "total_aptos" | |
//este é o link onde armazenei nosso GeoJSON | |
let data_url = "https://gist.githubusercontent.com/harllos/022379b54666103b8f842a18f71bb88a/raw/7442f4648c9f8f9371f21a79593265f9503279a6/locais_2018_mp_clean.geojson"; | |
var mydata; |
NewerOlder