We'll install MSOffice using the PlayOnLinux wizard. Additionally, MSOffice requires samba and winbind to properly work.
So, if not installed, install them:
sudo apt-get install playonlinux samba winbind
| # export mysql database into shapefile | |
| ogr2ogr out_shapes MYSQL:gis,user=root,password=password | |
| # import shapefile into mysql | |
| ogr2ogr -f MySQL MySQL:database_name,user=root,password=password my_shapefile.shp -nln table_name -a_srs EPSG:4326 -update -overwrite -lco engine=MYISAM | |
| # reproject spatial reference from WGS 84 UTM 48S to Geographic Lattitide/Longitude Coordinate System | |
| ogr2ogr -f "ESRI Shapefile" target_file.shp source_file.shp -s_srs EPSG:32748 -t_srs EPSG:4326 |
| import numpy as np | |
| from osgeo import gdal, gdal_array, osr | |
| def npmatrix_to_geotiff (filepath, matrices, gdal_type, transform = None, projection = None, nodata = None): | |
| (y_res, x_res) = matrices[0].shape | |
| driver = gdal.GetDriverByName('GTiff') | |
| image = driver.Create(filepath, x_res, y_res, len(matrices), gdal_type) | |
| if transform is not None: | |
| image.SetGeoTransform(transform) | |
| if projection is not None: |
| -- Get Max ID from table | |
| SELECT MAX(id) FROM table; | |
| -- Get Next ID from table | |
| SELECT nextval('table_id_seq'); | |
| -- Set Next ID Value to MAX ID | |
| SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)); |
| <!doctype html> | |
| <html> | |
| <head> | |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
| <script type="text/javascript"> | |
| var spData = null; | |
| function doData(json) { | |
| spData = json.feed.entry; | |
| } | |
In needed include base64 encoded simple image into HTML page in two formats:
1st as PNG format has length 196 characters and looks like this:
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAWElEQVR42mNkwA/qgbgRnwJGAgb8BwI7RkbGw5QYUAs0oGXUAPwGgKKqgYF0ANLTyAi1xhZI2WOYzsjYDJTbC2QewGHIwcERBsPcgHqgAX8pMQAcxfhyIwATTkxL+hgX2QAAAABJRU5ErkJggg==
2nd as CUR format has length 1536 characters and looks like this:
`AAACAAEAEBAAAAcABwBoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///z0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH////98AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////3wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////98AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
| SINGLE FILE CONVERT | |
| gdal_translate input_nysdop_ortho.jp2 output.tif -b 1 -b 2 -b 3 -mask 4 -co COMPRESS=JPEG -co JPEG_QUALITY=25 -co PHOTOMETRIC=YCBCR --config GDAL_TIFF_INTERNAL_MASK YES -a_srs EPSG:2260 | |
| BATCH CONVERT | |
| for /r %g in (*.jp2) do gdal_translate -of GTiff "%g" "%~dpng.tif" -b 1 -b 2 -b 3 -mask 4 -co COMPRESS=JPEG -co JPEG_QUALITY=25 -co PHOTOMETRIC=YCBCR --config GDAL_TIFF_INTERNAL_MASK YES -a_srs EPSG:2260 | |
| BUILT VIRTUAL RASTER (CATALOG) | |
| gdalbuildvrt catalog.vrt e_06811416_06_05000_4bd_2011.jp2 e_06811414_06_05000_4bd_2011.jp2 e_06781416_06_05000_4bd_2011.jp2 e_06781414_06_05000_4bd_2011.jp2 | |
| gdalbuildvrt -allow_projection_difference -hidenodata -vrtnodata "255 255 255" nysdop.vrt *.jp2 -a_srs EPSG:2260 |
Image download from ftp --> upload to AWS s3 bucket
Pull to AWS EC2 machine. Save off SWIR band ratios as tif with appropriate contrast. The SWIR data is an 8-band image. You need to first grab onnly the bands you need for visualization (8-3-1 or 6-3-1 make good combos)
import rasterio
import numpy as np
raster='18NOV09185526-A2AS-058669488010_01_P001.TIF'. #your file| // Copy big file from somewhere else | |
| $src_filepath = 'http://example.com/all_the_things.txt'; $src = fopen($src_filepath, 'r'); | |
| $tmp_filepath = '...'; $tmp = fopen($tmp_filepath, 'w'); | |
| $buffer_size = 1024; | |
| while (!feof($src)) { | |
| $buffer = fread($src, $buffer_size); // Read big file/data source/etc. in small chunks | |
| fwrite($tmp, $buffer); // Write in small chunks | |
| } |
| <?php | |
| /*ini settings*/ | |
| set_time_limit(0); | |
| ini_set('memory_limit', '512M'); | |
| //DOWNLOAD SCRIPT | |
| $filePath = "G:/Software/versions/..PATH TO DOWNLOAD FILE...zip"; // set your download file path here. | |
| download($filePath); // calls download function | |
| function download($filePath) | |
| { |