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

Implementing an srsinfo function? #79

Open
mthh opened this issue Jul 17, 2024 · 4 comments
Open

Implementing an srsinfo function? #79

mthh opened this issue Jul 17, 2024 · 4 comments

Comments

@mthh
Copy link
Contributor

mthh commented Jul 17, 2024

In the same way as ogrinfo and gdalinfo are implemented in https://github.com/bugra9/gdal3.js/tree/master/src/allJsFunctions/application, we could have a srsinfo function that offers roughly the same functionality as gdalsrsinfo (https://gdal.org/programs/gdalsrsinfo.html).

This would seem useful to me, as there doesn't seem to be a good parser for WKT2 projection definitions in JavaScript, and gdal can convert srs definitions into many formats (proj4, projjson, wkt1, various flavors of wkt2, etc.).

Given the code of gdalsrsinfo (https://github.com/OSGeo/gdal/blob/master/apps/gdalsrsinfo.cpp) it seems to require a bit of work to port it but I can take a look if you're interested in such a feature.

@bugra9
Copy link
Owner

bugra9 commented Jul 29, 2024

Hi @mthh,

Sorry for the late reply. I have been working on the v3.0.0 version with the new architecture for a long time and it is almost done.

It would be very nice if the gdal3.js supported all the features of Gdal :).

For gdalinfo there are gdalinfo_bin.cpp and gdalinfo_lib.cpp files. gdalinfo_lib.cpp does the actual work and is included in the gdal library. gdalinfo_bin.cpp compiles to binary using gdalinfo_lib.cpp and is not included in the gdal library.

For the gdalsrsinfo file there is only the gdalsrsinfo.cpp file which is compiled to binary, not included in the gdal library. This makes things difficult.

In the current version, we were writing the codes that are not in the gdal library with javascript, and it looks like it will be necessary to write the entire gdalsrsinfo.cpp file with javascript.

In v3.0.0, I moved all javascript code to c++ and now we can directly access the code written by c++. In this system, if we change the main function in gdalsrsinfo.cpp to another name, it will be called by js and simply implemented.

If you want to add it to the version with v2.x and open PR, I will merge it directly. If you haven't done any work yet, I will release v3.0.0 alpha in 1-2 weeks and I can add it to new version. But it may cause issues because it will be in alpha version and may require migration in the code due to the new architecture.

https://github.com/users/bugra9/projects/10?pane=info

What do you think about it?

@mthh
Copy link
Contributor Author

mthh commented Jul 30, 2024

Hi @bugra9,

I have been working on the v3.0.0 version with the new architecture for a long time and it is almost done.

Great news!

If you want to add it to the version with v2.x and open PR, I will merge it directly. If you haven't done any work yet, I will release v3.0.0 alpha in 1-2 weeks and I can add it to new version. But it may cause issues because it will be in alpha version and may require migration in the code due to the new architecture.

I haven't done any work on it yet.
But it would be great if you could include this in v3.0.0 (and if you can't include it as soon as v3.0.0, I might try to contribute it for a later version).
By the way, count on me to test the alpha / beta versions of the v3.0.0 (I notably rely on gdal3.js in https://github.com/riatelab/magrit, a thematic cartography application I'm developing, to import / export user datasets).

@bugra9
Copy link
Owner

bugra9 commented Jul 30, 2024

I will include it in v3.0.0-alpha and try to release it as soon as possible.

@bugra9
Copy link
Owner

bugra9 commented Aug 25, 2024

@mthh, I created a branch for v3.0.0 and opened PR. Your feedback is very important to me.

Main features:

  • I changed the extension of the .data file to .data.txt for automatic compression. (reduced data size)
  • With the help of the plugin only the used code is compiled. (not active) (reduce wasm size)
  • I compiled all dependencies and moved them under the bugra9/cpp.js project. Each library is now an npm package. I want to package and support all dependencies. (easy build, easy share) (https://github.com/bugra9/cpp.js/tree/main/packages)
  • Gdal is written based on C. I implemented a high level wrapper with c++ for easy use. (https://github.com/bugra9/gdal3.js/tree/v3.0.0-cpp.js-integration/src/native)
  • I am focused on supporting all of Gdal's methods instead of just some applications. I try not to break away from Gdal.
  • I removed the virtual file system for Node.js.
  • React Native (Android + iOS) support.

V3.0.0 branch: https://github.com/bugra9/gdal3.js/tree/v3.0.0-cpp.js-integration

Web: https://gdal3.js.org/v3/
iOS Beta App Invitation: https://testflight.apple.com/join/X47Va3wd
Android App: https://play.google.com/store/apps/details?id=org.js.gdal3

Dependencies: Docker, node.js, cmake > 3.28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo (Feature)
Development

No branches or pull requests

2 participants