ArcGIS 10文档有时候不准确

在Arcmap 10的Python Window里执行 MosaicToNewRaster_management时,按其文档给出的例子对应修改各个参数,发现总是提示Cannot set input into parameter coordinate_system_for_the_raster错误,即投影文件参数没有设对。

ArcGIS 10文档里的例子:
arcpy.MosaicToNewRaster_management(“land1.tif;land2.tif”, “landnew.tif”, “World_Mercator.prj”, “8_BIT_UNSIGNED”,  “40”, “1”, “LAST”,”FIRST”)

函数原型:
MosaicToNewRaster_management (input_rasters, output_location, raster_dataset_name_with_extension, {coordinate_system_for_the_raster}, {Pixel_type}, {cellsize}, Number_of_bands, {mosaic_method}, {mosaic_colormap_mode})

仔细对照其参数列表,发现参数列表里比例子多了一项,即在投影参数前有两项,一项是输出位置,一项是输出文件名,而不是列子里只有一项。修正后问题仍然存在。

不过现在的问题是找不到投影文件.prj,将之扩展为绝对路径即可以执行。

我猜ArcGIS文档里一些例子是以前版本的,在新版本里参数发现了变化,但例子没有及时更新过来。所以大家在使用时,还是不能尽相信例子,当发现问题的时候,对照函数原型会更靠谱。

Leave a Reply

Your email address will not be published. Required fields are marked *