Expo module for processing GeoPDF files using GDAL with coordinate transformation to WGS84.
- Read GeoPDF metadata and information
- Render GeoPDF files to PNG images
- Transform coordinates from native CRS to WGS84 (EPSG:4326)
- List available GDAL drivers
- Get GDAL version information
npm install https://github.com/syntaxdevs/expo-gdal.git
# or
yarn add https://github.com/syntaxdevs/expo-gdal.gitnpm install expo-gdal
# or
yarn add expo-gdalThis repository includes an example Expo app for testing the module locally.
cd example
npm installThen run on a device or simulator:
npx expo run:ios
# or
npx expo run:androidThis module requires the GDAL native libraries for both platforms:
- Android:
android/libs/gdal-release.aar - iOS:
ios/GDAL.xcframework
Make sure both native libraries are present in the correct locations.
import {
getVersionInfo,
listDrivers,
readGeoPDF,
renderGeoPDFToPng
} from 'expo-gdal';
// Get GDAL version information
const versionInfo = await getVersionInfo();
// List available GDAL drivers
const drivers = await listDrivers();
// Read GeoPDF metadata
const pdfInfo = await readGeoPDF('/path/to/file.pdf');
// Render GeoPDF to PNG with WGS84 coordinates
const result = await renderGeoPDFToPng(
'/path/to/input.pdf',
'/path/to/output.png'
);
// Access transformed coordinates (WGS84)
console.log('Top-left:', result.result?.topLeft); // { x: longitude, y: latitude }
console.log('Center:', result.result?.center); // { x: longitude, y: latitude }Returns GDAL version information.
Returns: Promise<VersionInfoResponse>
Lists all available GDAL drivers.
Returns: Promise<DriversListResponse>
Reads GeoPDF file metadata and information.
Parameters:
filePath(string): Path to the GeoPDF file
Returns: Promise<ReadGeoPDFResponse>
Renders a GeoPDF file to a PNG image and returns WGS84 coordinates.
Parameters:
inputPath(string): Path to the input GeoPDF fileoutputPath(string): Path where the PNG will be saved
Returns: Promise<RenderGeoPDFResponse>
The response includes:
width,height: Image dimensions in pixelsgeoTransform: GeoTransform matrixtopLeft,topRight,bottomLeft,bottomRight: Corner coordinates in WGS84 (longitude, latitude)center: Center coordinates in WGS84 (longitude, latitude)
All coordinates returned by renderGeoPDFToPng are automatically transformed to WGS84 (EPSG:4326) format:
- x: Longitude in decimal degrees (-180 to 180)
- y: Latitude in decimal degrees (-90 to 90)
This makes the coordinates compatible with most mapping libraries and services.
MIT