Comments (2)
Ooops made a mistalke. Wanted the else to be less restrictive.
and allow all other object types to pass. Removed the instance InputStream.
static Format getFormat(Object input) {
if(input instanceof File)
{
File file = input as File
if (file.exists()) {
AbstractGridFormat format = GridFormatFinder.findFormat(file);
if (format == null || format instanceof UnknownFormat) {
return null
}
if (format instanceof GeoTiffFormat) {
return new GeoTIFF(file)
} else if (format instanceof ArcGridFormat) {
return new ArcGrid(file)
} else if (format instanceof GrassCoverageFormat) {
return new Grass(file)
} else if (format instanceof GTopo30Format) {
return new GTopo30(file)
} else if (format instanceof ImagePyramidFormat) {
return new ImagePyramid(file)
} else if (format instanceof ImageMosaicFormat) {
return new Mosaic(file)
} else if (format instanceof MrSIDFormat) {
return new MrSID(file)
} else if (format instanceof WorldImageFormat) {
return new WorldImage(file)
} else if (format instanceof NetCDFFormat) {
return new NetCDF(file)
} else {
return new Format(format, file)
}
} else {
String ext = file.name.substring(file.name.lastIndexOf(".") + 1).toLowerCase()
if (ext in ["tif"]) {
return new GeoTIFF(file)
} else if (ext in ["png","jpg","jpeg","gif"]) {
return new WorldImage(file)
} else if (ext in ["arx"]) {
return new Grass(file)
} else if (ext in ["sid"]) {
return new MrSID(file)
} else if (ext in ["asc"]) {
return new ArcGrid(file)
} else if (ext in ["nc"]) {
return new NetCDF(file)
} else {
return null
}
}
}
else
{
AbstractGridFormat format = GridFormatFinder.findFormat(input);
if (format == null || format instanceof UnknownFormat) {
return null
}else{
return new Format(format, input)
}
}
}
from geoscript-groovy.
This looks like an excellent idea! I will get this in soon (before we cut the 1.5 release).
from geoscript-groovy.
Related Issues (20)
- Add OSM XML Layer Reader
- Add Raster.getShadedRelieft method HOT 1
- Fix HatBox / PostGIS conflict
- Add metatile support to the tile generator HOT 1
- Add TWKBReader HOT 1
- Spatialite Workspace should depend on OGR instead of unsupported gt-spatialite HOT 1
- Viewer.plot issues HOT 1
- Missing org/jfree/chart/JFreeChart HOT 2
- java 11/13 compilation and split problems HOT 2
- Add variable buffer method to Geometry. HOT 1
- Add largest empty circle method to Geometry HOT 1
- Add maximum inscribed circle method to Geometry HOT 1
- Move OrbisGIS to GeoScript-Groovy HOT 5
- From OrbisGIS to GeoScript
- Add Hilbert Packed Rtree HOT 1
- Use JTS GeometryFixer to fix invalid geometry HOT 2
- Use Rule name with LegendItem HOT 7
- ScaleBarItem border properties HOT 2
- Layer name [QUESTION] HOT 1
- Update to Groovy 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoscript-groovy.