def get_local_copy(self, out_path, includeAttachments=False):
        """ exports the whole feature service to a feature class
            Input:
               out_path - path to where the data will be placed
               includeAttachments - default False. If sync is not supported
                                    then the paramter is ignored.
            Output:
               path to exported feature class or fgdb (as list)
        """
        if self.hasAttachments and \
           self.parentLayer != None and self.parentLayer.syncEnabled:
            return self.parentLayer.createReplica(replicaName="fgdb_dump",
                                                  layers="%s" % self.id,
                                                  attachmentsSyncDirection="upload",
                                                  async=True,
                                                  wait=True,
                                                  returnAttachments=includeAttachments,
                                                  out_path=out_path)[0]
        elif self.hasAttachments == False and \
             self.parentLayer != None and self.parentLayer.syncEnabled:
            return self.parentLayer.createReplica(replicaName="fgdb_dump",
                                                  layers="%s" % self.id,
                                                  attachmentsSyncDirection="upload",
                                                  async=True,
                                                  wait=True,
                                                  returnAttachments=includeAttachments,
                                                  out_path=out_path)[0]
        else:
            result_features = []
            res = self.query(returnIDsOnly=True)
            OIDS = res['objectIds']
            OIDS.sort()
            OIDField = res['objectIdFieldName']
            count = len(OIDS)
            if count <= self.maxRecordCount:
                bins = 1
            else:
                bins = count / self.maxRecordCount
                v = count % self.maxRecordCount
                if v > 0:
                    bins += 1
            chunks = self._chunks(OIDS, bins)
            for chunk in chunks:
                chunk.sort()
                if len(chunk) > 0:
                    sql = "%s >= %s and %s <= %s" % (OIDField, chunk[0],
                                                     OIDField, chunk[len(chunk) -1])
                    temp_base = "a" + uuid.uuid4().get_hex()[:6] + "a"
                    temp_fc = r"%s\%s" % (scratchGDB(), temp_base)
                    temp_fc = self.query(where=sql,
                                         returnFeatureClass=True,
                                         out_fc=temp_fc)
                    result_features.append(temp_fc)
            return merge_feature_class(merges=result_features,
                                       out_fc=out_path)
def get_local_copy ( self , out_path , includeAttachments = False ) : if self . hasAttachments and self . parentLayer != None and self . parentLayer . syncEnabled : return self . parentLayer . createReplica ( replicaName = "fgdb_dump" , layers = "%s" % self . id , attachmentsSyncDirection = "upload" , async = True , wait = True , returnAttachments = includeAttachments , out_path = out_path ) [ 0 ] elif self . hasAttachments == False and self . parentLayer != None and self . parentLayer . syncEnabled : return self . parentLayer . createReplica ( replicaName = "fgdb_dump" , layers = "%s" % self . id , attachmentsSyncDirection = "upload" , async = True , wait = True , returnAttachments = includeAttachments , out_path = out_path ) [ 0 ] else : result_features = [ ] res = self . query ( returnIDsOnly = True ) OIDS = res [ 'objectIds' ] OIDS . sort ( ) OIDField = res [ 'objectIdFieldName' ] count = len ( OIDS ) if count <= self . maxRecordCount : bins = 1 else : bins = count / self . maxRecordCount v = count % self . maxRecordCount if v > 0 : bins += 1 chunks = self . _chunks ( OIDS , bins ) for chunk in chunks : chunk . sort ( ) if len ( chunk ) > 0 : sql = "%s >= %s and %s <= %s" % ( OIDField , chunk [ 0 ] , OIDField , chunk [ len ( chunk ) - 1 ] ) temp_base = "a" + uuid . uuid4 ( ) . get_hex ( ) [ : 6 ] + "a" temp_fc = r"%s\%s" % ( scratchGDB ( ) , temp_base ) temp_fc = self . query ( where = sql , returnFeatureClass = True , out_fc = temp_fc ) result_features . append ( temp_fc ) return merge_feature_class ( merges = result_features , out_fc = out_path )
exports the whole feature service to a feature class
            Input:
               out_path - path to where the data will be placed
               includeAttachments - default False. If sync is not supported
                                    then the paramter is ignored.
            Output:
               path to exported feature class or fgdb (as list)