-
Notifications
You must be signed in to change notification settings - Fork 10
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
Example from README doesn't work on proj 9.2.0, proj4rb 3.0.0 #22
Comments
So assert_in_delta assumes you are running it as part of a unit test (that method comes from minitest). So I should probably remove those calls from the example. Anyway, this exact test is in the test suite - see https://github.com/cfis/proj4rb/blob/master/test/transformation_test.rb#L24. it passes when test runs and I just tried it locally successfully. So not sure. If you run that test locally, does it pass? |
That was my mistake for including those lines, I knew that — I should've removed those lines from this output. As you can see in the last line, the x and y values don't match to what they should be. Output of
|
|
Weird. Really don't know. I guess most of the tests fail then? What OS are you on (not that it should make a difference)? The message "Ballpark geographic offset from WGS 84 to unknown + unknown" seems suspicious. Wonder if somehow different proj.db is being loaded? |
Ok, I think I figured it out. EPSG needs to be capitalized when sent to proj_create which is the API used under t hood. Note for the proj strings "+init=epsg:4326" it can be lowercase. Maybe this is something new in current Proj versions? So try: Proj::Transformation.new('EPSG:31467', 'EPSG:4326') |
I updated the code to use capitals for EPSG, but the transformation.rb tests still fail in the exact same way. |
I'm using an Apple M1, ruby 3.0.0p0, proj 9.2.0, proj4b 3.0.0 (HEAD). Still getting the same issue:
And while the transformation you listed can be created, it doesn't seem to work:
|
Just ran the test suite:
Attached are the STDERR and STDOUT outputs. |
Ok. Unfortunately I can't duplicate what you are seeing, so not sure what its causing it. I'd check the proj database path and see if it looks right: https://github.com/cfis/proj4rb/blob/master/test/database_test.rb#L24 Maybe also the proj search paths: https://github.com/cfis/proj4rb/blob/master/test/proj_test.rb#L17 Then maybe use projinfo (https://proj.org/apps/projinfo.html) and compare what it says versus the Ruby bindings. Sorry not much that help I know. FYI, you can run all tests using |
Womp. Can't find the DB. Any advice for fixing that? Attached is |
Ah - that explains it! So PROJ_LIB is the old ENV, its not PROJ_DATA (but PROJ_LIB still works). See https://proj.org/usage/environmentvars.html#envvar-PROJ_DATA. Just make sure PROJ_DATA is set right (you can't set it in side the ruby program has to be before it runs). Alternatively, in your script, you can use this method on Context: https://rubydoc.info/github/cfis/proj4rb/Proj%2FContext:search_paths= Or this one on Database: https://rubydoc.info/github/cfis/proj4rb/Proj/Database#path=-instance_method What doesn't quite make sense though is you said the proj executables run without issue. Thus the Ruby bindings should work too. |
It feels good to get closer! Unfortunately, I still can't get it to work. I'm going to give up for now and just use |
I installed the gem locally from HEAD, and I am unable to get the right answer for the example in the README.
I believe it should be [48.98963932450735, 8.429263044355544].
The text was updated successfully, but these errors were encountered: