-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding crs_converter to Galaxy ecology #119
Open
Rassine
wants to merge
22
commits into
galaxyecology:master
Choose a base branch
from
Rassine:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1dd33ee
adding crs_converter to Galaxy ecology
Rassine fb90400
corrected lint
Rassine 3b27e5f
changed voluminous files
Rassine caf8750
corrected version lint
Rassine 0794134
corrected param name lint
Rassine 8eb2f33
everyting is working now!
Rassine 3261868
fixed tests hopefully
Rassine 785204e
Merge branch 'galaxyecology:master' into master
Rassine 6b47bf6
remove white spaces between name and =
Rassine 2349761
Clearer label
Rassine 20e67c7
removed space
Rassine 593ed81
removed space
Rassine be9fb5e
removed space
Rassine 0bb690c
removed useless brackets
Rassine 1708f5b
improved help
Rassine e53d97e
Update tools/crs_converter/CRSconverter.xml
Rassine b8e6b7f
Improved links
Rassine 1e4ac23
Improved links
Rassine 7ba412f
Improved links
Rassine 4f08c1f
Update tools/crs_converter/CRSconverter.xml
Rassine e600eb3
Update tools/crs_converter/CRSconverter.xml
yvanlebras db6543b
added proj string explanation comment
Rassine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: crs_converter | ||
owner: ecology | ||
description: Geospatial transformation of a shapefile Coordinate Reference Systems | ||
homepage_url: https://github.com/Rassine/Rassine-tools-Gecology/tree/master/tools/crs_converter | ||
long_description: | | ||
This tool was created to be part of a phylodiversity workflow. It creates a PROJ4 string from the option selected by the users and use the string to convert the coordinate reference system of a given geospatial file into another one. This tool also offers to produce output in different formats for wider options of manipulation and visualisation. | ||
remote_repository_url: https://github.com/galaxyecology/tools-ecology/tree/master/tools/crs_converter | ||
type: unrestricted | ||
categories: | ||
- Ecology | ||
auto_tool_repositories: | ||
name_template: "{{ tool_id }}" | ||
description_template: "Convert Coordinate Reference Systems of shapefiles" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<macros> | ||
<xml name='ellps_options'> | ||
<param name ='ellps' type='select' checked='true' | ||
label='Ellipsoid and Datum' help='The name of built-in ellipsoid definition. Defines shape and center of earth simplified model used for projection. | ||
See https://proj.org/en/9.4/usage/ellipsoids.html#ellipsoids for more informations.'> | ||
<option value='GRS80'>GRS80</option> | ||
<option value='airy'>airy</option> | ||
<option value='bessel'>bessel</option> | ||
<option value='clrk66'>clrk66</option> | ||
<option value='WGS60'>WGS60</option> | ||
<option value='WGS66'>WGS66</option> | ||
<option value='WGS72'>WGS72</option> | ||
<option value='WGS84' selected='true'>WGS84</option> | ||
<option value='sphere'>sphere</option> | ||
</param> | ||
</xml> | ||
|
||
|
||
<xml name='latitude_options'> | ||
<param name ='lat_0' type='integer' value='0' | ||
label='Latitude' help='Latitude of natural origin, | ||
latitude of false origin or latitude of projection centre | ||
(naming and meaning depend on the projection method).'/> | ||
</xml> | ||
|
||
|
||
<xml name='latitude_1_options'> | ||
<param name ='lat_1' type='integer' value='1' | ||
label='Latitude 1' help='First standard parallel.'/> | ||
</xml> | ||
|
||
|
||
<xml name='latitude_2_options'> | ||
<param name ='lat_2' type='integer' value='1' | ||
label='Latitude 2' help='Second standard parallel.'/> | ||
</xml> | ||
|
||
|
||
<xml name='latitude_ts_options'> | ||
<param name ='lat_ts' type='integer' value='0' | ||
label='Latitude of true scale' help='Defines the latitude where scale is not distorted. | ||
Takes precedence over scale factor K if both options are used together.'/> | ||
</xml> | ||
|
||
|
||
<xml name='longitude_options'> | ||
<param name ='lon_0' type='integer' value='0' | ||
label='Longitude' help='Central meridian/longitude of natural origin, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same the help is not clear for me |
||
longitude of origin or longitude of false origin | ||
(naming and meaning depend on the projection method).'/> | ||
</xml> | ||
|
||
|
||
<xml name='X_options'> | ||
<param name ='x_0' type='integer' value='0' | ||
label='X' help='False easting, easting at false origin or easting at projection centre. | ||
(naming and meaning depend on the projection method). Always in meters. Use Ex: Shifting projection on an East-Weast axis'/> | ||
</xml> | ||
|
||
|
||
<xml name='Y_options'> | ||
<param name ='y_0' type='integer' value='0' | ||
label='Y' help='False northing, northing at false origin or northing at projection centre. | ||
(naming and meaning depend on the projection method). Always in meters. Use Ex: Shifting projection on a North-South axis'/> | ||
</xml> | ||
|
||
|
||
<xml name='K_options'> | ||
<param name='k_0' type='integer' value='1' min='1' | ||
label='Scale factor K' help='Scale factor. Determines scale factor used in the projection.'/> | ||
</xml> | ||
|
||
|
||
<xml name='zone_options'> | ||
<param name ='zone' type='integer' value='1' min='1' max='60' | ||
label='Select which UTM zone to use' help='Can be a value between 1-60.'/> | ||
</xml> | ||
|
||
|
||
<xml name='south_options'> | ||
<param name ='south' type='boolean' checked='false' | ||
label='South hemisphere' help='Add this flag when using the UTM on the southern hemisphere.'/> | ||
</xml> | ||
|
||
|
||
<xml name='approx_options'> | ||
<param name ='approx' type='boolean' checked='false' | ||
label='Approximation algorithm' help='Use faster, less accurate algorithm for the Transverse Mercator.'/> | ||
</xml> | ||
|
||
|
||
<xml name='algo_options'> | ||
<param name ='algo' type='select' optional='false' | ||
label='Selects the algorithm to use.' help='Default value is poder_engsager. | ||
When using auto, an heuristics based on the input coordinate is used to | ||
determine if the faster Evenden-Snyder method can be used for faster | ||
computation without causing an error greater than 0.1 mm | ||
(for an ellipsoid of the size of Earth)'> | ||
<option value='auto'>Auto</option> | ||
<option value='evenden_snyder'>Evenden Snyder</option> | ||
<option value='poder_engsager' selected='true'>Poder Engsager</option> | ||
</param> | ||
</xml> | ||
|
||
|
||
<xml name='asc_lon_options'> | ||
<param name ='asc_lon' type='integer' value='0' | ||
label='Ascending Longitude' help='Longitude of the ascending node for the orbit (decimal degrees).'/> | ||
</xml> | ||
|
||
|
||
<xml name='inc_angle_options'> | ||
<param name ='inc_angle' type='integer' value='90' | ||
label='Inclination angle' help='Inclination (vertical tilt) of the orbit | ||
with respect to the reference plane, measured at the ascending node (decimal degrees).'/> | ||
</xml> | ||
|
||
|
||
<xml name='ps_rev_options'> | ||
<param name ='ps_rev' type='integer' value='1' | ||
label='Revolution time' help='Time required for a single orbit (days).'/> | ||
</xml> | ||
|
||
|
||
<xml name='units_options'> | ||
<param name ='units' type='select' checked='true' | ||
label='Units' help='Default is meter.'> | ||
<option value='m' selected='true'>m</option> | ||
<option value='mm'>mm</option> | ||
<option value='cm'>cm</option> | ||
<option value='dm'>dm</option> | ||
<option value='km'>km</option> | ||
<option value='kmi'>International Nautical Mile (kmi)</option> | ||
<option value='us-in'>US in</option> | ||
<option value='us-ft'>US ft</option> | ||
<option value='us-yd'>US yd</option> | ||
<option value='us-mi'>US mi</option> | ||
</param> | ||
</xml> | ||
</macros> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/Rscript | ||
|
||
library(sf) | ||
library(tidyr) | ||
|
||
args = commandArgs(trailingOnly=TRUE) | ||
output_list <- strsplit(as.character(args[2]), ',')[[1]] | ||
|
||
|
||
|
||
save_as_pdf_fun <- function(){ | ||
|
||
pdf(file = 'PDF_output.pdf') | ||
plot(st_geometry(Transformed_spacial_coordinates)) | ||
dev.off() | ||
} | ||
|
||
|
||
save_as_shp_fun <- function(){ | ||
|
||
write_sf(Transformed_spacial_coordinates, 'shapefile.shp') | ||
} | ||
|
||
|
||
save_as_image_fun <- function(format){ | ||
|
||
img_fun = as.list(paste(format, '_output.', format, sep = '', collapse = NULL)) | ||
do.call(format, img_fun) | ||
plot(st_geometry(Transformed_spacial_coordinates)) | ||
dev.off() | ||
} | ||
|
||
|
||
|
||
if (length(args)<2){stop('Insufficient number of argument, please review command Line') | ||
}else{ | ||
Spacial_coordinates_files <- read_sf(as.character(args[1]), layer = 'shapefile') | ||
projection <- as.character(args[4]) | ||
|
||
for (n_arg in 5:length(args)) { | ||
projection <- paste(projection, as.character(args[n_arg]),sep = '', collapse = NULL) | ||
} | ||
|
||
projection <- paste(projection, ' +no_defs',sep = '', collapse = NULL) | ||
Transformed_spacial_coordinates <- st_transform(Spacial_coordinates_files, crs = projection) | ||
for (a in output_list) { | ||
if (as.character(a) == 'pdf') { | ||
save_as_pdf_fun() | ||
next | ||
|
||
} else if (as.character(a) == 'shp') { | ||
save_as_shp_fun() | ||
next | ||
|
||
} else { save_as_image_fun(as.character(a)) } | ||
}} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more information in the help section ?