Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rogeriojlle's full-sized avatar

Rogerio Machado rogeriojlle

  • Sao Francisco do Sul - SC
View GitHub Profile
@rogeriojlle
rogeriojlle / municipioSVG.js
Last active June 17, 2020 01:10
retorna a imagem svg do municipio consultando a api de malhas do IBGE
/*
* o paramentro "municipio" é o codigo dele, que pode ser obtido em:
* https://servicodados.ibge.gov.br/api/docs/localidades?versao=1#api-bq
*/
async function municipioSVG (municipio) {
const codEstado = municipio.toString().substring(0, 2)
const div = document.createElement('div')
const response = await fetch(
`https://servicodados.ibge.gov.br/api/v2/malhas/${codEstado}?resolucao=5&formato=image/svg+xml`
import React from 'react'
import { icons } from 'feather-icons'
function Icon ({ icon }) {
this.svg = icons[icon].toSvg()
this.blob = new Blob([this.svg], { type: 'image/svg+xml' })
this.src = URL.createObjectURL(this.blob)
return (<img src={this.src}></img>)
}