shp2img¶
- 作者
Jeff McKenna
- 联系方式
jmckenna at gatewaygeomatics.com
- 最后更新
2016-03-11
目的¶
从 Mapfile 创建地图图像。默认情况下,输出为PNG,但可以指定在 Mapfile 中定义的其他输出格式。这是一个非常有用的工具来测试您的 Mapfile 。只需提供 Mapfile 的路径和输出图像的名称,就可以返回图像。如果无法创建图像,将在命令行中显示一个错误,该命令行应引用 Mapfile 中的行号。
句法¶
shp2img -m mapfile [-o image] [-e minx miny maxx maxy] [-s sizex sizey]
[-l "layer1 [layers2...]"] [-i format]
[-all_debug n] [-map_debug n] [-layer_debug n] [-p n] [-c n] [-d
layername datavalue]
-m mapfile: Map file to operate on - required
-i format: Override the IMAGETYPE value to pick output format
-o image: output filename (stdout if not provided)
-e minx miny maxx maxy: extents to render
-s sizex sizey: output image size
-l layers: layers to enable - make sure they are quoted and space separated
if more than one listed
-all_debug n: Set debug level for map and all layers
-map_debug n: Set map debug level
-layer_debug layer_name n: Set layer debug level
-c n: draw map n number of times
-p n: pause for n seconds after reading the map
-d layername datavalue: change DATA value for layer
示例2使用绘制速度生成地图图像¶
shp2img -m gmap75.map -o test2.png -map_debug 3
- 结果
创建名为“test2.png”的文件,并返回层绘制速度,例如:
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawRasterLayerLow(bathymetry): entering.
msDrawMap(): Layer 0 (bathymetry), 0.011s
msDrawMap(): Layer 1 (land_fn), 0.016s
msDrawMap(): Layer 3 (drain_fn), 0.006s
msDrawMap(): Layer 4 (drainage), 0.041s
msDrawMap(): Layer 5 (prov_bound), 0.025s
msDrawMap(): Layer 6 (fedlimit), 0.001s
msDrawMap(): Layer 9 (popplace), 0.007s
msDrawMap(): Drawing Label Cache, 0.004s
msDrawMap() total time: 0.119s
msSaveImage(test2.png) total time: 0.034s
示例3生成包含所有层调试信息的地图图像¶
shp2img -m gmap75.map -o test3.png -all_debug 3
- 结果
创建名为“test3.png”的文件,返回层绘制速度,并且未找到索引QIX文件的一些警告,例如:
msLoadMap(): 0.002s
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawRasterLayerLow(bathymetry): entering.
msDrawRasterLayerGDAL(): Entering transform.
msDrawRasterLayerGDAL(): src=72,418,3077,2308, dst=0,0,400,300
msDrawRasterLayerGDAL(): source raster PL (72.095,417.533) for dst PL (0,0).
msDrawRasterLayerGDAL(): red,green,blue,alpha bands = 1,0,0,0
msDrawMap(): Layer 0 (bathymetry), 0.017s
msSearchDiskTree(): Search returned no results. Unable to open spatial index for D:\ms4w\a
pps\gmap\htdocs/.\../data/land_fn.qix. In most cases you can safely ignore this message, o
therwise check file names and permissions.
msDrawMap(): Layer 1 (land_fn), 0.020s
msSearchDiskTree(): Search returned no results. Unable to open spatial index for D:\ms4w\a
pps\gmap\htdocs/.\../data/drain_fn.qix. In most cases you can safely ignore this message,
otherwise check file names and permissions.
msDrawMap(): Layer 3 (drain_fn), 0.009s
msDrawMap(): Layer 4 (drainage), 0.040s
msSearchDiskTree(): Search returned no results. Unable to open spatial index for D:\ms4w\a
pps\gmap\htdocs/.\../data/province.qix. In most cases you can safely ignore this message,
otherwise check file names and permissions.
msDrawMap(): Layer 5 (prov_bound), 0.029s
msSearchDiskTree(): Search returned no results. Unable to open spatial index for D:\ms4w\a
pps\gmap\htdocs/.\../data/fedlimit.qix. In most cases you can safely ignore this message,
otherwise check file names and permissions.
msDrawMap(): Layer 6 (fedlimit), 0.005s
msDrawMap(): Layer 9 (popplace), 0.007s
msDrawMap(): Drawing Label Cache, 0.005s
msDrawMap() total time: 0.142s
msSaveImage(test3.png) total time: 0.063s
shp2img total time: 0.209s
示例4生成特定层的地图图像¶
shp2img -m gmap75.map -o test4.png -l "bathymetry" -map_debug 3
- 结果
创建一个名为“test4.png”的文件,只返回一个层的层绘制速度,例如:
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawRasterLayerLow(bathymetry): entering.
msDrawMap(): Layer 0 (bathymetry), 0.013s
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.018s
msSaveImage(test4.png) total time: 0.026s
示例5为特定(多)层生成地图图像¶
注解
指定多个图层的语法是:-l“layer1 layer2 layer3 layer4”
shp2img -m gmap75.map -o test5.png -l "bathymetry drain_fn" -map_debug 3
- 结果
将创建一个名为“test5.png”的文件,并且仅返回两个指定层的层绘制速度,例如:
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawRasterLayerLow(bathymetry): entering.
msDrawMap(): Layer 0 (bathymetry), 0.179s
msDrawMap(): Layer 3 (drain_fn), 0.041s
msDrawMap(): Drawing Label Cache, 0.000s
msDrawMap() total time: 0.226s
msSaveImage(test4.png) total time: 0.027s