MapServer6.4.1教程学习--包含二个图层的静态地图(1-2)
来源:互联网 发布:徐州共享网络 编辑:程序博客网 时间:2024/05/22 07:54
包含二个图层的静态地图
(http://www.mapserver.org/tutorial/example1-2.html#example1-2)
在-第一个例子中,是通过将img标签链接到 http://demo.mapserver.org/cgi-bin/mapserv?map=/osgeo/mapserver/tutorial/htdocs/example1-2.map&layer=states_poly&layer=states_line&mode=map生成的。这也是本章节绝大多数例子的工作方式。
不管怎么说,你会注意到这幅地图和第一个例子是一样的。是的,但是mapfile文件是不一样的。让我们来看一看。
# The annotated mapfile (sort of)
# Created byPericles S. Nacionales for the MapServer tutorial
# 20050408
#
# MapServer mapfile uses the pound sign (#) to denote the start of a line
# comment--eachline that needs to be commented has to be prepended with a "#".
#
# Map files beginwith MAP keyword to signify the start of the map object.
# Well, the entiremap file is THE map object. Enclosedbetween MAP and END
# at the verybottom of this map file, are keyword/value pairs and other
# objects.
MAP
IMAGETYPE PNG
EXTENT -97.238976 41.619778 -82.122902 49.385620
SIZE 400 300
SHAPEPATH "/ms4w/apps/tutorial/data"
IMAGECOLOR 255 255 255
# Layerobjects are defined beneath the map object. You need at least one
# layer defined in your map file before youcan display a map... You can
# define as many layers as you'd likealthough a limit is typically hard-coded
# in map.h in the MapServer source. The default limit is set at 100. You'd
# have to have a very specialized applicationto need more than 100 layers in
# your application.
# Start of LAYER DEFINITIONS---------------------------------------------
LAYER # States polygon layer begins here
NAME states_poly
DATA states_ugl
STATUS OFF
TYPE POLYGON
# The class object is defined within thelayer object. You can define as
# many classes as you need (well, there arelimits as with layers, but it's
# senseless to define more than ten on a"normal" layer. There are
# situations, however, where you might haveto do it.)
CLASS
NAME "States"
# There are styles in a class, just likethere are classes in a layer,
# just like there are layers in amap. You can define multiple styles in
# a class just as you can define multipleclasses in a layer and multiple
# layers in a map.
STYLE
COLOR 232 232 232
END
END
END # States polygon layer ends here
LAYER # States line layer begins here
NAME states_line
DATA states_ugl
STATUS OFF
TYPE LINE
CLASS
NAME "State Boundary"
STYLE
COLOR 32 32 32
END
END
END # States line layer ends here
# End of LAYER DEFINITIONS-------------------------------
END # All map filesmust come to an end just as all other things must come to...
MapFile结构
如下是mapfile的对象结构:
这次我们将原始图层拆分成二个图层。第一层仍是多边形层,但是样式(STYLE)对象不再有轮廓线颜色(OUTINECOLOR),就像如下所示:
LAYER
...
TYPE POLYGON
...
CLASS
NAME "States"
STYLE
COLOR 232 232 232
END
END
END
第二层类似于第一层,但它的类型(TYPE)变成了线(LINE),样式(STYLE)里面的颜色(COLOR)与第一个例子中的轮廓线颜色(OUTLINECOLOR)一样。这就会产生和第一个例子一样的图像。
LAYER
...
TYPE LINE
CLASS
NAME "State Boundary"
STYLE
COLOR 32 32 32
END
END
END
那么,为什么要这么做?
如果我们在states层上继续叠加其他层,轮廓线就很可能被这些层覆盖。为了能够在叠加这些层之后还能看到州界,我们就必须要把州界线从州多边形中分离出来,并把它放在其他层之上。这就是我们定义和叠加图层的顺序,这我们本章节接下来的过程中你会更加清楚这一点。
PS:中文版权为asswclw所有,请尊重劳动成果,转载将注明出处。
- MapServer6.4.1教程学习--包含二个图层的静态地图(1-2)
- MapServer6.4.1教程学习--单图层地图(1-1)
- MapServer6.4.1教程学习--标注地图(1-4)
- MapServer6.4.1教程学习--改变地图输出格式(1-8)
- MapServer6.4.1教程学习--地图交互和浏览器模式(1-9)
- MapServer6.4.1教程学习--图层控制(2-2)
- MapServer6.4.1教程学习--显示图层内类别(1-3)
- MapServer6.4.1教程学习--添加栅格图层(1-5)
- MapServer6.4.1教程学习--定义投影和范围(1-6)
- MapServer6.4.1教程学习--缩放和漫游控件(2-1)
- MapServer6.4.1教程学习--CGI变量和用户接口(2-0)
- MapServer6.4.1教程学习--添加OGC WMS图层(1-7)
- mapserver6.4的cmake格式
- 百度地图的静态地图
- jsp的静态包含
- jsp的动态包含和静态包含
- JSP的动态包含与静态包含
- 静态包含和动态包含的区别
- 单片机EEPROM读写问题
- iOS-通过继承UIScrollView来自定义UITableView实现对代理的详解
- Linked List Cycle
- 邹租遵作族卓阻坠住坠捉砖揍昨捉鬃最走
- jpa 查询详解
- MapServer6.4.1教程学习--包含二个图层的静态地图(1-2)
- android之View和LinearLayout的重写(实现背景气泡和波纹效果)
- 赚砖啄组遵拽嘴滓滓棕昨姿走租壮注注装
- 总结:4大javaIDE比较 Eclipse, NetBeans, JDeveloper, and IntelliJ
- 单片机存储未满但却经常死机
- 自写vim插件ldoc.vim,提供智能的lua注释代码补全
- POJ 1001 Exponentiation
- gradle eclipse插件官方下载地址
- 没什么不同,献给即将走向未来的自己