changeset 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
files gdal_macros.xml ogr2ogr.xml test-data/ogr2ogr_fromgbif.tabular test-data/ogr2ogr_gbif_to_json.json
diffstat 4 files changed, 55 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/gdal_macros.xml	Thu Jun 13 11:29:34 2019 -0400
+++ b/gdal_macros.xml	Thu Jun 20 06:53:44 2019 -0400
@@ -128,11 +128,11 @@
         </param>
     </xml>
 
-<!-- need to upgrade gdal version to use
     <xml name="gdal_param_oo">
-        <param name="oo" type="text" label="-oo NAME=VALUE" value="" />
+        <repeat name="series_oo" title="Add an input dataset open option">
+            <param name="oo" type="text" label="Input dataset open option" help="-oo NAME=VALUE. eg : X_POSSIBLE_NAMES=longitude. Format specific, can be used multiple times." value="" />
+        </repeat>
     </xml>
--->
 
     <xml name="gdal_input_raster_multiple">
         <param type="data" name="input" format="gtiff,tiff,netcdf,VRT,txt,xml" help="Formats currently supported are : GTiff, netCDF and VRT" label="Gdal supported input file" multiple="true"/>
--- a/ogr2ogr.xml	Thu Jun 13 11:29:34 2019 -0400
+++ b/ogr2ogr.xml	Thu Jun 20 06:53:44 2019 -0400
@@ -5,6 +5,9 @@
     </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'
@@ -14,9 +17,18 @@
             #end if
             #if $input.is_of_type("shp")
                 ${os.path.join( $input.extra_files_path, 'shapefile.shp' )} 
-            #else    
+            #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} &&
@@ -24,7 +36,7 @@
             #end if 
     ]]></command>
     <inputs>
-        <param type="data" name="input" format="shp,xml,json,txt" label="Gdal supported input file" help="http://www.gdal.org/ogr_formats.html"/>
+        <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> 
@@ -32,6 +44,12 @@
             <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}">
@@ -57,6 +75,7 @@
                 <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>
@@ -68,6 +87,7 @@
                 <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>
@@ -79,16 +99,19 @@
                 <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"/>
@@ -99,9 +122,18 @@
         <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>
