我需要一个区域地图的网页。 我正试着做的只是有图像的地图上的那个地区加载到网页上,定位点,正如你可以看到在我所附的png文件,并做更多,我喜欢它。在
假设该区域基本上有6个站点,如下面的文本文件所示
#
# some sensor network
#
SN.field_x = 5000
SN.field_y = 2000
SN.numNodes = 6
# Name: station1 type: antenna1
SN.node[0].xCoor = 1000
SN.node[0].yCoor = 800
# Name: station2 type: antenna1
SN.node[1].xCoor = 2000
SN.node[1].yCoor = 808
# Name: station3 type: antenna2
SN.node[2].xCoor = 1800
SN.node[2].yCoor = 743
# Name: station4 type: antenna2
SN.node[3].xCoor = 2061
SN.node[3].yCoor = 747
# Name: station5 type: antenna3
SN.node[4].xCoor = 2325
SN.node[4].yCoor = 753
# Name: station6 type: antenna3
SN.node[5].xCoor = 1689
SN.node[5].yCoor = 681
我需要根据文本文件中的坐标数据在地图上显示这些站的正确位置。 我必须根据这些x&y坐标在地图上定位每个点(这是一个图像)。我试图通过将x&y坐标硬编码到css脚本中作为像素来实现这一点,这将给我所附图片中的页面。但我需要动态加载,因为这些站点将来可能会重新定位。有人告诉我我可以使用python,但我不知道它是如何工作的。拜托,我需要你的帮助。谢谢。在
{1美元^
我的HTML和CSS现在添加到下面
左侧和顶部像素值基于文本文件中的x&y坐标
^{pr2}$
现在我想办法了。。请看它是否有用:(python脚本)
您可以使用CSS3和画布在Javascript中实现这一点。另一种方法是,您可以通过CGI脚本或类似的小django应用程序,用python制作一个新图像。这将为您生成您的图像,因此它的名称类似于:
它将返回一个格式正确的图像,或者您可以按照建议返回CSS文件,或者使用javascript对cgi或django实例进行ajax调用,以获取位置的json,然后您可以使用javascript来定位图像上的位置。在
编辑:
皮尔,这是过时的,但很容易使用,非常适合你的情况。在
http://www.pythonware.com/products/pil/
Django有一个基本的内置HTTP服务器和很多教程。在
https://www.djangoproject.com/
CSS3和帆布
http://www.w3schools.com/tags/ref_canvas.asp
相关问题 更多 >
编程相关推荐