我想在Mollweide投影下使用d3.js繪製矩形。但是,當我運行以下腳本時,矩形顯示爲弧形或曲線矩形。由於Mollweide投影的相似之處僅僅是直線,我覺得bahaviour有點奇怪。有人可以解釋這種影響嗎?其他緯度和其他投影(甚至Equirectangular一個)也會產生同樣的效果。d3.js矩形特徵在Mollweide投影中作爲圓弧繪製
<!DOCTYPE html>
<head>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://d3js.org/d3-geo-projection.v1.min.js"></script>
</head>
<body>
</body>
<script type="text/javascript">
var mainSVG = d3.select('body').append('svg').attr('width', 500).attr('height', 500);
var projection = d3.geoMollweide().scale(400).translate([250,750])
var path = d3.geoPath().projection(projection);
d3.json('test.json', function(error, vData) {
var features = vData.features;
mainSVG.selectAll('path')
.data(features)
.enter().append('path')
.attr('d', path)
.style('fill', 'red')
.style('stroke', 'black');
})
</script>
的GeoJSON的文件:
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "DN": 0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 7.6, 65.0 ], [ 60.4, 65.0 ], [ 60.4, 63.4 ], [ 7.6, 63.4 ], [ 7.6, 65.0 ] ] ] } }
]
}
和由此得出的數字:
交叉發佈爲https://gis.stackexchange.com/q/254184/115 – PolyGeo