Built with blockbuilder.org
| <!DOCTYPE html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> | |
| <style> | |
| </style> | |
| </head> | |
| <body> | |
| <script> | |
| // this gepjson is supposed to look like this | |
| // http://bl.ocks.org/d/ec4cebc0afcf170091b2 | |
| // http://geojson.io/#id=gist:biovisualize/e1138c4419665f0a1d2b&map=2/20.0/0.0 | |
| var polygonData = { | |
| "type": "Feature", | |
| "geometry": { | |
| "type": "Polygon", | |
| "coordinates": [ | |
| [ | |
| [ -100, -20 ], | |
| [ -100, 20 ], | |
| [ 100, 20 ], | |
| [ 100, -20 ], | |
| [ -100, -20 ] | |
| ] | |
| ] | |
| }, | |
| "properties": {} | |
| }; | |
| var width = 1000; | |
| var height = 500; | |
| var projection = d3.geo.equirectangular() | |
| .scale(100) | |
| .translate([width / 2, height / 2]) | |
| .rotate([0, 0]) | |
| .center([0, 0]) | |
| .precision(0); | |
| var path = d3.geo.path() | |
| .projection(projection); | |
| var svg = d3.select("body").append("svg") | |
| .attr({ | |
| width: width, | |
| height: height | |
| }); | |
| svg.append('path') | |
| .datum(polygonData) | |
| .attr({ | |
| d: path, | |
| fill: 'orange', | |
| opacity: 0.5 | |
| }); | |
| </script> | |
| </body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment