-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
v.out.ogr: Fix exporting vector layers from a location whose CRS has no EPSG code #3869
base: main
Are you sure you want to change the base?
Conversation
…tion Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…tion Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose OSRDestroySpatialReference is still missing, but the issue was there before. I'm fine with this PR just fixing the issue and adding a test for that.
|
||
# Create new session to avoid temporary region | ||
self.session_file, env_new = gs.core.create_environment( | ||
env_orig["GISDBASE"].replace("'", "").replace(";", ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use a comment or two about why these two replace calls are needed. Are the characters an issue? Why are the characters there? How is the original GISDBASE working with them?
(Same for line 77.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those characters are included in the variable string, e.g. '/home/lads/GRASSDATA';
. The tests do not fail if you don't remove them, however, the following call to rmtree
then does not remove the actual temporary location. Garbage is thus left behind in the file system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry to keep this hanging, but I find it both puzzling and concerning that GISDBASE retrieved by g.gisenv has quotes and a semicolon. Are you sure that's what you have there? Can you please directly run g.gisenv
in the same or similar session you run the tests?
GRASS nc_basic_spm_grass7/user1:script > g.gisenv
GISDBASE=/home/vpetras/grassdata
LOCATION_NAME=nc_basic_spm_grass7
MAPSET=user1
GUI=text
PID=1094462
GRASS nc_basic_spm_grass7/user1:script > python -c "import grass.script as gs; print(gs.gisenv())"
{'GISDBASE': '/home/vpetras/grassdata', 'LOCATION_NAME': 'nc_basic_spm_grass7', 'MAPSET': 'user1', 'GUI': 'text', 'PID': '1094462'}
And can you print from the test? (You may need to fail the test to get a print.)
self.assertFalse(env_orig)
@ldesousa Can you please:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments are in my previous review (see the review and unresolved comments).
Co-authored-by: Vaclav Petras <[email protected]>
Once it will be ready for merging, the title isn't clear to me what it does (an issue number is great for PR descriptions, but less as a changelog entry and PR titles). Our PR titles are changelog entries, and are what we will see in the code in for the rest of the lifetime of the project |
@echoix I already lengthened/shortened the title a few times. Could you confer with @wenzeslaus which kind of title you wish for this PR? |
maybe "v.out.ogr: fix exporting vector layers from a location whose CRS has no EPSG code" ? |
@rouault Sorry, wrong tag. Let's wait for all the internal GRASS procedures to be ready. Then I will ask for your review again. Thanks. |
I actually find that great, I can't reword it any better way that doesn't end up sounding weird |
This PR addresses issue #2187: the
v.out.ogr
module fails to export vector layers from a location whose CRS does not have an entry in the EPSG registry. The root cause is the inadequate discarding of theOgr_projection
object in vector/v.out.ogr/main.c. In addition a new test is provided for this module verifying the correct creation of layers from such locations. This test fails with the current master branch (release 8.3).This PR is incremental on PR #3848. Please merge that one before merging this one.