Example #1
0
 def replace_substring(self, foo, bar):
     """
     Replace substring by given string
     :param foo:
     :param bar:
     :return:
     """
     path = "%s1" % self.file
     io = open(path, "w")
     stream_lines(
         self.file) | filt(lambda l: l.replace(foo, bar)) | to_stream(io)
     self.file = path
 def replace_substring(self,foo,bar):
     """
     Replace substring by given string
     :param foo:
     :param bar:
     :return:
     """
     path='%s1'%self.file
     io=open(path,'w')
     stream_lines(self.file) |\
     filt(lambda l: l.replace(foo, bar)) |\
     to_stream(io)
     self.file=path
 def _get_type(self):
     logging.info("Get type for file: %s" % self.file)
     line = stream_lines(self.file) | nth(0)
     if line.find('ring'):
         return ['ring','esriGeometryPolygon']
     if line.find('multipoint'):
         return ['multipoint','esriGeometryMultipoint']
     if line.find('paths'):
         return ['paths','esriGeometryPolyline']
     if line.find('"x"'):
         return ['point','esriGeometryPoint']
     if line.find('envelope'):
         return ['envelope','esriGeometryEnvelope']
Example #4
0
 def _get_type(self):
     logging.info("Get type for file: %s" % self.file)
     line = stream_lines(self.file) | nth(0)
     if line.find("ring"):
         return ["ring", "esriGeometryPolygon"]
     if line.find("multipoint"):
         return ["multipoint", "esriGeometryMultipoint"]
     if line.find("paths"):
         return ["paths", "esriGeometryPolyline"]
     if line.find('"x"'):
         return ["point", "esriGeometryPoint"]
     if line.find("envelope"):
         return ["envelope", "esriGeometryEnvelope"]
 def _get_type(self):
     logging.info("Get type for file: %s"%self.file)
     line = stream_lines(self.file) | nth(0)
     if line.find('ring'):
         return ['ring','esriGeometryPolygon']
     if line.find('multipoint'):
         return ['multipoint','esriGeometryMultipoint']
     if line.find('paths'):
         return ['paths','esriGeometryPolyline']
     if line.find('"x"'):
         return ['point','esriGeometryPoint']
     if line.find('envelope'):
         return ['envelope','esriGeometryEnvelope']
    def _get_type(self):
        """
        return type of esri simple feature
        :return:
        """
        line = stream_lines(self.file) | nth(0)
        if line.find('ring'):
            return ['ring','"type":"Polygon","coordinates":']
        if line.find('multipoint'):
            return ['multipoint','"type":"MultiPoint","coordinates":']
        if line.find('paths'):
            return ['paths','"type":"MultiLineString","coordinates":']

        if line.find('"x"'):
            grass.fatal('Point is not supported')
        if line.find('envelope'):
            grass.fatal('Envelope is not supported')
Example #7
0
    def _get_type(self):
        """
        return type of esri simple feature
        :return:
        """
        line = stream_lines(self.file) | nth(0)
        if line.find("ring"):
            return ["ring", '"type":"Polygon","coordinates":']
        if line.find("multipoint"):
            return ["multipoint", '"type":"MultiPoint","coordinates":']
        if line.find("paths"):
            return ["paths", '"type":"MultiLineString","coordinates":']

        if line.find('"x"'):
            grass.fatal("Point is not supported")
        if line.find("envelope"):
            grass.fatal("Envelope is not supported")
    def _get_type(self):
        """
        return type of esri simple feature
        :return:
        """
        line = stream_lines(self.file) | nth(0)
        if line.find('ring'):
            return ['ring','"type":"Polygon","coordinates":']
        if line.find('multipoint'):
            return ['multipoint','"type":"MultiPoint","coordinates":']
        if line.find('paths'):
            return ['paths','"type":"MultiLineString","coordinates":']

        if line.find('"x"'):
            grass.fatal('Point is not supported')
        if line.find('envelope'):
            grass.fatal('Envelope is not supported')