Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to georeference an image? #11

Open
JamesLMilner opened this issue Aug 19, 2020 · 2 comments
Open

Best way to georeference an image? #11

JamesLMilner opened this issue Aug 19, 2020 · 2 comments

Comments

@JamesLMilner
Copy link

Hello! Firstly thanks for continuing on this library great to see it being maintained.

I am looking to try and georeference an image using node-gdal-next. I have seen in the tests (https://github.com/contra/node-gdal-next/blob/a41e0328a4551c6ebdd983b934433388fbc6d902/test/api_warp.test.js#L76) some examples of warping and reprojecting images, but it seems to be from one CRS to another CRS, rather than from an pixel space to a CRS. Is there a way to do georeference an image which doesn't already have a coordinate reference system? Essentially I think I'm looking to do the equivalent of these two GDAL commands:

gdal_translate -of GTiff -a_ullr ullon ullat lrlon lrlat -a_srs EPSG:4269 input.tif output.tif
gdalwarp -of GTiff  -t_srs EPSG:3857 input.tif output.tif

Let me know if this makes sense or if I can clarify anything.

@yocontra
Copy link
Owner

@JamesLMilner I wish we could bind a lot of those CLI tools (gdalwarp/gdal_translate) and make them available as simple JS APIs, but they aren't built in a way that makes that possible. The only real way to use them as-is is to just execute them with child_process.

The good news though is all those tools are doing is using the same lower level native APIs that this binding exposes and piecing them together - what I would recommend doing is looking at the source code of the command line tool that works for you and see if you can recreate the behavior using the same APIs. We do have GTiff bindings so you should be able to read in the file - I'm not sure how reprojecting that works though so please let me know if you have any issues with it and I can dig into it more.

@yocontra
Copy link
Owner

For reference you can find the source code for all of the command line tools here: https://github.com/contra/node-gdal-next/tree/master/deps/libgdal/gdal/apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants