d3 中的 Lambert 圆锥共形投影 [英] Lambert conic conformal projection in d3

查看:27
本文介绍了d3 中的 Lambert 圆锥共形投影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的祖国奥地利的 SVG 地图上投影一组点([long, lat] 元组):

现在,通过阅读 D3 文档,我可以猜测我必须为投影指定更多参数,例如两个标准平行线.不幸的是,我不知道它们是什么,并且在地图的西部和东部边界周围尝试各种值都没有奏效.我认为它们可以从我对地图的了解中推导出来,或者可能不是?

其次,让我感到困惑的是投影不仅旋转错误而且缩放不正确——我认为使用 .fitSize 可以解决这个问题.

谁能给我任何关于正确设置兰伯特圆锥曲线保角投影的提示?

解决方案

Fitsize 将正确平移和缩放地图,但是,对于圆锥投影,您需要旋转,并按照您的说明设置平行线.

平行线:

有一个记录在案的奥地利兰伯特圆锥等角地图投影,其规格可以在

svg 图像使用的参数可能与发布的参数略有不同(四舍五入、错别字),或者平行线是自定义选择的;然而,这应该是一个相当紧密的配合.

I'm trying to project a set of points ([long, lat] tuples) on top of an SVG map of my home country Austria:

https://commons.wikimedia.org/wiki/File:Austria-geographic_map-blank.svg

The description of the SVG file on Wikimedia gives a projection name and the bounds of the map:

Lambert Conformal Conic, WGS84 datum
Geographic limits of the map:

West: 17.2° W
East: 9.3° W
North: 49.2° N
South: 46.0° N

Naive as I am, I thought this information would be enough to create the right kind of projection with D3.

This is what I tried first:

    let gcc = d3.geoConicConformal()
        .fitSize([width, height], bbox)

Where bbox is a GeoJSON polygon representing the boundaries of the map as given above.

Unfortunately the result is not the correct projection:

Now, from reading the D3 docs I can guess that I have to specify more parameters for the projection, e.g. two standard parallels. Unfortunately I have no idea what they are, and trying various values around the western and eastern boundaries of the map didn't work. I assume they can be derived from what I know about the map though, or maybe not?

Secondly, what confuses me is that the projection is not just wrongly rotated but incorrectly scaled as well -- I thought using .fitSize would take care of that.

Can anybody give me any pointers on correctly setting up a Lambert conic conformal projection?

解决方案

Fitsize will translate and scale the map properly, however, with a conic projection you need to rotate, and as you noted, set the parallels.

Parallels:

There is a documented Austria Lambert Conic Conformal map projection, its specifications can be found here or here. The parallels that likely are correct are in this case are [46,49], though the map you are using could be a custom projection.

Rotation

Now you need to rotate the map, along the x axis by longitude. Conic maps are generally rotated along the x axis and centered on the y axis (see my answer here here for a graphical explanation of why (and how parallels change your projection)).

Rotation moves the world so that your area of interest is aligned properly, such that the central meridian of the map is vertical in your map. Based on the projection specifications noted above, the central meridian should be at 13 degrees, 20 minutes (13.333 degrees), though there is a small disagreement between the two references. Rotation along the x axis is set at the negative of this value.

Using these parameters:

d3.geoConicConformal()
    .parallels([46,49])
    .rotate([-13.333,0])
    .fitSize([width,height],bbox)

I managed a pretty good fit with my very downsampled goto world topojson:

It is possible that the svg image uses parameters that differ slightly from the posted parameters (rounding, typos) or that the parallels are custom selected; however, this should be a fairly tight fit.

这篇关于d3 中的 Lambert 圆锥共形投影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