def grassEpsg():
    proj = Module('g.proj',
               flags='p',
               quiet=True,
               stdout_=PIPE)
    proj = proj.outputs.stdout
    lines = proj.splitlines()
    for e,line in enumerate(lines):
        if 'EPSG' in line:
            epsg = lines[e+1].split(':')[1].replace(' ','')
            print('epsg=%s' % epsg)
            if flags['s']:
                if isPermanent():
                    writeEPSGtoPEMANENT(epsg)
                else:
                    grass.warning("Unable to access PERMANENT mapset")
            return
    try:
        proj = Module('g.proj',
               flags='wf',
               quiet=True,
               stdout_=PIPE)
        proj = proj.outputs.stdout
        wkt2standards(proj)
    except:
        grass.error('WKT input error')
Beispiel #2
0
    def getEPSG(self):
        proj=Module('g.proj',
                   flags='p',
                   quiet=True,
                   stdout_=PIPE)

        proj=proj.outputs.stdout
        lines=proj.splitlines()
        for e,line in enumerate(lines):
            if 'EPSG' in line:
                epsg=lines[e+1].split(':')[1].replace(' ','')
                return epsg

        proj=Module('g.proj',
                   flags='wf',
                   quiet=True,
                   stdout_=PIPE)
        proj=proj.outputs.stdout

        epsg = self.wkt2standards(proj)

        if not epsg:
            return None
        else:
            return epsg
Beispiel #3
0
    def _parseVDbConn(self, mapp, layerInp):
        '''find attribute key according to layer of input map'''
        vdb = Module('v.db.connect', map=mapp, flags='g', stdout_=PIPE)

        vdb = vdb.outputs.stdout
        for line in vdb.splitlines():
            lsplit = line.split('|')
            layer = lsplit[0].split('/')[0]
            if str(layer) == str(layerInp):
                return lsplit[2]
        return None
Beispiel #4
0
    def _parseVDbConn(self, mapp, layerInp):
        '''find attribute key according to layer of input map'''
        vdb = Module('v.db.connect', map=mapp, flags='g', stdout_=PIPE)

        vdb = vdb.outputs.stdout
        for line in vdb.splitlines():
            lsplit = line.split('|')
            layer = lsplit[0].split('/')[0]
            if str(layer) == str(layerInp):
                return lsplit[2]
        return None
Beispiel #5
0
def grassEpsg():
    proj = Module("g.proj", flags="p", quiet=True, stdout_=PIPE)
    proj = proj.outputs.stdout
    lines = proj.splitlines()
    for e, line in enumerate(lines):
        if "EPSG" in line:
            epsg = lines[e + 1].split(":")[1].replace(" ", "")
            print("epsg=%s" % epsg)
            if flags["s"]:
                if isPermanent():
                    writeEPSGtoPEMANENT(epsg)
                else:
                    grass.warning("Unable to access PERMANENT mapset")
            return
    try:
        proj = Module("g.proj", flags="wf", quiet=True, stdout_=PIPE)
        proj = proj.outputs.stdout
        wkt2standards(proj)
    except:
        grass.error("WKT input error")