Map of Colombia with cities and states
Simple map of Colombia with cities (municipios) and states (departamentos)
GEO Json from Javier Moreno mapa-colombia-js project on github
forked from mbostock's block: New Jersey State Plane
Simple map of Colombia with cities (municipios) and states (departamentos)
GEO Json from Javier Moreno mapa-colombia-js project on github
forked from mbostock's block: New Jersey State Plane
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
.tract { | |
fill: #eee; | |
} | |
.tract:hover { | |
fill: orange; | |
} | |
.tract-border { | |
fill: none; | |
stroke: #777; | |
pointer-events: none; | |
} | |
.tract-border-state { | |
fill: none; | |
stroke: #333; | |
stroke-width: 1.5px; | |
pointer-events: none; | |
} | |
</style> | |
<svg width="960" height="550"></svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://d3js.org/topojson.v1.min.js"></script> | |
<script> | |
var svg = d3.select("svg"), | |
width = +svg.attr("width"), | |
height = +svg.attr("height"), | |
margin = { top: 20, bottom:20, right: 20, left: 20}; | |
d3.json("colombia-municipios.json", function(error, data) { | |
if (error) throw error; | |
var land = topojson.feature(data, { | |
type: "GeometryCollection", | |
geometries: data.objects.mpios.geometries.filter(function(d) { | |
return (d.id / 10000 | 0) % 100 !== 99; | |
}) | |
}); | |
var landState = topojson.feature(data, { | |
type: "GeometryCollection", | |
geometries: data.objects.depts.geometries.filter(function(d) { | |
return (d.id / 10000 | 0) % 100 !== 99; | |
}) | |
}); | |
// EPSG:32111 | |
var path = d3.geoPath() | |
.projection(d3.geoTransverseMercator() | |
.rotate([74 + 30 / 60, -38 - 50 / 60]) | |
.fitExtent([[margin.left, margin.top], [width-margin.right, height-margin.bottom]], land)); | |
var pathState = d3.geoPath() | |
.projection(d3.geoTransverseMercator() | |
.rotate([74 + 30 / 60, -38 - 50 / 60]) | |
.fitExtent([[margin.left, margin.top], [width-margin.right, height-margin.bottom]], landState)); | |
svg.selectAll("path") | |
.data(land.features) | |
.enter().append("path") | |
.attr("class", "tract") | |
.attr("d", path) | |
.append("title") | |
.text(function(d) { return d.properties.name; }); | |
svg.append("path") | |
.datum(topojson.mesh(data, data.objects.mpios, function(a, b) { return a !== b; })) | |
.attr("class", "tract-border") | |
.attr("d", path); | |
svg.append("path") | |
.datum(topojson.mesh(data, data.objects.depts, function(a, b) { return a !== b; })) | |
.attr("class", "tract-border-state") | |
.attr("d", pathState); | |
}); | |
</script> |
No ni idea. De pronto si compartes algún código que permita reproducir el error lo pueda mirar |
El mapa no está centrado aparece en america de norte |
Si, es que el mapa no está hecho para ser visto en github....
…On Mon, Jul 27, 2020 at 8:45 PM Alfredo Maussa ***@***.***> wrote:
*@A4lfr32* commented on this gist.
------------------------------
[image: image]
<https://user-images.githubusercontent.com/38017273/88609565-09df2e00-d04a-11ea-8e48-12a770799c87.png>
Intenté centrar pero no cuadra la figura
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/727e8992e9599b9d9f1dbfdc4c8e479e#gistcomment-3393835>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJJCSZTAFRX535NQF44G4TR5YUTXANCNFSM4NETVSEA>
.
--
--
John Alexis Guerra Gómez
https://johnguerra.co
|
Hola, gracias por tu aporte. |
Hola! Una duda, el GEOJson que lograste armar ¿Lo armaste con las features y properties correspondientes? |
Acabo de armar un topojson nuevo de Colombia, lo tengo en observable. Tengo
que revisarlo.
https://observablehq.com/@john-guerra/spike-map-colombia
John.
From my phone, brevity and all
http://johnguerra.co
…On Wed, Nov 11, 2020, 9:22 PM demarchenac ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hola! Una duda, el GEOJson que lograste armar ¿Lo armaste con las features
y properties correspondientes?
Es decir, codigo de municipio, nombre de municipio, etc.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/727e8992e9599b9d9f1dbfdc4c8e479e#gistcomment-3524829>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJJCS2BQR4PEPRMQVYR4N3SPNWH5ANCNFSM4NETVSEA>
.
|
Disuclpa tu sabes como puedo ponerele un dato aun municipio es decir si me paro en uribia que me aparezca algo indicando el dato que yo desee un numero por ejemplo |
This comment has been minimized.
Hola, he intentado centrar el mapa en openlayers y no he podido, de eco parece que no tuviera las dimensiones correctas, sabes o tienes alguna idea de que podría hacer para ajustarlo? gracias.