kartograph add symbol coordinates

一个人想着一个人 提交于 2019-12-24 21:28:00

问题


I cannot add symbols in my svg map.

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>

And this is the js code:

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?

Someone can help me?


回答1:


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

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.

=)



来源:https://stackoverflow.com/questions/27799912/kartograph-add-symbol-coordinates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!