如何获取svg的坐标? [英] How to get coordinates of an svg?

查看:483
本文介绍了如何获取svg的坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到svg的坐标?我有一个包含地图的Adobe Illustrator文件,该文件已绘制并分成美国各州,如何找到每个州的坐标?

How can I find out the coordinates of an svg? I have an Adobe Illustrator file that contains a map, this has been drawn and separated into US states, how can I find the coordinates of each state?

我仅以美国地图为例,我将有可能将此技术用于其他几张地图(更多是本地地图!).

I'm just using the US map as an example, I'm going to potentially use this technique for several other maps (much more local!!).

推荐答案

SVG具有XML结构.状态将在<path>标记中,希望将状态名称作为属性.路径的坐标由d属性定义,但是由于它们是相对的或绝对的,并且具有各种类型的曲线,因此它们可能会变得非常复杂.对于曲线,仅考虑最后两个值(曲线的终点)可能是最简单的.

SVG have an XML structure. The states will be in <path> tags, hopefully with the name of the state somewhere as an attribute. The coordinates of a path are defined by the d attribute, but they can get quite complex as they can be relative or absolute and have various types of curves. With curves, it's probably simplest to consider just the final two values, which is where the curve ends.

有关详细信息,请参见: http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation

For full details, see: http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation

如果将进一步的变换应用于路径,则情况可能会更加复杂.祝你好运!

The situation may be more complex if further transforms are applied to the paths. Good luck!

这篇关于如何获取svg的坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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