MapServer6.4.1教程学习--包含二个图层的静态地图(1-2)
2015-01-15 23:55
447 查看
包含二个图层的静态地图
(http://www.mapserver.org/tutorial/example1-2.html#example1-2)
![](https://oscdn.geek-share.com/Uploads/Images/Content/202004/18/4fa4fa5de713b9b39456b2548f71faff)
在-第一个例子中,是通过将img标签链接到 /Uploads/Images/Content/202004/18/4fa4fa5de713b9b39456b2548f71faff生成的。这也是本章节绝大多数例子的工作方式。
不管怎么说,你会注意到这幅地图和第一个例子是一样的。是的,但是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所有,请尊重劳动成果,转载将注明出处。
(http://www.mapserver.org/tutorial/example1-2.html#example1-2)
在-第一个例子中,是通过将img标签链接到 /Uploads/Images/Content/202004/18/4fa4fa5de713b9b39456b2548f71faff生成的。这也是本章节绝大多数例子的工作方式。
不管怎么说,你会注意到这幅地图和第一个例子是一样的。是的,但是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教程学习--图层控制(2-2)
- MapServer6.4.1教程学习--添加OGC WMS图层(1-7)
- MapServer6.4.1教程学习--显示图层内类别(1-3)
- MapServer6.4.1教程学习--标注地图(1-4)
- MapServer6.4.1教程学习--添加栅格图层(1-5)
- MapServer6.4.1教程学习--地图交互和浏览器模式(1-9)
- MapServer6.4.1教程学习--定义投影和范围(1-6)
- MapServer6.4.1教程学习--CGI变量和用户接口(2-0)
- MapServer6.4.1教程学习--缩放和漫游控件(2-1)
- [转]Ultra Fractal教程系列32——关于变换的学习07——缩放图层
- 【教程连载】ArcGIS for iOS 开发系列(5) – 基础篇-图层-静态图层
- 小菜的ArcObjects学习之路------如何通过MxDocument访问地图和图层
- google 地图和baidu地图 在android上的实现过程详解和对比 包含 自定义图层的绘制
- google 地图和baidu地图 在android上的实现过程和对比 包含 自定义图层的绘制
- [转]Ultra Fractal教程系列40——蒙版的学习06——添加一个蒙版图层
- ArcGIS教程:向地图中添加图层
- ARCDesktop 学习笔记(一) 添加地图图层
- 学习笔记<二>动态图层的制作,地图Behaviors和Actions的添加
- Cocos2d-x 捕鱼达人游戏学习教程(1)--静态数据模型的创建
- [转]Ultra Fractal教程系列35——蒙版的学习01——图层1:TIA