Last active
July 25, 2017 05:11
-
-
Save danhammer/12f6962a911d00e9598c536526b567ea 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
{"type":"Polygon","coordinates":[[[111.918395, 8.644202], [111.918405, 8.644212], [111.918405, 8.644192], [111.918551, 8.644891], [111.918561, 8.644900999999999], [111.918637, 8.645156], [111.918647, 8.645166], [111.918663, 8.64548], [111.918673, 8.645489999999999], [111.918728, 8.645999], [111.918738, 8.646009], [111.919039, 8.646318], [111.919049, 8.646328], [111.919034, 8.646434], [111.919044, 8.646443999999999], [111.919044, 8.646424], [111.919082, 8.646519], [111.919092, 8.646529], [111.9192, 8.646546], [111.91921, 8.646556], [111.919275, 8.646509], [111.919285, 8.646519], [111.919312, 8.646387], [111.91932200000001, 8.646397], [111.919409, 8.646355], [111.919419, 8.646365], [111.919763, 8.646387], [111.919773, 8.646397], [111.919773, 8.646377000000001], [111.920906, 8.646721], [111.920916, 8.646730999999999], [111.92126, 8.646742], [111.92127, 8.646752], [111.921737, 8.646657], [111.921747, 8.646666999999999], [111.922215, 8.64654], [111.922225, 8.64655], [111.92251, 8.646286], [111.92252, 8.646296], [111.922601, 8.645968], [111.922611, 8.645978], [111.922611, 8.645958], [111.92251, 8.645713], [111.92252, 8.645723], [111.922038, 8.644918], [111.922048, 8.644928], [111.921732, 8.644599], [111.92174200000001, 8.644608999999999], [111.921673, 8.644589], [111.921683, 8.644599], [111.921507, 8.644355], [111.92151700000001, 8.644364999999999], [111.921319, 8.644117], [111.921329, 8.644127], [111.921329, 8.644107], [111.921163, 8.643894], [111.92117300000001, 8.643904], [111.921126, 8.643804], [111.921136, 8.643813999999999], [111.92149, 8.643475], [111.92150000000001, 8.643485], [111.921533, 8.643475], [111.921543, 8.643485], [111.921673, 8.643639], [111.921683, 8.643649], [111.921748, 8.64357], [111.921758, 8.64358], [111.921758, 8.64356], [111.921469, 8.643258], [111.921479, 8.643267999999999], [111.921394, 8.643337], [111.92140400000001, 8.643347], [111.921474, 8.643427], [111.921484, 8.643437], [111.921115, 8.643756], [111.921125, 8.643766], [111.92104, 8.643767], [111.92105000000001, 8.643777], [111.920879, 8.643719], [111.920889, 8.643729], [111.920889, 8.643709000000001], [111.920133, 8.643093], [111.92014300000001, 8.643103], [111.919752, 8.642807], [111.919762, 8.642816999999999], [111.919044, 8.642372], [111.919054, 8.642382], [111.918781, 8.642351], [111.918791, 8.642361], [111.918551, 8.64226], [111.918561, 8.64227], [111.918406, 8.642329], [111.91841600000001, 8.642339], [111.91841600000001, 8.642319], [111.918272, 8.642489], [111.918282, 8.642498999999999], [111.918261, 8.642807], [111.918271, 8.642816999999999], [111.918315, 8.64365], [111.91832500000001, 8.643659999999999], [111.918352, 8.643883], [111.918362, 8.643893], [111.918395, 8.644202], [111.918405, 8.644212]]]} |
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
{"type":"Polygon","coordinates":[[[111.916952,8.642059],[111.916866,8.642154],[111.917188,8.642504],[111.917392,8.642611],[111.917306,8.642717],[111.917467,8.642854],[111.917639,8.642833],[111.91795,8.643173],[111.917886,8.643258],[111.918175,8.643565],[111.91825,8.643979],[111.918154,8.644021],[111.918122,8.643915],[111.918036,8.643936],[111.918122,8.644308],[111.918186,8.644308],[111.918186,8.644255],[111.918358,8.644255],[111.918551,8.645008],[111.918465,8.644976],[111.918454,8.64523],[111.918422,8.645305],[111.918358,8.645315],[111.91839,8.6454],[111.918497,8.645549],[111.918508,8.645655],[111.918433,8.64574],[111.918486,8.645824],[111.918068,8.645803],[111.918068,8.645909],[111.918454,8.645941],[111.918508,8.646037],[111.918433,8.646068],[111.918433,8.646249],[111.918358,8.646249],[111.918293,8.6461],[111.917124,8.646334],[111.917038,8.646249],[111.916641,8.645368],[111.916673,8.645294],[111.91677,8.645305],[111.916791,8.6454],[111.916877,8.645347],[111.916695,8.644891],[111.916587,8.644923],[111.91663,8.64505],[111.916544,8.645124],[111.916448,8.644806],[111.916137,8.644233],[111.916137,8.643756],[111.916255,8.643756],[111.916255,8.643873],[111.916341,8.643873],[111.916351,8.643353],[111.916276,8.643353],[111.916265,8.643459],[111.916169,8.64347],[111.916169,8.643045],[111.916094,8.642992],[111.916029,8.642992],[111.915987,8.643077],[111.915976,8.644255],[111.916888,8.646387],[111.917381,8.646917],[111.918293,8.647299],[111.920278,8.648031],[111.923239,8.649176],[111.923207,8.649314],[111.923625,8.649473],[111.923625,8.649367],[111.924344,8.649664],[111.924977,8.649123],[111.924924,8.64854],[111.923175,8.646641],[111.921587,8.644456],[111.921126,8.643841],[111.92149,8.643533],[111.921619,8.643714],[111.921812,8.643576],[111.921523,8.643194],[111.921362,8.643332],[111.921426,8.643438],[111.921104,8.643745],[111.921072,8.643597],[111.920772,8.643332],[111.920418,8.643067],[111.920246,8.642961],[111.920139,8.642812],[111.919473,8.642207],[111.919398,8.642091],[111.919087,8.641995],[111.918969,8.642048],[111.918776,8.641868],[111.918036,8.641041],[111.918122,8.640956],[111.917757,8.640532],[111.917639,8.640606],[111.917435,8.640532],[111.917145,8.640447],[111.916963,8.640447],[111.916426,8.640882],[111.916373,8.641041],[111.916426,8.641476],[111.916952,8.642059]]]} |
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> | |
<meta charset="utf-8"> | |
<style> | |
path { | |
fill: #ccc; | |
stroke: #000; | |
} | |
</style> | |
<body> | |
<script src="//d3js.org/d3.v3.min.js"></script> | |
<script> | |
var width = 960, | |
height = 500; | |
var projection = d3.geo.stereographic() | |
.center([111.925, 8.645]) | |
.scale(650000); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height); | |
var data; | |
d3.json("2012.json", function(error, polygon) { | |
if (error) return console.warn(error); | |
data = polygon; | |
console.log(data) | |
}); | |
d3.json("2017.json", function(polygon) { | |
var coordinates0 = data.coordinates[0].map(projection), | |
coordinates1 = polygon.coordinates[0].map(projection), | |
path = svg.append("path"), | |
d0 = "M" + coordinates0.join("L") + "Z", | |
d1 = "M" + coordinates1.join("L") + "Z"; | |
loop(); | |
function loop() { | |
path | |
.attr("d", d0) | |
.transition() | |
.duration(5000) | |
.attr("d", d1) | |
.each("end", loop); | |
} | |
}); | |
</script> |
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
old = [[111.918395,8.644202],[111.918551,8.644891],[111.918637,8.645156],[111.918663,8.64548],[111.918728,8.645999],[111.919039,8.646318],[111.919034,8.646434],[111.919082,8.646519],[111.9192,8.646546],[111.919275,8.646509],[111.919312,8.646387],[111.919409,8.646355],[111.919763,8.646387],[111.920906,8.646721],[111.92126,8.646742],[111.921737,8.646657],[111.922215,8.64654],[111.92251,8.646286],[111.922601,8.645968],[111.92251,8.645713],[111.922038,8.644918],[111.921732,8.644599],[111.921673,8.644589],[111.921507,8.644355],[111.921319,8.644117],[111.921163,8.643894],[111.921126,8.643804],[111.92149,8.643475],[111.921533,8.643475],[111.921673,8.643639],[111.921748,8.64357],[111.921469,8.643258],[111.921394,8.643337],[111.921474,8.643427],[111.921115,8.643756],[111.92104,8.643767],[111.920879,8.643719],[111.920133,8.643093],[111.919752,8.642807],[111.919044,8.642372],[111.918781,8.642351],[111.918551,8.64226],[111.918406,8.642329],[111.918272,8.642489],[111.918261,8.642807],[111.918315,8.64365],[111.918352,8.643883],[111.918395,8.644202]] | |
new = [[111.916952,8.642059],[111.916866,8.642154],[111.917188,8.642504],[111.917392,8.642611],[111.917306,8.642717],[111.917467,8.642854],[111.917639,8.642833],[111.91795,8.643173],[111.917886,8.643258],[111.918175,8.643565],[111.91825,8.643979],[111.918154,8.644021],[111.918122,8.643915],[111.918036,8.643936],[111.918122,8.644308],[111.918186,8.644308],[111.918186,8.644255],[111.918358,8.644255],[111.918551,8.645008],[111.918465,8.644976],[111.918454,8.64523],[111.918422,8.645305],[111.918358,8.645315],[111.91839,8.6454],[111.918497,8.645549],[111.918508,8.645655],[111.918433,8.64574],[111.918486,8.645824],[111.918068,8.645803],[111.918068,8.645909],[111.918454,8.645941],[111.918508,8.646037],[111.918433,8.646068],[111.918433,8.646249],[111.918358,8.646249],[111.918293,8.6461],[111.917124,8.646334],[111.917038,8.646249],[111.916641,8.645368],[111.916673,8.645294],[111.91677,8.645305],[111.916791,8.6454],[111.916877,8.645347],[111.916695,8.644891],[111.916587,8.644923],[111.91663,8.64505],[111.916544,8.645124],[111.916448,8.644806],[111.916137,8.644233],[111.916137,8.643756],[111.916255,8.643756],[111.916255,8.643873],[111.916341,8.643873],[111.916351,8.643353],[111.916276,8.643353],[111.916265,8.643459],[111.916169,8.64347],[111.916169,8.643045],[111.916094,8.642992],[111.916029,8.642992],[111.915987,8.643077],[111.915976,8.644255],[111.916888,8.646387],[111.917381,8.646917],[111.918293,8.647299],[111.920278,8.648031],[111.923239,8.649176],[111.923207,8.649314],[111.923625,8.649473],[111.923625,8.649367],[111.924344,8.649664],[111.924977,8.649123],[111.924924,8.64854],[111.923175,8.646641],[111.921587,8.644456],[111.921126,8.643841],[111.92149,8.643533],[111.921619,8.643714],[111.921812,8.643576],[111.921523,8.643194],[111.921362,8.643332],[111.921426,8.643438],[111.921104,8.643745],[111.921072,8.643597],[111.920772,8.643332],[111.920418,8.643067],[111.920246,8.642961],[111.920139,8.642812],[111.919473,8.642207],[111.919398,8.642091],[111.919087,8.641995],[111.918969,8.642048],[111.918776,8.641868],[111.918036,8.641041],[111.918122,8.640956],[111.917757,8.640532],[111.917639,8.640606],[111.917435,8.640532],[111.917145,8.640447],[111.916963,8.640447],[111.916426,8.640882],[111.916373,8.641041],[111.916426,8.641476],[111.916952,8.642059]] | |
old_adj = [] | |
i = 0 | |
for coord in old: | |
x, y = coord | |
old_adj.append(coord) | |
old_adj.append([x + 0.00001, y + 0.00001]) | |
if i % 6 == 0: | |
old_adj.append([x + 0.00001, y - 0.00001]) | |
i += 1 | |
print old_adj | |
print(len(old_adj)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment