Ejemplo n.º 1
0
def main():

    if 'GRASS' in options['driver']:
        grass.debug("Using GRASS driver")
        from wms_drv import WMSDrv
        wms = WMSDrv()
    elif 'GDAL' in options['driver']:
        grass.debug("Using GDAL WMS driver")
        from wms_gdal_drv import WMSGdalDrv
        wms = WMSGdalDrv()

    if flags['c']:
        wms.GetCapabilities(options)
    else:
        from wms_base import GRASSImporter
        options['region'] = GetRegionParams(options['region'])
        fetched_map = wms.GetMap(options, flags)

        grass.message(_("Importing raster map into GRASS..."))
        if not fetched_map:
            grass.warning(
                _("Nothing to import.\nNo data has been downloaded from wms server."
                  ))
            return
        importer = GRASSImporter(options['output'])
        importer.ImportMapIntoGRASS(fetched_map)

    return 0
Ejemplo n.º 2
0
def main():

    if 'GRASS' in options['driver']:
        grass.debug("Using GRASS driver")
        from wms_drv import WMSDrv
        wms = WMSDrv()
    elif 'GDAL' in options['driver']:
        grass.debug("Using GDAL WMS driver")
        from wms_gdal_drv import WMSGdalDrv
        wms = WMSGdalDrv()

    if flags['c']:
        wms.GetCapabilities(options)
    else:
        from wms_base import GRASSImporter
        # set proxy
        if options['proxy'] and options['proxy_user_pw']:
            wms.setProxy(options['proxy'], options['proxy_user_pw'])
        if options['proxy']:
            wms.setProxy(options['proxy'])
            if 'GRASS' in options['driver']:
                grass.warning(_("The proxy will be ignored by the choosen GRASS driver. It is only used with the GDAL driver."))

        options['region'] = GetRegionParams(options['region'])
        fetched_map = wms.GetMap(options, flags)

        grass.message(_("Importing raster map into GRASS..."))
        if not fetched_map:
            grass.warning(_("Nothing to import.\nNo data has been downloaded from wms server."))
            return
        importer = GRASSImporter(options['output'], (not flags['b']))
        importer.ImportMapIntoGRASS(fetched_map)

    return 0
Ejemplo n.º 3
0
def main():
    options['region'] = GetRegion()

    if 'GRASS' in options['driver']:
        grass.debug("Using GRASS driver")
        from wms_drv import WMSDrv
        wms = WMSDrv()
    elif 'GDAL' in options['driver']:
        grass.debug("Using GDAL WMS driver")
        from wms_gdal_drv import WMSGdalDrv
        wms = WMSGdalDrv()

    temp_map = wms.GetMap(options, flags)
    os.rename(temp_map, os.environ["GRASS_RENDER_FILE"])

    return 0
Ejemplo n.º 4
0
def main():
    options["region"] = GetRegion()

    if "GRASS" in options["driver"]:
        grass.debug("Using GRASS driver")
        from wms_drv import WMSDrv

        wms = WMSDrv()
    elif "GDAL" in options["driver"]:
        grass.debug("Using GDAL WMS driver")
        from wms_gdal_drv import WMSGdalDrv

        wms = WMSGdalDrv()

    temp_map = wms.GetMap(options, flags)
    shutil.move(temp_map, os.environ["GRASS_RENDER_FILE"])

    return 0
Ejemplo n.º 5
0
def main():
    sys.path.insert(
        1, os.path.join(os.path.dirname(sys.path[0]), "etc", "r.in.wms"))

    if "GRASS" in options["driver"]:
        grass.debug("Using GRASS driver")
        from wms_drv import WMSDrv

        wms = WMSDrv()
    elif "GDAL" in options["driver"]:
        grass.debug("Using GDAL WMS driver")
        from wms_gdal_drv import WMSGdalDrv

        if options["gdal_createopt"]:
            create_options = options["gdal_createopt"].split(",")
        else:
            create_options = None
        wms = WMSGdalDrv(create_options)

    if flags["c"]:
        wms.GetCapabilities(options)
    else:
        from wms_base import GRASSImporter

        # set proxy
        if options["proxy"] and options["proxy_user_pw"]:
            wms.setProxy(options["proxy"], options["proxy_user_pw"])
        if options["proxy"]:
            wms.setProxy(options["proxy"])
            if "GRASS" in options["driver"]:
                grass.warning(
                    _("The proxy will be ignored by the choosen GRASS driver. It is only used with the GDAL driver."
                      ))

        options["region"] = GetRegionParams(options["region"])
        fetched_map = wms.GetMap(options, flags)

        grass.message(_("Importing raster map into GRASS..."))
        if not fetched_map:
            grass.warning(
                _("Nothing to import.\nNo data has been downloaded from wms server."
                  ))
            return
        importer = GRASSImporter(options["output"], (not flags["b"]))
        importer.ImportMapIntoGRASS(fetched_map)

    return 0
Ejemplo n.º 6
0
def main():

    if 'GRASS' in options['driver']:
        grass.debug("Using GRASS driver")
        from wms_drv import WMSDrv
        wms = WMSDrv()
    elif 'GDAL' in options['driver']:
        grass.debug("Using GDAL WMS driver")
        from wms_gdal_drv import WMSGdalDrv
        wms = WMSGdalDrv()

    if flags['c']:
        wms.GetCapabilities(options)
    else:
        from wms_base import GRASSImporter
        options['region'] = GetRegionParams(options['region'])
        importer = GRASSImporter(options['output'])
        fetched_map = wms.GetMap(options, flags)
        importer.ImportMapIntoGRASS(fetched_map)

    return 0