This is a first test on how it could be implemented!!!
Last active
December 27, 2015 04:29
-
-
Save milkbread/7266778 to your computer and use it in GitHub Desktop.
HTML: Demonstrating Algorithm Steps
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
{"type": "DemoCollection", "properties": {"description": "How does it work and what are the intermediate steps?!?", "title": "Visvalingam-Wyatt"}, "features": [{"type": "DemoFeature", "properties": {"id": 0}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.00011687251612847714}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.603477478027344, 51.09705416252757, 0.00011687251612847714]]]}, "type": "Feature", "properties": {"area": 0.0002453439576853723}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.673171997070312, 51.07246834624617, 2.279612922474975e-05], [13.622703552246094, 51.1028752051342, 0.00014594869236419936]]]}, "type": "Feature", "properties": {"area": 0.00028925457276263557}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.673171997070312, 51.07246834624617, 2.279612922474975e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 2.279612922474975e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.673171997070312, 51.07246834624617, 2.279612922474975e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.673171997070312, 51.07246834624617, 2.279612922474975e-05]]]}, "type": "Feature", "properties": {"area": 8.158743033259928e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771]]]}, "type": "Feature", "properties": {"area": 6.30672924307591e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05]]]}, "type": "Feature", "properties": {"area": 3.45897127703885e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05]]]}, "type": "Feature", "properties": {"area": 0.00016547093453030338}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.00039742189348474394}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.00017680114296989198}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.768272399902344, 51.062544053267715, 0.00017680114296989198]]]}, "type": "Feature", "properties": {"area": 0.00029987304698864126}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.673171997070312, 51.07246834624617, 2.279612922474975e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 0}, {"type": "DemoFeature", "properties": {"id": 1}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.00011687251612847714}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.603477478027344, 51.09705416252757, 0.00011687251612847714]]]}, "type": "Feature", "properties": {"area": 0.0002453439576853723}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.622703552246094, 51.1028752051342, 0.00014594869236419936]]]}, "type": "Feature", "properties": {"area": 0.0004093119531294096}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 0.0002479037588194945}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771]]]}, "type": "Feature", "properties": {"area": 6.30672924307591e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05]]]}, "type": "Feature", "properties": {"area": 3.45897127703885e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05]]]}, "type": "Feature", "properties": {"area": 0.00016547093453030338}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.00039742189348474394}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.00017680114296989198}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.768272399902344, 51.062544053267715, 0.00017680114296989198]]]}, "type": "Feature", "properties": {"area": 0.00029987304698864126}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.702354431152344, 51.07354694552797, 3.45897127703885e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 1}, {"type": "DemoFeature", "properties": {"id": 2}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.00011687251612847714}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.603477478027344, 51.09705416252757, 0.00011687251612847714]]]}, "type": "Feature", "properties": {"area": 0.0002453439576853723}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.622703552246094, 51.1028752051342, 0.00014594869236419936]]]}, "type": "Feature", "properties": {"area": 0.0004093119531294096}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 0.0002479037588194945}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.680381774902344, 51.06427017012091, 0.0005228810813041771]]]}, "type": "Feature", "properties": {"area": 7.987625433564893e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05]]]}, "type": "Feature", "properties": {"area": 0.00031531142134554117}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.00039742189348474394}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.00017680114296989198}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.768272399902344, 51.062544053267715, 0.00017680114296989198]]]}, "type": "Feature", "properties": {"area": 0.00029987304698864126}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.698577880859373, 51.0662119746483, 7.987625433564893e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 2}, {"type": "DemoFeature", "properties": {"id": 3}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.00011687251612847714}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.603477478027344, 51.09705416252757, 0.00011687251612847714]]]}, "type": "Feature", "properties": {"area": 0.0002453439576853723}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.622703552246094, 51.1028752051342, 0.00014594869236419936]]]}, "type": "Feature", "properties": {"area": 0.0004093119531294096}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 0.0005228810813041771}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.680381774902344, 51.06427017012091, 0.0005228810813041771]]]}, "type": "Feature", "properties": {"area": 0.0005441985715419378}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.00039742189348474394}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.00017680114296989198}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.768272399902344, 51.062544053267715, 0.00017680114296989198]]]}, "type": "Feature", "properties": {"area": 0.00029987304698864126}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.603477478027344, 51.09705416252757, 0.00011687251612847714], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 3}, {"type": "DemoFeature", "properties": {"id": 4}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.00014594869236419936}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.622703552246094, 51.1028752051342, 0.00014594869236419936]]]}, "type": "Feature", "properties": {"area": 0.0004093119531294096}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 0.0005228810813041771}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.680381774902344, 51.06427017012091, 0.0005228810813041771]]]}, "type": "Feature", "properties": {"area": 0.0005441985715419378}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.00039742189348474394}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.00017680114296989198}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.768272399902344, 51.062544053267715, 0.00017680114296989198]]]}, "type": "Feature", "properties": {"area": 0.00029987304698864126}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.622703552246094, 51.1028752051342, 0.00014594869236419936], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 4}, {"type": "DemoFeature", "properties": {"id": 5}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.0007789721355453374}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 0.0005228810813041771}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.680381774902344, 51.06427017012091, 0.0005228810813041771]]]}, "type": "Feature", "properties": {"area": 0.0005441985715419378}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.00039742189348474394}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.00017680114296989198}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.768272399902344, 51.062544053267715, 0.00017680114296989198]]]}, "type": "Feature", "properties": {"area": 0.00029987304698864126}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.768272399902344, 51.062544053267715, 0.00017680114296989198], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 5}, {"type": "DemoFeature", "properties": {"id": 6}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.0007789721355453374}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 0.0005228810813041771}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.680381774902344, 51.06427017012091, 0.0005228810813041771]]]}, "type": "Feature", "properties": {"area": 0.0005441985715419378}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.0007558597383561939}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.0005836164243683073}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.680381774902344, 51.06427017012091, 0.0005228810813041771], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 6}, {"type": "DemoFeature", "properties": {"id": 7}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 7.487374819404577e-05}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05]]]}, "type": "Feature", "properties": {"area": 0.00035355229043150776}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.0007558597383561939}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.0005836164243683073}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.663558959960936, 51.089722918116344, 7.487374819404577e-05], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 7}, {"type": "DemoFeature", "properties": {"id": 8}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.0009075631252236748}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.0007558597383561939}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795], [13.742866516113281, 51.05455992559041, 0.0006570382649128541]]]}, "type": "Feature", "properties": {"area": 0.0005836164243683073}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.8043212890625, 51.05995475730752, 0.0005836164243683073], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 8}, {"type": "DemoFeature", "properties": {"id": 9}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.0009075631252236748}}, {"geometry": {"type": "Polygon", "coordinates": [[[13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.819084167480469, 51.042257358849795], [13.713340759277344, 51.076566889774945, 0.0005457894975551843]]]}, "type": "Feature", "properties": {"area": 0.0006570382649128541}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.742866516113281, 51.05455992559041, 0.0006570382649128541], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 9}, {"type": "DemoFeature", "properties": {"id": 10}, "geometries": {"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[13.591804504394531, 51.10567766795608], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.819084167480469, 51.042257358849795], [13.591804504394531, 51.10567766795608]]]}, "type": "Feature", "properties": {"area": 0.0005457894975551843}}, {"geometry": {"type": "LineString", "coordinates": [[13.591804504394531, 51.10567766795608], [13.713340759277344, 51.076566889774945, 0.0005457894975551843], [13.819084167480469, 51.042257358849795]]}, "type": "Feature", "properties": []}]}, "stage": 10}]} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Demonstration</title> | |
<meta charset="utf-8" /> | |
<script src="http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.js"></script> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="http://bl.ocks.org/milkbread/raw/5909613/simplify_RK_1.1.js"></script> | |
<style> | |
@import url(http://cdn.leafletjs.com/leaflet-0.6.1/leaflet.css); | |
.row{ | |
display:inline-block; | |
} | |
.main_container{ | |
width:100%; | |
background-color:#ddd; | |
padding-left:7%; | |
} | |
.container{ | |
margin-bottom:10px; | |
padding:20px; | |
padding-left:0px; | |
} | |
.heading{ | |
font-size:24pt; | |
} | |
.centered{ | |
text-align:center; | |
} | |
.margin1{ | |
margin:10px; | |
} | |
.main_heading{ | |
font-size:32pt; | |
} | |
.description{ | |
font-size:22pt; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
var search_tag = location.search.replace('?',''); | |
var file = 'demo.json'; | |
if (search_tag.length!=0){ | |
file = search_tag; | |
} | |
d3.json(file, function(error, json_) { | |
d3.select('body').append('p').attr("class","main_heading centered margin1").text(json_.properties.title) | |
d3.select('body').append('p').attr("class","description centered margin1").text(json_.properties.description) | |
d3.select('body').append('div').attr('class','main_container').attr('id','main_container') | |
json_.features.forEach(showDemoStages) | |
}) | |
function showDemoStages(feature, id){ | |
var geometries = feature.geometries.features; | |
var container = d3.select('#main_container').append('div').attr('class','row').append('div').attr('id',id).attr('class','container') | |
container.append('div').attr('class','heading centered').append('text').text('Stage Nr.'+id).attr('id','text'+id) | |
var width = 500, height = 250; | |
container.append('div').attr('id','map'+id).style('width',width+'px').style('height',height+'px')//.style('margin-left',(window.innerWidth-width)/2 + 'px') | |
var map = L.map('map'+id).setView([53, 20], 5); | |
var data_attrib = " | Data: <a href='http://www.openstreetmap.org/'>© OpenStreetMap </a>contributers | <a href='http://d3js.org/'>D3.js</a>" | |
var stamen = L.tileLayer('http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png', {attribution: "Map: <a href='http://maps.stamen.com/#toner/12/37.7706/-122.3782'>Stamen Design</a>" + data_attrib}).addTo(map); | |
var baseLayers = {"stamen": stamen}; | |
var overlays = {}; | |
var lGroup = L.layerGroup() | |
var pGroup = L.layerGroup() | |
var color = d3.scale.category10() | |
var polyline; | |
var minArea = {'value':Infinity,'index':-1}; | |
geometries.forEach(function(d, i){ | |
if(d.geometry.type=='Polygon'){ | |
if(minArea.value > d.properties.area){ | |
minArea.value = d.properties.area; | |
minArea.index = i; | |
} | |
} | |
}) | |
geometries.forEach(function(d,i){ | |
if(d.geometry.type=='LineString'){ | |
polyline = L.polyline(d.geometry.coordinates.map(function(e){return [e[1],e[0]]}), {color: "#f00"}); | |
overlays['linestring ['+d.geometry.coordinates.length+' Points]'] = polyline; | |
map.fitBounds(polyline.getBounds()) | |
d.geometry.coordinates.forEach(function(e,i){ | |
var circle = L.circle([e[1],e[0]], 100, { color: '#000', fillColor: '#000'}); | |
pGroup.addLayer(circle) | |
}) | |
} | |
else if(d.geometry.type=='Polygon'){ | |
if(i != minArea.index)c='#777' | |
else c='#f0f' | |
var polygon = L.polygon(d.geometry.coordinates.map(function(f){return f.map(function(g){return [g[1],g[0]]})}), {color: c });//color(i)}); | |
polygon.bindPopup("Area: "+d.properties.area.toFixed(6)); | |
lGroup.addLayer(polygon); | |
} | |
}) | |
lGroup.addTo(map); | |
overlays['triangles'] = lGroup; | |
pGroup.addTo(map); | |
overlays['points'] = pGroup; | |
polyline.addTo(map); | |
L.control.layers(baseLayers, overlays).addTo(map) | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment