Skip to content

Fix Robinson inverse projection - #2151

Merged
rouault merged 3 commits into
OSGeo:masterfrom
mraspaud:fix-robinson
Apr 14, 2020
Merged

rouault merged 3 commits into
OSGeo:masterfrom
mraspaud:fix-robinson

Conversation

@mraspaud

@mraspaud mraspaud commented Apr 14, 2020 •

Copy link
Copy Markdown
Contributor

This PR fixes the Robinson inverse projection so that coordinates outside of the main projection area become invalid.

  • Closes #xxxx
  • Tests added
  • Added clear title that can be used to generate release notes
  • Fully documented, including updating docs/source/*.rst for new API

The issue can be simply illustrated with this:

> invproj +proj=robin +a=6371000
16986804.16 100000
179d59'21.026"W	0d56'9.769"N
> proj +proj=robin +a=6371000   
179d59'21.026"W	0d56'9.769"N
-16984760.94	99999.99
> invproj +proj=robin +a=6371000
-16984760.94	99999.99
179d59'21.026"W	0d56'9.769"N

The first call to invproj should actually return invalid values.

Here is an illustration on before and after, showing the longitudes for the different coordinates (produced with pyproj and matplotlib).
before_robin
after_robin

The white areas denote invalid values. As you can see, before this PR, the longitudes were wrapped around the edges of the projection area.

I didn't add any unittest though, because I haven't found the file to add then too. Could give anyone give a hint for that ?

@rouault

rouault commented Apr 14, 2020

Copy link
Copy Markdown
Member

I didn't add any unittest though, because I haven't found the file to add then too. Could give anyone give a hint for that ?

In test/gie/builtins.gie , look for robin. The syntax should hopefully be obvious from existing cases
You can run it with gie test/gie/builtins.gie

@mraspaud

Copy link
Copy Markdown
Contributor Author

Thanks

Comment thread src/projections/robin.cpp Resolved
Co-Authored-By: Kristian Evers <kristianevers@gmail.com>
@mraspaud

Copy link
Copy Markdown
Contributor Author

Ok, I'm not sure how to test invalid values:

accept 17250000 100000
expect *	*

^ this doesn't seem to work

@rouault

rouault commented Apr 14, 2020 •

Copy link
Copy Markdown
Member

expect * *

expect failure or if you want to be more specificic expect failure errno lat_or_lon_exceed_limit (the 'lat_or_lon_exceed_limit' string comes from the lookup[] table in src/apps/gie.cpp, and you remove the leading pjd_err_ suffix from the strings there)

@mraspaud

Copy link
Copy Markdown
Contributor Author

Thanks, fixed now!

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

Successfully merging this pull request may close these issues.

3 participants