#!#!

" log_max_recorded_features="200" show_info_nodes="true" fme_document_priorguid="82e9a0eb-40b8-4f79-bcb8-004325a5e6d6" source="NONE" usage="


" terminate_rejected="YES" password="" use_markdown="" destination_routing_file="" fme_implicit_csmap_reprojection_mode="Auto" category="" workspace_version="1" markdown_usage="" zoom_scale="100" begin_python="" history="" explicit_bookmark_order="false" begin_tcl="" ignore_reader_failure="No" python_compatibility="27" fme_server_services="" last_save_build="FME(R) 2017.0.1.1 (20170512 - Build 17291 - WIN32)" redirect_terminators="NONE" doc_extents="1752.51 656.005" multi_writer_dataset_order="BY_ID" source_routing_file=""> #! #!#! #!#! #!#! #!#! #!#! #!#! #!

XQuery Type:
    XQuery Input: XQuery expression
    XQuery Expression:

----------

delete node //tag[@k="ProductionPointCategory"],

insert node <tag k="keyName" v="{fme:get-attribute("keyName")}"/> into //node

----------
XML Source:
    XML Input: Attribute specifying XML
    XML Attribute: _xml

" POSITION="346.123 353.753" TOP_LEFT="346.123 353.753" BOTTOM_RIGHT="1096.12 303.753" BOUNDING_RECT="346.123 353.753 750 50" ORDER="5e+14" FOLLOW_ANCHOR="true" INFO_NODE="false" COLOUR="1,1,0.784314,0.192157" SIZE_POLICY="8" COMMENT_TYPE="REGULAR" ANCHORED_NODE="5">
#!
#! #!#! #!#! #! #!#!#!#!#!#!#!#!#!#!#!#!#!#! #!#!#!#!#!#!nodelat=56.07686365lon=12.11483240id=800000002changeset=1timestamp=2017-09-10T20:50:35.826Zversion=1tagk=ActiveFromv=1900-01-01T02:00:00.000000000Ztagk=ActiveTov=3000-01-01T01:59:59.000000000Ztagk=ProductionPointCategoryv=4node keyName SET_TO value">#!#!#!#!#!#!#!#!#! #!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#! #!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#!#! #!#!#!#!#! #!#! #!#! #!#! #!#!
FME_PYTHON_VERSION 27 # !START_HEADER # !START_WB_HEADER READER_TYPE NULL READER_KEYWORD NULL_SOURCE NULL_SOURCE_DATASET NULL WRITER_TYPE NULL WRITER_KEYWORD NULL_DEST NULL_DEST_DATASET NULL #!END_WB_HEADER # !START_WB_HEADER # !END_WB_HEADER # !END_HEADER LOG_FILENAME "$(FME_MF_DIR)xmlxqueryupdater-example.log" LOG_APPEND NO LOG_MAX_FEATURES 200 LOG_MAX_RECORDED_FEATURES 200 FME_REPROJECTION_ENGINE FME FME_IMPLICIT_CSMAP_REPROJECTION_MODE Auto FME_GEOMETRY_HANDLING Enhanced FME_STROKE_MAX_DEVIATION 0 LOG_FILTER_MASK -1 #------------------------------------------------------------------------- MULTI_READER_CONTINUE_ON_READER_FAILURE没有 # ------------------------------------------------------------------------- 宏WORKSPACE_NAME xmlxqueryupdater-example宏观FME_VIEWER_APP fmedatainspector #------------------------------------------------------------------------- 包括(如果{[信息存在env (FME_TEMP) & &(文件isdirectory $ env (FME_TEMP)]}{设置gVisualizerTemp $ env (FME_TEMP)} elseif{[信息存在env(临时)& &(文件isdirectory $ env(临时)]}{设置gVisualizerTemp $ env(临时)}elseif {$ tcl_platform(平台)= =“unix”}{集gVisualizerTemp "/tmp"} else{设置gVisualizerTemp c:}; regsub -all {[ ,&]} {$(WORKSPACE_NAME)} {_} wsname; set gVisualizerTemp $gVisualizerTemp/${wsname}_[clock format [clock seconds] -format %H%M%S]; puts "MACRO WORKSPACE_TEMP_DIR $gVisualizerTemp"; MACRO VISUALIZER_FEATURE_FILE $(WORKSPACE_TEMP_DIR)/inspector.ffs MACRO VISUALIZER_SCHEMA_FILE $(WORKSPACE_TEMP_DIR)/inspector.fsc MACRO VISUALIZER_CREATE_SPATIAL_INDEX YES DEFAULT_MACRO WB_CURRENT_CONTEXT # ------------------------------------------------------------------------- Tcl2 proc Creator_CoordSysRemover {} { global FME_CoordSys; set FME_CoordSys {}; } MACRO Creator_XML NOT_ACTIVATED MACRO Creator_CLASSIC NOT_ACTIVATED MACRO Creator_2D3D 2D_GEOMETRY MACRO Creator_COORDS INCLUDE [if {{Geometry Object} == {Geometry Object}} {puts {MACRO Creator_XML *}}] {if {{Geometry Object} == {2D Coordinate List}} {puts {MACRO Creator_2D3D 2D_GEOMETRY};[if {{Geometry Object} == {3D坐标列表}}{puts {MACRO Creator_2D3D 3D_GEOMETRY};{{Geometry Object} == {2D Min/Max Box}} {set comment{我们需要将坐标minX minY maxX maxY转换为一个完整的多边形坐标列表};set splitCoords [split [string trim]{/ /设置字符串长度 }]];如果{[llength $splitCoords] > 4} {set trimmedCoords {};foreach item $splitCoords {if {$item != {}} {lappend trimmedCoords $item}};设置splitCoords trimmedCoords美元;};如果{[llength $splitCoords] != 4} {error {Creator:坐标列表应该是一个以空格分隔的列表,包含4个数字,如'minx miny maxx max ' - ' 的是无效的};};设置minX [lindex $splitCoords 0];set minY [lindex $splitCoords 1]; / /设置lindex $splitCoords 1set maxX [lindex $splitCoords 2]; / /设置索引set maxY [lindex $splitCoords 3]; / /设置maxY"MACRO creatator_coords $minX $minY $minX $max $maxX $max $maxX $minY $minX $minY";{MACRO Creator_2D3D 2D_GEOMETRY};{MACRO Creator_CLASSIC *}}] FACTORY_DEF $(Creator_XML) CreationFactory FACTORY_NAME Creator_XML_Creator CREATE_AT_END no OUTPUT FEATURE_TYPE _____CREATED______ @Geometry(FROM_ENCODED_STRING, xml ? 版本= 1.0 编码= US_ASCII 独立的= 没有 几何 尺寸= 2 几何 ) FACTORY_DEF $(Creator_CLASSIC) CreationFactory FACTORY_NAME Creator_CLASSIC_Creator $(Creator_2D3D) $(Creator_COORDS) CREATE_AT_END no OUTPUT FEATURE_TYPE _____CREATED______ FACTORY_DEF * TeeFactory FACTORY_NAME creator_clone INPUT FEATURE_TYPE _____CREATED______ NUMBER_OF_COPIES 1 OUTPUT FEATURE_TYPE Creator_CREATED . txt@Tcl2 (Creator_CoordSysRemover) @CoordSys () fme_feature_type创造者FACTORY_DEF * BranchingFactory FACTORY_NAME“Creator_CREATED布兰凯尔1 4”输入FEATURE_TYPE Creator_CREATED TARGET_FACTORY " $ (WB_CURRENT_CONTEXT) _CREATOR_BRANCH_TARGET“输出通过FEATURE_TYPE * @RemoveAttributes(“Creator_CREATED布兰凯尔1 4”.BranchingFactory.Count) #------------------------------------------------------------------------- FACTORY_DEF * TeeFactory FACTORY_NAME " $ (WB_CURRENT_CONTEXT) _CREATOR_BRANCH_TARGET“输入输出FEATURE_TYPE FEATURE_TYPE * * # ------------------------------------------------------------------------- FACTORY_DEF * AttrSetFactory FACTORY_NAME AttributeCreator输入FEATURE_TYPE creatator_created MULTI_FEATURE_MODE NO NULL_ATTR_MODE NO_OP ATTRSET_CREATE_DIRECTIVES _PROPAGATE_MISSING_FDIV ATTR_ACTION "" _xml" "SET_TO" " 节点 拉特= 56.07686365 朗= 12.11483240 id = 800000002 变更集= 1 时间戳= 2017 - 09 - 10 - t20:50:35.826z 版本= 1 标签 k = ActiveFrom v = 1900 - 01 - 01 - t02:00:00.000000000z 标签 k = ActiveTo v = 3000 - 01 - 01 - t01:59:59.000000000z 标签 k = ProductionPointCategory v = 4 节点 ”“ATTR_ACTION keyName”“SET_TO”“价值”输出输出FEATURE_TYPE AttributeCreator_OUTPUT # ------------------------------------------------------------------------- FACTORY_DEF * XQueryFactory FACTORY_NAME XMLXQueryUpdater输入SOURCE_DOCUMENT FEATURE_TYPE AttributeCreator_OUTPUT XQUERY_EXPR删除 节点 标签 k = ProductionPointCategory 插入 节点 标签 k = keyName v = fme: get-attribute keyName 节点xml_attr _xml模式single_feature结果_attr _xml use_w3c_update_extensions是输出query_results feature_type xmlxqueryupdater_query_results#------------------------------------------------------------------------------------------- #--#假设工作空间TEMP DIR已被设置创建。请参阅contreolyefs.cpp - controlyefs :: writevisualizertempdir default_macro workspace_temp_dir包括[设置grpbyattrs {};if {[字符串长度$ grpbyatts]> 0} {if {[string first“@evaluateExpression”$ grpbyattrs“== 0} {puts”宏Catmac _ $ grpbyattrs“;}否则{set catter“”;设置逗号“”;Foreach attr $ grpbyattrs {set catter“$ catter $ coma $ @ Value(\”$ attr \“)”;设置逗号“,_,”;};把“宏Catmac _ @ concatenate($ catter)”; } } else { puts "MACRO CATMAC " ; }; set safeName "[regsub -all {[^a-zA-Z0-9]} {Inspector} _]_[expr round(rand() * 1000000)]_[clock clicks -milliseconds]"; puts "MACRO SAFE_FFS_NAME $safeName"; ] # Make the temporary directory that the FFS files will live in. FACTORY_DEF * CreationFactory FACTORY_NAME Inspector_DirCreator OUTPUT FEATURE_TYPE __nukeme__ @Tcl2("catch {file mkdir {$(WORKSPACE_TEMP_DIR)}}") FACTORY_DEF * TeeFactory FACTORY_NAME Inspector_DirCreatorCleanerUpper INPUT FEATURE_TYPE __nukeme__ # Send raster, point cloud and vector features down different paths to prepare # them for viewing FACTORY_DEF * TestFactory FACTORY_NAME Inspector_FeatureDirector INPUT FEATURE_TYPE XMLXQueryUpdater_QUERY_RESULTS TEST &fme_type == "fme_raster" OUTPUT FAILED FEATURE_TYPE Inspector___NotRasterFeatures___ OUTPUT PASSED FEATURE_TYPE Inspector___RasterFeatures___ FACTORY_DEF * TestFactory FACTORY_NAME Inspector___FeatureDirector1 INPUT FEATURE_TYPE Inspector___NotRasterFeatures___ TEST &fme_type == "fme_point_cloud" OUTPUT FAILED FEATURE_TYPE Inspector___VectorFeatures___ OUTPUT PASSED FEATURE_TYPE Inspector___PointCloudFeatures___ # Vector features simply may get their colors overridden FACTORY_DEF * TeeFactory FACTORY_NAME Inspector_VectorSetterUpper INPUT FEATURE_TYPE Inspector___VectorFeatures___ OUTPUT FEATURE_TYPE __viewme__ # Point Cloud Features Might Need to be thinned # Note that we don't call the ThinPointCloud function directly, but rather # do it through TCL. This should allow this transformer to be used with a # Desktop license, even though ThinPointCloud requires Professional. Tcl2 proc Inspector_e5793596_06e0_47c5_9980_ef994f3958893_thinPointCloud {} { if {[string equal {NO_THINNING} {KEEPNPOINT}]} { FME_Execute ThinPointCloud NO_THINNING "\" \ ";} elseif {[string equal {no_thin} {MAXNUMPOINTS}]} {FME_Execute ThinPointCloud no_thin "\" \ ";} elseif {[string equal {no_thin} {FIRSTNPOINTS}]} {FME_Execute ThinPointCloud no_thin "\" \ ";} elseif {[string equal {no_thin} {LASTNPOINTS}]} {FME_Execute ThinPointCloud no_thin "\" \ ";};} FACTORY_DEF * TeeFactory FACTORY_NAME Inspector___PointCloudThinner输入FEATURE_TYPE Inspector___PointCloudFeatures___输出FEATURE_TYPE __viewme__ @Tcl2 (Inspector_e5793596_06e0_47c5_9980_ef994f3958893_thinPointCloud) Tcl2 proc Inspector_e5793596_06e0_47c5_9980_ef994f3958893_prepareRaster {subsetStartRow subsetNumRows subsetStartColsubsetNumCols} {set useDI [string equal -nocase {$(FME_VIEWER_APP)} {fmedatainspector}];如果{!$useDI} {FME_Execute ApplyRasterRotation BILINEAR;};设置doResample [string equal {NoReduction} {Resample}];set doSubset [string equal {NoReduction} {Subset}]; / /设置一个子集设置doBounds [string equal {NoReduction} {BoundingBoxOnly}]; if {$doBounds} { FME_Execute GeometryType fme_polygon; } elseif {$doResample || $doSubset} { set comment { First, we need to prefix all the attributes. This is done because we are going to call @RasterProperties, and we want to make sure it doesn't overwrite any existing attributes. }; set kAttrPrefix "."; set allNames [FME_AttributeNames]; foreach oldName $allNames { set newName $kAttrPrefix; append newName $oldName; FME_RenameAttribute $newName $oldName; }; FME_Execute RasterProperties RASTER; if {$doResample} { set oldNumCols [FME_GetAttribute _num_columns]; set oldNumRows [FME_GetAttribute _num_rows]; set oldSpacingX [FME_GetAttribute _spacing_x]; set oldSpacingY [FME_GetAttribute _spacing_y]; set kMinNumCells 32; set kMaxNumCells 512; set comment { We will only resample if both dimensions are greater than the minimum num cells, and at least one is greater than the maximum. }; if {$oldNumRows > $kMinNumCells && $oldNumCols > $kMinNumCells && ($oldNumRows > $kMaxNumCells || $oldNumCols > $kMaxNumCells)} { set newSpacingX 1.0; set newSpacingY 1.0; if {$oldNumRows > $oldNumCols} { set comment { If we have more rows than columns, we need to choose a spacing that reduces the number of rows to the maximum we've chosen. }; set newSpacingY [expr 1.0 * $oldNumRows * $oldSpacingY / $kMaxNumCells]; set newSpacingX [expr 1.0 * $newSpacingY / $oldSpacingY * $oldSpacingX]; set comment { Now we need to check if doing this will result in the columns going below the minimum. If so, choose the spacing such that we only go down to the minimum (and not past). }; set newNumCols [expr $oldNumCols * $oldSpacingX / $newSpacingX]; if {$newNumCols < $kMinNumCells} { set newSpacingX [expr 1.0 * $oldNumCols * $oldSpacingX / $kMinNumCells]; set newSpacingY [expr 1.0 * $newSpacingX / $oldSpacingX * $oldSpacingY]; }; } else { set comment { This is identical to the above case, except the roles of rows and cols are reversed. }; set newSpacingX [expr 1.0 * $oldNumCols * $oldSpacingX / $kMaxNumCells]; set newSpacingY [expr 1.0 * $newSpacingX / $oldSpacingX * $oldSpacingY]; set newNumRows [expr $oldNumRows * $oldSpacingY / $newSpacingY]; if {$newNumRows < $kMinNumCells} { set newSpacingY [expr 1.0 * $oldNumRows * $oldSpacingY / $kMinNumCells]; set newSpacingX [expr 1.0 * $newSpacingY / $oldSpacingY * $oldSpacingX]; }; }; FME_Execute ResampleRaster CELL_SIZE $newSpacingX $newSpacingY NearestNeighbor; }; } elseif {$doSubset} { set comment { Get the value of some strings that may be attributes or constants. Note that we pass in the attribute prefix we're using, because if one does turn out to be an attribute, it won't actually be the exact name in the string (since we renamed all our attributes above). }; set rasterNumRows [FME_GetAttribute _num_rows]; set rasterNumCols [FME_GetAttribute _num_columns]; set comment { Only do subsetting if the specified start position is actually within the raster. }; if {$subsetStartRow < $rasterNumRows && $subsetStartCol < $rasterNumCols} { set comment { Now bound the subset to the size of the raster, so that we don't create padding. }; if {[expr $subsetStartRow + $subsetNumRows] > $rasterNumRows} { set subsetNumRows [expr $rasterNumRows - $subsetStartRow]; }; if {[expr $subsetStartCol + $subsetNumCols] > $rasterNumCols} { set subsetNumCols [expr $rasterNumCols - $subsetStartCol]; }; FME_Execute SubsetRaster $subsetStartRow $subsetNumRows $subsetStartCol $subsetNumCols; }; }; set comment { Remove all the attributes added by @RasterProperties and remove the prefix from the real attributes. We assume they all start with an underscore. }; FME_Execute RemoveAttributes fme_regexp_match {^_}; foreach oldName $allNames { set newName $kAttrPrefix; append newName $oldName; FME_RenameAttribute $oldName $newName; }; }; } FACTORY_DEF * TeeFactory FACTORY_NAME Inspector_RasterSetterUpper INPUT FEATURE_TYPE Inspector___RasterFeatures___ OUTPUT FEATURE_TYPE __viewme__ @Tcl2("Inspector_e5793596_06e0_47c5_9980_ef994f3958893_prepareRaster { } { } { } { # Inspector_e5793596_06e0_47c5_9980_ef994f3958893_VIS_FEAT_TYPE更改正在可视化的特性的特性类型#。DEFAULT_MACRO Inspector_e5793596_06e0_47c5_9980_ef994f3958893_VIS_FEAT_TYPE Inspector$(CATMAC) DEFAULT_MACRO VISUALIZER_FEATURE_FILE $(WORKSPACE_TEMP_DIR)/$(亚搏在线SAFE_FFS_NAME)。数据检查器将限制它在WIN32上读取的最大特性数量,因此我们将相应地限制使用MAX_FEATURES_TO_RECORD指令记录的#特性数量。FACTORY_DEF * RecorderFactory FACTORY_NAME Inspector_Recorder INPUT FEATURE_TYPE __viewme__ _wb_termination_feature Yes @FeatureType(TERMINATOR_@Value(_wb_termination_xformer)) INPUT FEATURE_TYPE __viewme__ @FeatureType($(Inspector_e5793596_06e0_47c5_9980_ef994f3958893_VIS_FEAT_TYPE)) FEATURE_FILE "$(VISUALIZER_FEATURE_FILE)"CREATE_SPATIAL_INDEX " $ (VISUALIZER_CREATE_SPATIAL_INDEX) "检查员" $ (VISUALIZER_CREATE_SPATIAL_INDEX) "种FSC_SCHEMA _xml、varchar 255 keyName, varchar 255 Mode Record Store_scanned_metadata record_directly_to_disk是max_features_to_record win32 2000000#---------------------------------------------------------------------------------------------------输出路由功能_type *输出not_routed feature_type __nuke_me___ @ tcl2(“fme_statmessage 818059 [fme_getattribute fme_template_feature_type] 818060 818061 fme_warn”)#------------------------------------------------------------------ Factory_def * teefactoryfactory_name“最终输出nuker”输入feature_type __nuke_me__#--------------------------------------------------------------------------------------------- Factory_def * creationfactory create_at_end输出feature_type __nukeme__ @tcl(“如果[文件存在{$(workspace_temp_dir)}] {set文件[glob -nocompline -directory {$(workspace_temp_dir)} -tails * .ffs];如果{[llength $ files]== 1} {set thefile {$(workspace_temp_dir)/};附加文件[Lindex $文件0];eval fme_execute system \ 173 \ 042 $(fme_home_unix)/ fmedatainspector \ 042 --visualizer --single-application - delete-on-close --no-source-prompt -f ffs $ thefile&\ 175;} elsef {[llength $ files] == 0} {catch {file delest -force {$(workspace_temp_dir)};} else {set filesnoext {}; set lastfile {}; foreach {fileName} [lsort $files] { set fileNoExt [string trimright $fileName {.ffs}]; if [regexp {(.*)_[0-9]*$} $fileNoExt wholething fileNoExtBase] { if { $fileNoExtBase == $lastfile } { continue } }; set lastfile $fileNoExt; lappend filesNoExt $fileNoExt }; eval FME_Execute System \173\042$(FME_HOME_UNIX)/fmedatainspector\042 --visualizer --single-application --delete-on-close --no-source-prompt -d {$(WORKSPACE_TEMP_DIR)} -a ffs -f FFS $filesNoExt & \175; }; }; ") FACTORY_DEF * TeeFactory INPUT FEATURE_TYPE __NUKEME__