view ogr2ogr.xml @ 3:e12db3b4d3a6 draft default tip

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/gdal commit b8d429fc9c59d401a4a55fcd806050939ed41b8b
author ecology
date Thu, 20 Jun 2019 06:53:44 -0400
parents 22c54afd1cf3
children
line wrap: on
line source

<tool id="gdal_ogr2ogr" name="OGR2ogr" version="@VERSION@">
    <description>converts simple features data between file formats</description>
    <macros>
        <import>gdal_macros.xml</import>
    </macros>
    <expand macro="gdal_requirements" />
    <command detect_errors="exit_code"><![CDATA[
        #if $input.is_of_type("tabular")
            cp '$input' '$input''.tsv' &&
        #end if 
        ogr2ogr
            -f '$f'
            #if $f=='ESRI Shapefile'
                'shapefile.shp'
            #else
                'output'
            #end if
            #if $input.is_of_type("shp")
                ${os.path.join( $input.extra_files_path, 'shapefile.shp' )} 
            #else if $input.is_of_type("tabular")
                '$input''.tsv'
            #else
                '$input'
            #end if
            #if $settings.advanced=='advanced'
                #for $i in $settings.series_oo
                    #if str('${i.oo}').strip()!=''
                       -oo ${i.oo}
                    #end if
                #end for
            #end if
            #if $f=='ESRI Shapefile'
                &&
                mkdir ${shapefile.extra_files_path} &&
                mv shapefile.* ${shapefile.extra_files_path}
            #end if 
    ]]></command>
    <inputs>
        <param type="data" name="input" format="shp,xml,json,tabular,txt" label="Gdal supported input file" help="http://www.gdal.org/ogr_formats.html"/>
        <param type="select" name="f" label="Conversion format" value="" help="Select the format to convert your input file. Currently supported : Shapefile, GeoJSON, GML, KML and WFS.">
            <option value="ESRI Shapefile">ESRI Shapefile</option>
            <option value="GeoJSON">GEOJSON</option> 
            <option value="GML">GML</option>
            <option value="KML">KML</option>
            <option value="WFS">WFS</option>
        </param>
        <conditional name="settings">
            <expand macro="gdal_advanced_params_select"/>
            <when value="advanced">
                <expand macro="gdal_param_oo"/>
            </when>
        </conditional>
    </inputs>
    <outputs>
        <data name="output" from_work_dir="output" format="xml" label="${on_string}.${f}">
            <filter>f != 'ESRI Shapefile'</filter>
                <change_format>
                    <when input="f" value="GeoJSON" format="json"/> 
                    <when input="f" value="GML" format="xml"/> 
                    <when input="f" value="KML" format="xml"/> 
                    <when input="f" value="WFS" format="txt"/> 
                </change_format> 
        </data>
        <data name="shapefile" format="shp" from_work_dir="shapefile" label="${on_string}.shapefile">
            <filter>f == 'ESRI Shapefile'</filter>
        </data>
    </outputs>
    <tests>
        <test>
            <param name="input" value="shp_compositefiles/shapefile.xml" ftype="shp">
                <composite_data value="shp_compositefiles/shapefile.shp"/>
                <composite_data value="shp_compositefiles/shapefile.shx"/>
                <composite_data value="shp_compositefiles/shapefile.dbf"/>
                <composite_data value="shp_compositefiles/shapefile.sbn"/>
                <composite_data value="shp_compositefiles/shapefile.sbx"/>
            </param>
            <param name="f" value="KML"/>
            <param name="advanced" value="simple"/>
            <output file="ogr2ogr_KML.kml" name="output"/> 
        </test>
        <test>
            <param name="input" value="shp_compositefiles/shapefile.xml" ftype="shp">
                <composite_data value="shp_compositefiles/shapefile.shp"/>
                <composite_data value="shp_compositefiles/shapefile.shx"/>
                <composite_data value="shp_compositefiles/shapefile.dbf"/>
                <composite_data value="shp_compositefiles/shapefile.sbn"/>
                <composite_data value="shp_compositefiles/shapefile.sbx"/>
            </param>
            <param name="f" value="GML"/>
            <param name="advanced" value="simple"/>
            <output file="ogr2ogr_GML.gml" name="output"/> 
        </test>
        <test>
            <param name="input" value="shp_compositefiles/shapefile.xml" ftype="shp">
                <composite_data value="shp_compositefiles/shapefile.shp"/>
                <composite_data value="shp_compositefiles/shapefile.shx"/>
                <composite_data value="shp_compositefiles/shapefile.dbf"/>
                <composite_data value="shp_compositefiles/shapefile.sbn"/>
                <composite_data value="shp_compositefiles/shapefile.sbx"/>
            </param>
            <param name="f" value="GeoJSON"/>
            <param name="advanced" value="simple"/>
            <output file="ogr2ogr_geojson.json" name="output"/> 
        </test>   
        <test>
            <param name="input" value="ogr2ogr_KML.kml" ftype="xml"/>
            <param name="f" value="GeoJSON"/>
            <param name="advanced" value="simple"/>
            <output file="ogr2ogr_test2_geojson.json" name="output"/> 
        </test>   
        <test>
            <param name="input" value="ogr2ogr_KML.kml" ftype="xml"/>
            <param name="f" value="ESRI Shapefile"/>
            <param name="advanced" value="simple"/>
            <output file="shp_compositefiles/ogr2ogr_shapefile2.html" name="shapefile">
                <extra_files type="file" name="shapefile.dbf" value="shp_compositefiles/ogr2ogr_shapefile2.dbf" compare="sim_size" delta="50"/>
                <extra_files type="file" name="shapefile.prj" value="shp_compositefiles/ogr2ogr_shapefile2.prj"/>
                <extra_files type="file" name="shapefile.shp" value="shp_compositefiles/ogr2ogr_shapefile2.shp"/>
                <extra_files type="file" name="shapefile.shx" value="shp_compositefiles/ogr2ogr_shapefile2.shx"/>
            </output>
        </test>
        <test>
            <param name="input" value="ogr2ogr_KML.kml" ftype="xml"/>
            <param name="f" value="GML"/>
            <param name="advanced" value="simple"/>
            <output file="ogr2ogr_GML2.gml" name="output"/> 
        </test>
        <test>
            <param name="input" value="ogr2ogr_fromgbif.tabular" ftype="tabular"/>
            <param name="f" value="GeoJSON"/>
            <param name="advanced" value="advanced"/>
            <param name="oo" value="X_POSSIBLE_NAMES=longitude"/>
            <param name="oo" value="Y_POSSIBLE_NAMES=latitude"/>
            <output file="ogr2ogr_gbif_to_json.json" name="output" lines_diff="2"/> 
        </test>
</tests>
    <help><![CDATA[
========
Ogrinfo
========

**What it does**

The Ogrinfo program lists various information about an OGR supported vector dataset.

|

**How to use it**

Select from history a suported vector file. 

|

**Advanced options and sources**

To see complete details and help section please check the official gdal sources.

http://www.gdal.org

https://gdal.org/programs/ogr2ogr.html

http://download.osgeo.org/gdal/workshop/foss4ge2015/workshop_gdal.pdf
    ]]></help>
    <expand macro="gdal_citation"/>
</tool>