Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I use Python and FME. I would like to use a transformer "KMLRegionSetter_2" for KML file. I use a fmi file for the transformation.

                    reader.open("repertoryofkml","") ***Is it correct ?***
                    log.log("Reader opened")

                    log.log("Copying schema features")
                    while reader.readSchema(schemaFeature):
                    while reader.read(feature):
                    log.log("Translation completed.")

The arcfactory is

# -------------------------------------------------------------------------
# The region extent is set to be  
# calculated based on the extent   
#  of incoming features.
Tcl2 proc KMLRegionSetter_2_bounding_box_setter { minx maxx miny maxy} { \
    if { [string compare {Yes} {Yes}]==0 } {                           \
      global FME_CoordSys;                                             \
      if { [string length $FME_CoordSys]>0 } {                         \
         FME_Execute Bounds kml_latlonaltbox_west kml_latlonaltbox_east kml_latlonaltbox_south kml_latlonaltbox_north; \
          FME_Execute Reproject \"$FME_CoordSys\" LL84 kml_latlonaltbox_west kml_latlonaltbox_south; \
          FME_Execute Reproject \"$FME_CoordSys\" LL84 kml_latlonaltbox_east kml_latlonaltbox_north; \
       } else {                                                        \
          FME_LogMessage fme_warn \"KMLRegionSetter: A valid coordinate system is required for calculating the region\'s bounding box\"; \
       }                                                               \
    } else {                                                           \
       FME_SetAttribute kml_latlonaltbox_west \"$minx\";               \
       FME_SetAttribute kml_latlonaltbox_east \"$maxx\";               \
       FME_SetAttribute kml_latlonaltbox_south \"$miny\";              \
       FME_SetAttribute kml_latlonaltbox_north \"$maxy\";              \
    }                                                                  \

FACTORY_DEF * TeeFactory                                               \
   FACTORY_NAME KMLRegionSetter_2                                      \
   INPUT  FEATURE_TYPE BoundingBoxAccumulator_BOUNDING_BOX             \
   OUTPUT FEATURE_TYPE KMLRegionSetter_2_OUTPUT                        \
           kml_lod_min_lod_pixels "1500"                               \
            kml_lod_max_lod_pixels "-1"                                \
            kml_lod_min_fade_extent  "0"                               \
            kml_lod_max_fade_extent "0"                                \
            @Log("Before")                                             \
        @Tcl2("KMLRegionSetter_2_bounding_box_setter {<Unused>} {<Unused>} {<Unused>} {<Unused>} ")
        @Log("After")                                              \

Is there a way I can find out if the product is correct?

share|improve this question
A first point of call is to find out: Does it work? –  Hairy Jan 19 '12 at 13:22
I find the first block of code intriguing. How is it that you are making a call to a reader from Python? How do you know the syntax? Where is this API? SWIG, ctypes, or comtypes? –  celticflute Nov 6 '13 at 0:39

1 Answer 1

I just want to make sure you know about the IFMEWorkspaceRunner interface in our API.

I look at what you are doing and can't help but wonder if it would be quicker to use the KMLRegionSetter in Workbench, and just run it programmatically.

Anyway, just a thought.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.