-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add run-time and compile-time projections/transformations parameters. #496
Add run-time and compile-time projections/transformations parameters. #496
Conversation
There are 3 ways of defining parameters: // run-time Proj4 string srs::proj4("+proj=tmerc +ellps=WGS84 +units=m") // run-time using namespace srs::dpar; parameters<>(proj_tmerc)(ellps_wgs84)(units_m) // compile-time using namespace srs::spar; parameters<proj_tmerc, ellps_wgs84, units_m>
…meters. Run-time and compile-time EPSG, ESRI and IAU2000 codes.
…tion of new parameters.
Wrong ifstream.open() argument and shadowing of template argument.
This is awesome, thanks Adam for this overhaul! |
@awulkiew BTW, how is the PROJ.4 to Boost.Geometry conversion managed now? I can't find anything about the procedure. It used to be semi-automatic, AFAIR. |
@mloskot Now it's fully manual. I guess it could be partially automated but it'd rely on consistency of Proj4 and the automation code would have to be re-written because both Proj4 and Boost.Geometry was changed since it was last used. I don't consider it worth it because it was used only for projections (code in |
20ff4f3
to
5729e6f
Compare
6bc4259
to
de95e2c
Compare
@awulkiew Your explanation makes sense. Thanks. It just made me wonder about the maintenance; how the updates in PROJ.4 are going to be captured, if at all; how to document the procedure, etc. |
Cool! Will look at it tomorrow |
I'm OK with merging this! Thanks a lot @awulkiew ! |
Thanks, I am ok with merging. |
Thanks for the reviews! |
With this PR transformations' parameters can be expressed in following ways:
run-time Proj4 string
run-time
compile-time
This PR also changes the way of processing parameters in general. In the original code some parameters like
datum
orellps
were expanded which resulted in addition of new parameters into parameter list. Default parameters could also be added. I removed this mechanism because otherwise I'd be forced to implement rewriting of static parameters in compile-time which would increase the compilation time. the old behavior is emulated though. Now instead of expanding parameters and adding defaults at the beginning, the parameter is searched on the parameters list and if it's not found only then it may be extracted from other parameter (e.g. ellipsoid from datum) and after that the default may be used. A side effect of this change is that the initialization with Proj4 string is 2x faster in my test which is creation of transformation:Replacing string-based parameters with run-time parameters speeds up the creation another 5x. So WRT the previous implementation (string-based always modifying parameters by expanding them and adding defaults) the speedup is 10x.
Replacing run-time parameters with compile-time parameters speeds up the creation another 2x, so WRT the original 20x.
Furthermore it's still possible to initialize transformations passing SRID codes (EPSG, ESRI, IAU2000), but now newly introduced, non-string-based parameters are used for this which means the initialization is faster. Before Proj4 strings were used for this.
I also improved const-corectness of the code, e.g. the input coordinates of projections are not modified so projections does not rely on the internal caller to work properly. This was affecting combined projections (projection calling another projection).