Detect the Types of Geospatial Input, including ASCII Grid, Auxiliary XML, GeoTIFF, JPG, PNG, SHP (Shapefile), and World File
- Memory Safe: avoids loading the whole file into memory
const geoFileType = require("geo-file-type");
const fs = require("fs");
const buffer = fs.readFileSync("./data/chattanooga.shp");
const result = geoFileType({
data: buffer,
debug: false // set debug to true for extra logging
});
// result is { type: "SHP (Shapefile)" }
Name | Supported |
---|---|
ASCII Grid | Yes |
Auxiliary XML | Yes |
Cloud Optimized GeoTIFF | Yes |
GeoRaster | Yes |
GeoJSON | No |
GeoTIFF | Yes |
NetCDF | Yes |
JPG | Yes |
PNG | Yes |
PRJ | Yes |
SHP (Shapefile) | Yes |
TopoJSON | No |
World File | Yes |
If you'd like to learn more about the formats, please consult the following:
- ASCII Grid: https://en.wikipedia.org/wiki/Esri_grid
- Cloud Optimized GeoTIFF: https://www.cogeo.org/
- GeoTIFF: https://en.wikipedia.org/wiki/GeoTIFF
- GeoRaster: https://github.com/geotiff/georaster
- GeoJSON: https://geojson.org/
- JPG: https://en.wikipedia.org/wiki/JPEG
- PNG: https://en.wikipedia.org/wiki/Portable_Network_Graphics
- NetCDF: https://en.wikipedia.org/wiki/NetCDF
- TopoJSON: https://github.com/topojson/topojson
- World File: https://en.wikipedia.org/wiki/World_file