mapconcierge / til

TIL - Today I Learned
Creative Commons Zero v1.0 Universal
0 stars 3 forks source link

ogr2ogr を Python で使うためのMEMO #11

Open mapconcierge opened 3 years ago

mapconcierge commented 3 years ago

ogr2ogr

ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
        [-select field_list] [-where restricted_where|\@filename]
        [-progress] [-sql <sql statement>|\@filename] [-dialect dialect]
        [-preserve_fid] [-fid FID] [-limit nb_features]
        [-spat xmin ymin xmax ymax] [-spat_srs srs_def] [-geomfield field]
        [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def] [-ct string]
        [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
        dst_datasource_name src_datasource_name
        [-lco NAME=VALUE] [-nln name]
        [-nlt type|PROMOTE_TO_MULTI|CONVERT_TO_LINEAR|CONVERT_TO_CURVE]
        [-dim XY|XYZ|XYM|XYZM|2|3|layer_dim] [layer [layer ...]]

        # Advanced options
        [-gt n]
        [[-oo NAME=VALUE] ...] [[-doo NAME=VALUE] ...]
        [-clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent]
        [-clipsrcsql sql_statement] [-clipsrclayer layer]
        [-clipsrcwhere expression]
        [-clipdst [xmin ymin xmax ymax]|WKT|datasource]
        [-clipdstsql sql_statement] [-clipdstlayer layer]
        [-clipdstwhere expression]
        [-wrapdateline] [-datelineoffset val]
        [[-simplify tolerance] | [-segmentize max_dist]]
        [-makevalid]
        [-addfields] [-unsetFid] [-emptyStrAsNull]
        [-relaxedFieldNameMatch] [-forceNullable] [-unsetDefault]
        [-fieldTypeToString All|(type1[,type2]*)] [-unsetFieldWidth]
        [-mapFieldType type1|All=type2[,type3=type4]*]
        [-fieldmap identity | index1[,index2]*]
        [-splitlistfields] [-maxsubfields val]
        [-explodecollections] [-zfield field_name]
        [-gcp ungeoref_x ungeoref_y georef_x georef_y [elevation]]* [-order n | -tps]
        [-nomd] [-mo "META-TAG=VALUE"]* [-noNativeData]

参考資料

mapconcierge commented 3 years ago

GDALライブラリのインストール

エラー

$ pip install gdal
Collecting gdal
  Downloading GDAL-3.2.1.tar.gz (604 kB)
     |████████████████████████████████| 604 kB 5.2 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py'"'"'; __file__='"'"'/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-pip-egg-info-9_j8kght
         cwd: /private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/
    Complete output (118 lines):
    running egg_info
    creating /private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-pip-egg-info-9_j8kght/GDAL.egg-info
    writing /private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-pip-egg-info-9_j8kght/GDAL.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-pip-egg-info-9_j8kght/GDAL.egg-info/dependency_links.txt
    writing requirements to /private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-pip-egg-info-9_j8kght/GDAL.egg-info/requires.txt
    writing top-level names to /private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-pip-egg-info-9_j8kght/GDAL.egg-info/top_level.txt
    writing manifest file '/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-pip-egg-info-9_j8kght/GDAL.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 250, in get_gdal_config
        return fetch_config(option, gdal_config=self.gdal_config)
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    __main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 257, in get_gdal_config
        return fetch_config(option)
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 471, in <module>
        setup(**setup_kwargs)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 297, in run
        self.find_sources()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 304, in find_sources
        mm.run()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 535, in run
        self.add_defaults()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/egg_info.py", line 571, in add_defaults
        sdist.add_defaults(self)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 320, in finalize_options
        self.gdaldir = self.get_gdal_config('prefix')
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 263, in get_gdal_config
        raise gdal_config_error(traceback_string + '\n' + msg)
    __main__.gdal_config_error: Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 250, in get_gdal_config
        return fetch_config(option, gdal_config=self.gdal_config)
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 257, in get_gdal_config
        return fetch_config(option)
      File "/private/var/folders/dg/w9dz_yfx17lfwzjygzv_03k40000gn/T/pip-install-do4nztbr/gdal_cf9ca4dcf443487c9b762086483752e9/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'

    Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

参考情報