如何用php突出显示地图中的区域?

发布于 2024-11-14 03:00:14 字数 70 浏览 3 评论 0原文

我有一个 .png 格式的国家地图,我需要使用 PHP 动态突出显示该地图中的特定州。最好的方法是什么?

谢谢

I have a country map in .png format, I need to highlight specific states in this map dynamically using PHP. What's the best way to do this?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野鹿林 2024-11-21 03:00:15

您需要创建定义包围每个状态的多边形的所有点的列表,然后使用 imagepolygon 用某种颜色填充地图图像上适当的多边形。

实际上,您可能想要找到第 3 方库/组件(即 Flash 电影、JavaScript 地图和库,或为此设计的 PHP 类),而不是从头开始自己编写。突出显示地图并不是一个新问题,从头开始再次解决它是乏味的。

You would need to create a list of all the points defining the polygon encasing each state, then use imagepolygon to fill in the appropriate polygons on the map image with some color.

Realistically you probably want to find a 3rd party library/component (i.e. Flash movie, JavaScript map and library, or PHP class designed for this) rather than writing it on your own from scratch. Highlighting a map isn't exactly a new problem and solving it again from scratch is tedious.

倦话 2024-11-21 03:00:15

如果您谈论的是美国各州,我建议您尝试使用 Google 地图和以下链接。我最近将它们用于您正在谈论的确切目的(按州投票),并且效果很好:

http://econym.org.uk/gmap/example_states2.htm

http://econym.org.uk/gmap/epoly.htm

http://econym.org.uk/gmap/states.xml

If you're talking about US States, I would recommend trying Google Maps, and the following links. I used them for the exact purpose you're talking about (votes by state) recently, and it worked great:

http://econym.org.uk/gmap/example_states2.htm

http://econym.org.uk/gmap/epoly.htm

http://econym.org.uk/gmap/states.xml

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文