A place to store my scripts involving GIS data.
Script to extract the values of a rasterfile in a list of provided coordinates. Requires a shapefile and rasterfiles.
python layer_data_extractor.py shapefile.csv rasterfile(s)
The "shapefile.csv" should have a header and the following data: LABEL LAT LON. The separator can be any number of spaces and/or tabs. Eg:
LABEL LAT LON
Ind.1 41.6611 -7.8747
Ind.2 43.4997 -8.3164
Ind.3 39.5677 -6.6573
The rasterfile(s) can be globed in the shell or provided one by one. The output is sent to STDOUT.
python layer_data_extractor.py ~/shapefile.csv ~/GIS_data/BioClim1.bil ~/GIS_data/BioClim2.bil
python layer_data_extractor.py ~/shapefile.csv ~/GIS_data/BioClim3.bil > Extracted_data.csv # To export to a fileNote: In order to use .bil file, the respective .hdr files must be placed in the same directory.
This script requires the package python-gdal to work.
This is a very dirty hackish script to get a coordinate file and produce a Google Earth input file with place-marks.
Format a csv with coordinates:
Sample name, Longitude, Latitude, Altitude
Just use the program like so:
python3 Coords_to_Google_Earth.py coords.csv new_file.kmlAnd you are good to go.
This script will convert a csv file wing tabs as separators with DMS coordinates into decimal coordinates. It outputs to STDOUT.
Format a csv with DMS coordinates:
Sample name, Latitude, Longitude
python3 simpe_coordinate_converter.py coords.csv > output_file.csvThat's really all there is to it...
GPL V3