-    </tests>
+        <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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/ogr2ogr_fromgbif.tabular	Thu Jun 20 06:53:44 2019 -0400
@@ -0,0 +1,6 @@
+"date"	"providedScientificName"	"year"	"countryCode"	"providedCounty"	"ambiguous"	"verbatimLocality"	"latlon"	"computedCountyFips"	"occurrenceID"	"longitude"	"basisOfRecord"	"providedCommonName"	"collectionID"	"ownerInstitutionCollectionCode"	"name"	"institutionID"	"computedStateFips"	"license"	"TSNs"	"providerID"	"stateProvince"	"latitude"	"recordedBy"	"geo"	"provider"	"calculatedCounty"	"catalogNumber"	"ITISscientificName"	"pointPath"	"kingdom"	"calculatedState"	"hierarchy_homonym_string"	"centroid"	"ITIScommonName"	"resourceID"	"ITIStsn"	"prov"
+"1957-01-01"	"Canis lupus Linnaeus, 1758"	"1957"	"US"	"Washington"	"FALSE"	"BANK OF ILLINOIS RIVER, WEDINGTON"	"-94.2184168,35.9712088"	"05143"	"919969407"	"-94.21841"	"specimen"	"DOG"	"http://fulbright.uark.edu/deans-office/facilities/university-collections-facility/museum-collections.php"	"UAFMC Mammals"	"Canis lupus"	"http://fulbright.uark.edu/collections/index.php"	"05"	"CC0_1_0"	"180596"	"359"	"Arkansas"	"35.97121"	"COLE M"	"-94.2184168 35.9712088"	"University of Arkansas Collections Facility, UAFMC"	"Washington"	"0074-0001-0007"	"Canis lupus"	"/-94.2184168,35.9712088/specimen/centroid"	"Animalia"	"Arkansas"	"-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-"	"county"	"Gray Wolf;Wolf;Lobo gris;loup"	"359,202522"	"180596"	"bison"
+"1972-01-09"	"Canis lupus Linnaeus, 1758"	"1972"	"US"	"Marion"	"FALSE"	"UNKNOWN"	"-92.678588,36.2666562"	"05089"	"919969412"	"-92.67859"	"specimen"	"DOG"	"http://fulbright.uark.edu/deans-office/facilities/university-collections-facility/museum-collections.php"	"UAFMC Mammals"	"Canis lupus"	"http://fulbright.uark.edu/collections/index.php"	"05"	"CC0_1_0"	"180596"	"359"	"Arkansas"	"36.26666"	"ROBINSON CHARLES"	"-92.678588 36.2666562"	"University of Arkansas Collections Facility, UAFMC"	"Marion"	"0072-0409-0001"	"Canis lupus"	"/-92.678588,36.2666562/specimen/centroid"	"Animalia"	"Arkansas"	"-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-"	"county"	"Gray Wolf;Wolf;Lobo gris;loup"	"359,202522"	"180596"	"bison"
+"1970-01-01"	"Canis lupus Linnaeus, 1758"	"1970"	"US"	"Stone"	"FALSE"	"IN QUARRY WEST OF HWY 9, SOUTH OF MTN VIEW, NEAR BEAR CREEK"	"-92.1404942,35.8569888"	"05137"	"919969420"	"-92.14050"	"specimen"	"DOG"	"http://fulbright.uark.edu/deans-office/facilities/university-collections-facility/museum-collections.php"	"UAFMC Mammals"	"Canis lupus"	"http://fulbright.uark.edu/collections/index.php"	"05"	"CC0_1_0"	"180596"	"359"	"Arkansas"	"35.85699"	"TAYLOR J"	"-92.1404942 35.8569888"	"University of Arkansas Collections Facility, UAFMC"	"Stone"	"0074-0001-0041"	"Canis lupus"	"/-92.1404942,35.8569888/specimen/centroid"	"Animalia"	"Arkansas"	"-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-"	"county"	"Gray Wolf;Wolf;Lobo gris;loup"	"359,202522"	"180596"	"bison"
+NA	"Canis lupus Linnaeus, 1758"	NA	"US"	"Sebastian"	"FALSE"	"FT SMITH"	"-94.274989,35.1969808"	"05131"	"919969655"	"-94.27499"	"specimen"	"DOG"	"http://fulbright.uark.edu/deans-office/facilities/university-collections-facility/museum-collections.php"	"UAFMC Mammals"	"Canis lupus"	"http://fulbright.uark.edu/collections/index.php"	"05"	"CC0_1_0"	"180596"	"359"	"Arkansas"	"35.19698"	"GIPSON B H"	"-94.274989 35.1969808"	"University of Arkansas Collections Facility, UAFMC"	"Sebastian"	"0085-0046-0282"	"Canis lupus"	"/-94.274989,35.1969808/specimen/centroid"	"Animalia"	"Arkansas"	"-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-"	"county"	"Gray Wolf;Wolf;Lobo gris;loup"	"359,202522"	"180596"	"bison"
+"1970-01-01"	"Canis lupus Linnaeus, 1758"	"1970"	"US"	"Sebastian"	"FALSE"	"FT SMITH"	"-94.274989,35.1969808"	"05131"	"919969656"	"-94.27499"	"specimen"	"DOG"	"http://fulbright.uark.edu/deans-office/facilities/university-collections-facility/museum-collections.php"	"UAFMC Mammals"	"Canis lupus"	"http://fulbright.uark.edu/collections/index.php"	"05"	"CC0_1_0"	"180596"	"359"	"Arkansas"	"35.19698"	"GIPSON B H"	"-94.274989 35.1969808"	"University of Arkansas Collections Facility, UAFMC"	"Sebastian"	"0085-0046-0283"	"Canis lupus"	"/-94.274989,35.1969808/specimen/centroid"	"Animalia"	"Arkansas"	"-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-"	"county"	"Gray Wolf;Wolf;Lobo gris;loup"	"359,202522"	"180596"	"bison"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/ogr2ogr_gbif_to_json.json	Thu Jun 20 06:53:44 2019 -0400
@@ -0,0 +1,11 @@
+{
+"type": "FeatureCollection",
+"name": "dataset_4.dat",
+"features": [
+{ "type": "Feature", "properties": { "date": "1957-01-01", "providedScientificName": "Canis lupus Linnaeus, 1758", "year": "1957", "countryCode": "US", "providedCounty": "Washington", "ambiguous": "FALSE", "verbatimLocality": "BANK OF ILLINOIS RIVER, WEDINGTON", "latlon": "-94.2184168,35.9712088", "computedCountyFips": "05143", "occurrenceID": "919969407", "longitude": -94.21841, "basisOfRecord": "specimen", "providedCommonName": "DOG", "collectionID": "http:\/\/fulbright.uark.edu\/deans-office\/facilities\/university-collections-facility\/museum-collections.php", "ownerInstitutionCollectionCode": "UAFMC Mammals", "name": "Canis lupus", "institutionID": "http:\/\/fulbright.uark.edu\/collections\/index.php", "computedStateFips": "05", "license": "CC0_1_0", "TSNs": "180596", "providerID": "359", "stateProvince": "Arkansas", "latitude": 35.97121, "recordedBy": "COLE M", "geo": "-94.2184168 35.9712088", "provider": "University of Arkansas Collections Facility, UAFMC", "calculatedCounty": "Washington", "catalogNumber": "0074-0001-0007", "ITISscientificName": "Canis lupus", "pointPath": "\/-94.2184168,35.9712088\/specimen\/centroid", "kingdom": "Animalia", "calculatedState": "Arkansas", "hierarchy_homonym_string": "-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-", "centroid": "county", "ITIScommonName": "Gray Wolf;Wolf;Lobo gris;loup", "resourceID": "359,202522", "ITIStsn": "180596", "prov": "bison" }, "geometry": { "type": "Point", "coordinates": [ -94.21841, 35.97121 ] } },
+{ "type": "Feature", "properties": { "date": "1972-01-09", "providedScientificName": "Canis lupus Linnaeus, 1758", "year": "1972", "countryCode": "US", "providedCounty": "Marion", "ambiguous": "FALSE", "verbatimLocality": "UNKNOWN", "latlon": "-92.678588,36.2666562", "computedCountyFips": "05089", "occurrenceID": "919969412", "longitude": -92.67859, "basisOfRecord": "specimen", "providedCommonName": "DOG", "collectionID": "http:\/\/fulbright.uark.edu\/deans-office\/facilities\/university-collections-facility\/museum-collections.php", "ownerInstitutionCollectionCode": "UAFMC Mammals", "name": "Canis lupus", "institutionID": "http:\/\/fulbright.uark.edu\/collections\/index.php", "computedStateFips": "05", "license": "CC0_1_0", "TSNs": "180596", "providerID": "359", "stateProvince": "Arkansas", "latitude": 36.26666, "recordedBy": "ROBINSON CHARLES", "geo": "-92.678588 36.2666562", "provider": "University of Arkansas Collections Facility, UAFMC", "calculatedCounty": "Marion", "catalogNumber": "0072-0409-0001", "ITISscientificName": "Canis lupus", "pointPath": "\/-92.678588,36.2666562\/specimen\/centroid", "kingdom": "Animalia", "calculatedState": "Arkansas", "hierarchy_homonym_string": "-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-", "centroid": "county", "ITIScommonName": "Gray Wolf;Wolf;Lobo gris;loup", "resourceID": "359,202522", "ITIStsn": "180596", "prov": "bison" }, "geometry": { "type": "Point", "coordinates": [ -92.67859, 36.26666 ] } },
+{ "type": "Feature", "properties": { "date": "1970-01-01", "providedScientificName": "Canis lupus Linnaeus, 1758", "year": "1970", "countryCode": "US", "providedCounty": "Stone", "ambiguous": "FALSE", "verbatimLocality": "IN QUARRY WEST OF HWY 9, SOUTH OF MTN VIEW, NEAR BEAR CREEK", "latlon": "-92.1404942,35.8569888", "computedCountyFips": "05137", "occurrenceID": "919969420", "longitude": -92.1405, "basisOfRecord": "specimen", "providedCommonName": "DOG", "collectionID": "http:\/\/fulbright.uark.edu\/deans-office\/facilities\/university-collections-facility\/museum-collections.php", "ownerInstitutionCollectionCode": "UAFMC Mammals", "name": "Canis lupus", "institutionID": "http:\/\/fulbright.uark.edu\/collections\/index.php", "computedStateFips": "05", "license": "CC0_1_0", "TSNs": "180596", "providerID": "359", "stateProvince": "Arkansas", "latitude": 35.85699, "recordedBy": "TAYLOR J", "geo": "-92.1404942 35.8569888", "provider": "University of Arkansas Collections Facility, UAFMC", "calculatedCounty": "Stone", "catalogNumber": "0074-0001-0041", "ITISscientificName": "Canis lupus", "pointPath": "\/-92.1404942,35.8569888\/specimen\/centroid", "kingdom": "Animalia", "calculatedState": "Arkansas", "hierarchy_homonym_string": "-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-", "centroid": "county", "ITIScommonName": "Gray Wolf;Wolf;Lobo gris;loup", "resourceID": "359,202522", "ITIStsn": "180596", "prov": "bison" }, "geometry": { "type": "Point", "coordinates": [ -92.1405, 35.85699 ] } },
+{ "type": "Feature", "properties": { "date": "NA", "providedScientificName": "Canis lupus Linnaeus, 1758", "year": "NA", "countryCode": "US", "providedCounty": "Sebastian", "ambiguous": "FALSE", "verbatimLocality": "FT SMITH", "latlon": "-94.274989,35.1969808", "computedCountyFips": "05131", "occurrenceID": "919969655", "longitude": -94.27499, "basisOfRecord": "specimen", "providedCommonName": "DOG", "collectionID": "http:\/\/fulbright.uark.edu\/deans-office\/facilities\/university-collections-facility\/museum-collections.php", "ownerInstitutionCollectionCode": "UAFMC Mammals", "name": "Canis lupus", "institutionID": "http:\/\/fulbright.uark.edu\/collections\/index.php", "computedStateFips": "05", "license": "CC0_1_0", "TSNs": "180596", "providerID": "359", "stateProvince": "Arkansas", "latitude": 35.19698, "recordedBy": "GIPSON B H", "geo": "-94.274989 35.1969808", "provider": "University of Arkansas Collections Facility, UAFMC", "calculatedCounty": "Sebastian", "catalogNumber": "0085-0046-0282", "ITISscientificName": "Canis lupus", "pointPath": "\/-94.274989,35.1969808\/specimen\/centroid", "kingdom": "Animalia", "calculatedState": "Arkansas", "hierarchy_homonym_string": "-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-", "centroid": "county", "ITIScommonName": "Gray Wolf;Wolf;Lobo gris;loup", "resourceID": "359,202522", "ITIStsn": "180596", "prov": "bison" }, "geometry": { "type": "Point", "coordinates": [ -94.27499, 35.19698 ] } },
+{ "type": "Feature", "properties": { "date": "1970-01-01", "providedScientificName": "Canis lupus Linnaeus, 1758", "year": "1970", "countryCode": "US", "providedCounty": "Sebastian", "ambiguous": "FALSE", "verbatimLocality": "FT SMITH", "latlon": "-94.274989,35.1969808", "computedCountyFips": "05131", "occurrenceID": "919969656", "longitude": -94.27499, "basisOfRecord": "specimen", "providedCommonName": "DOG", "collectionID": "http:\/\/fulbright.uark.edu\/deans-office\/facilities\/university-collections-facility\/museum-collections.php", "ownerInstitutionCollectionCode": "UAFMC Mammals", "name": "Canis lupus", "institutionID": "http:\/\/fulbright.uark.edu\/collections\/index.php", "computedStateFips": "05", "license": "CC0_1_0", "TSNs": "180596", "providerID": "359", "stateProvince": "Arkansas", "latitude": 35.19698, "recordedBy": "GIPSON B H", "geo": "-94.274989 35.1969808", "provider": "University of Arkansas Collections Facility, UAFMC", "calculatedCounty": "Sebastian", "catalogNumber": "0085-0046-0283", "ITISscientificName": "Canis lupus", "pointPath": "\/-94.274989,35.1969808\/specimen\/centroid", "kingdom": "Animalia", "calculatedState": "Arkansas", "hierarchy_homonym_string": "-202423-914154-914156-158852-331030-914179-914181-179913-179916-179925-180539-552303-180594-180595-180596-", "centroid": "county", "ITIScommonName": "Gray Wolf;Wolf;Lobo gris;loup", "resourceID": "359,202522", "ITIStsn": "180596", "prov": "bison" }, "geometry": { "type": "Point", "coordinates": [ -94.27499, 35.19698 ] } }
+]
+}