kartograph添加符号坐标 [英] kartograph add symbol coordinates

查看:89
本文介绍了kartograph添加符号坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在svg映射中添加符号.

I cannot add symbols in my svg map.

这是我的svg的元数据:

This is the metadata of my svg:

<metadata><views>
<view h="720.449987754" padding="0" w="1400">
    <proj flip="auto" id="robinson" lon0="-49.8982700875"/>
    <bbox h="57.01" w="79.24" x="-771.91" y="435.26"/></view></views>
</metadata>

这是js代码:

var points_of_interest = [
{ name: 'Florianopolis', lat: -27.60, lon: -48.55}
];
map.addSymbols({
type: kartograph.LabeledBubble,
data: points_of_interest,
location: function(d) { return [d.lon, d.lat] },
title: function(d) { return d.name; },
radius: 3,
center: false,
attrs: { fill: 'black' },
labelattrs: { 'font-size': 11 },
buffer: true
});

我不知道坐标是错误的还是整个代码是错误的.

I don't know if the coordinates are wrong or the whole code is wrong.

是否可以通过路径标签获取坐标?

Is there some way to get the coordinates from the path tags?

有人可以帮助我吗?

推荐答案

搜索答案我发现了这个问题:

Searching for answers I found this question : Kartograph python script generates SVG with incorrect lat/long coords

然后,我意识到我的svg地图具有投影类型robinson.在此投影中,经度不同. 该地图是使用kartograph py生成的,我在config.json中没有指出要使用的投影类型.我再次使用投影"laea"生成了svg,现在一切正常.

Then, I realized that my svg map is with projection type robinson. In this projection the longitudes are different. The map was generated with kartograph py and I have not indicated in config.json what the projection type to use. I generated the svg again using projection 'laea' and now it's all ok.

=)

这篇关于kartograph添加符号坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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