-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
2,837 additions
and
1,763 deletions.
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
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
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
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,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Loam Test</title> | ||
<script type="text/javascript" src="/loam.js"></script> | ||
</head> | ||
<body> | ||
<form> | ||
<input type="file" id="geotiff-file" /> | ||
</form> | ||
<p> | ||
Select a GeoTIFF using the Browse... button. Information about the file will be | ||
displayed below. | ||
</p> | ||
|
||
<div id="gdalinfo"></div> | ||
<script src="index.js"></script> | ||
</body> | ||
</html> |
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,60 @@ | ||
/* global loam */ | ||
|
||
// Use the locally built version of loam, with a CDN copy of GDAL from unpkg. | ||
loam.initialize('/', 'https://unpkg.com/gdal-js@2.0.0/'); | ||
|
||
const EPSG4326 = | ||
'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]'; | ||
|
||
function displayInfo() { | ||
const file = document.querySelector('#geotiff-file').files[0]; | ||
const displayElem = document.getElementById('gdalinfo'); | ||
|
||
// Clear display text | ||
displayElem.innerText = ''; | ||
// Use Loam to get GeoTIFF metadata | ||
loam.open(file).then((ds) => { | ||
return Promise.all([ds.width(), ds.height(), ds.count(), ds.wkt(), ds.transform()]).then( | ||
([width, height, count, wkt, geoTransform]) => { | ||
displayElem.innerText += | ||
'Size: ' + width.toString() + ', ' + height.toString() + '\n'; | ||
displayElem.innerText += 'Band count: ' + count.toString() + '\n'; | ||
displayElem.innerText += 'Coordinate system:\n' + wkt + '\n'; | ||
|
||
const cornersPx = [ | ||
[0, 0], | ||
[width, 0], | ||
[width, height], | ||
[0, height], | ||
]; | ||
const cornersGeo = cornersPx.map(([x, y]) => { | ||
return [ | ||
// http://www.gdal.org/gdal_datamodel.html | ||
geoTransform[0] + geoTransform[1] * x + geoTransform[2] * y, | ||
geoTransform[3] + geoTransform[4] * x + geoTransform[5] * y, | ||
]; | ||
}); | ||
|
||
loam.reproject(wkt, EPSG4326, cornersGeo).then((cornersLngLat) => { | ||
displayElem.innerText += 'Corner Coordinates:\n'; | ||
cornersLngLat.forEach(([lng, lat], i) => { | ||
displayElem.innerText += | ||
'(' + | ||
cornersGeo[i][0].toString() + | ||
', ' + | ||
cornersGeo[i][1].toString() + | ||
') (' + | ||
lng.toString() + | ||
', ' + | ||
lat.toString() + | ||
')\n'; | ||
}); | ||
}); | ||
} | ||
); | ||
}); | ||
} | ||
|
||
document.getElementById('geotiff-file').onchange = function () { | ||
displayInfo(); | ||
}; |
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 |
---|---|---|
@@ -1,58 +1,62 @@ | ||
{ | ||
"name": "loam", | ||
"version": "1.0.0", | ||
"description": "Javascript wrapper for GDAL in the browser", | ||
"main": "lib/loam.js", | ||
"scripts": { | ||
"build": "webpack --env dev && webpack --env build", | ||
"dev": "webpack --progress --colors --watch --env dev", | ||
"test": "karma start --single-run --browser ChromeHeadless karma.conf.js", | ||
"test:watch": "karma start --auto-watch --browser ChromeHeadless karma.conf.js", | ||
"test:ci": "webpack --env dev && webpack --env build && karma start --single-run --browser ChromeHeadless karma.conf.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/azavea/loam.git" | ||
}, | ||
"keywords": [ | ||
"gdal", | ||
"emscripten", | ||
"geospatial", | ||
"raster", | ||
"geotiff" | ||
], | ||
"author": "Derek Dohler", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/azavea/loam/issues" | ||
}, | ||
"files": [ | ||
"lib/" | ||
], | ||
"homepage": "https://github.com/azavea/loam", | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0", | ||
"@babel/core": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"babel-eslint": "^10.0.0", | ||
"babel-loader": "^8.0.0", | ||
"babel-plugin-add-module-exports": "^1.0.2", | ||
"chai": "^4.1.2", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^4.13.1", | ||
"eslint-loader": "^1.9.0", | ||
"karma": "^4.0.0", | ||
"karma-babel-preprocessor": "^8.0.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chai-as-promised": "^0.1.2", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-mocha": "^1.3.0", | ||
"mocha": "^6.0.0", | ||
"prettier": "^2.1.2", | ||
"webpack": "^3.10.0", | ||
"yargs": "^14.0.0" | ||
}, | ||
"dependencies": { | ||
"gdal-js": "2.0.0" | ||
} | ||
"name": "loam", | ||
"version": "1.1.0", | ||
"description": "Javascript wrapper for GDAL in the browser", | ||
"main": "lib/loam.js", | ||
"scripts": { | ||
"build": "webpack --config=webpack.prod.js", | ||
"dev": "webpack --progress --color --watch --config=webpack.dev.js", | ||
"demo": "webpack serve --config=webpack.dev.js", | ||
"test": "karma start --single-run --browser ChromeHeadless karma.conf.js", | ||
"test:watch": "karma start --auto-watch --browser ChromeHeadless karma.conf.js", | ||
"test:ci": "webpack --config=webpack.dev.js && webpack --config=webpack.prod.js && karma start --single-run --browser ChromeHeadless karma.conf.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/azavea/loam.git" | ||
}, | ||
"keywords": [ | ||
"gdal", | ||
"emscripten", | ||
"geospatial", | ||
"raster", | ||
"geotiff" | ||
], | ||
"author": "Derek Dohler", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/azavea/loam/issues" | ||
}, | ||
"files": [ | ||
"lib/" | ||
], | ||
"homepage": "https://github.com/azavea/loam", | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0", | ||
"@babel/core": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"babel-eslint": "^10.0.0", | ||
"babel-loader": "^8.0.0", | ||
"babel-plugin-add-module-exports": "^1.0.2", | ||
"chai": "^4.1.2", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^7.31.0", | ||
"eslint-webpack-plugin": "^3.0.1", | ||
"karma": "^4.0.0", | ||
"karma-babel-preprocessor": "^8.0.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chai-as-promised": "^0.1.2", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-mocha": "^1.3.0", | ||
"mocha": "^6.0.0", | ||
"prettier": "^2.1.2", | ||
"uglifyjs-webpack-plugin": "^2.2.0", | ||
"webpack": "^5.35.1", | ||
"webpack-cli": "^4.7.2", | ||
"webpack-dev-server": "^4.0.0-rc.0", | ||
"yargs": "^14.0.0" | ||
}, | ||
"dependencies": { | ||
"gdal-js": "2.0.0" | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { open, rasterize, initialize, reproject } from './api.js'; | ||
import { open, rasterize, initialize, reset, reproject } from './api.js'; | ||
import { GDALDataset } from './gdalDataset.js'; | ||
|
||
export default { open, rasterize, GDALDataset, initialize, reproject }; | ||
export default { open, rasterize, GDALDataset, initialize, reset, reproject }; |
Oops, something went wrong.