[OSRS-PROJ] Weirdnesses in the source code
judd at seas.marine.usf.edu
Tue Jul 8 14:36:38 EDT 2003
"Ton Hospel" <proj at ton.iguana.be> wrote in message
news:beetmc$nve$1 at post.home.lunix...
> In article <033901c34569$e4779270$cb88_783 at marine.us_.edu>,
> "Judd Taylor" <judd at seas.marine.usf.edu> writes:
> > Perl, eh?
> > I've got a pretty stable version that uses PDL::PP I've been meaning to
> > release out to CPAN. It works reall well and is real fast... I just need
> > add a function to query the actual values that Proj is using (after
> > defaults, files, etc have been applied to the command line options) so I
> > put in out output product metadata, but the guts are all there.
> > got PDL?
> Nope, but I just read up on it :-) Both it and your work sound
> But what I'm working on is not a straightforward interface into the
> library, since the resulting module would very closely match the
> C library semantics and not be very perlish.
> I want to get a very OO perl-style result, but mainly auto-generated
> from the proj code (so I can e.g. easily pick up any new stuff when
> it gets released). Basically I've written a parser/code generator that
> parses the PJ_*.c files and then spits out equivalent pure perl (for
> the people who can't compile) and XS code (for speed).
> And of course such an automated approach really needs to understand
> the code, which is how I found all these issues.
It is possible to do this type of thing in PDL::PP, where you write the OO
type code in a 'pp_addpm()' statement (code coes to the .pm file) and just
have the methods compiled (through PDL::PP) to call the standard C interface
for proj. I've done that sort of thing before, but I didn't have time to
make my PDL interface OO'd. It only took me about 2 days to write the
interface, which is only about 700 lines of PDL::PP. PDL::PP takes care of
annoying things like data types, memory management, array dimensions, etc...
that make writing code in c/c++ fun :)
The good thing about using the standard c interface for Proj4 is that you
don't have to know about the code, and you can reuse the shared object
library as-is without having to recompile all of it in PerlXS form (you only
need to compile the interface functions). You also don't have to
re-figure-everything-out every time you upgrade the Proj library (as long as
the exported c interface doesn't change, which it did last release...)
> Currently I'm concentrating on the pure perl output (actually i just
> succesfully autogenerated 114 perl modules). I'm now autogenerating
> test values and will fix the generator as appropiate (I expect a lot
> of flaws at this point).
I think you can just copy over a precompiled library and use it for users
that can't compile a PerlXS module directly... but I've never done it
before. Perlcode was not an option for me since I'm running it on huge
arrays data (some as large as 4040x5416), and speed in our application is
critical. It's being used to create mapped satellite data products from the
MODIS instrument as part of our NASA EOS DB project here at USF
(http://modis.marine.usf.edu/qc/, for some examples of output).
I'd be very interested in any test data you have (it's high on my interface
TODO list), although the way the interface is written I highly doubt there
would be any differences.
> see http://ton.perlgolf.org/proj/ if you are curious about the current
I've tarred up my interface and put it up here:
Keep in mind anyone who downloads this that my posting this code does not
constitute a GPL release, and its use is permitted for evaluation ONLY. Any
other uses are prohibited (including redistribution). If you are interested
in using my interface in production/commercial software, just wait a little
while so I can release it GPL style (it will only take me a couple of days
to finish it when I can get back to it). Just let me know you want to use
it, and I'll see how fast I can get it done. See the README file included in
the tarball for other copyright information.
Manager of Information Systems
Institute for Marine Remote Sensing
University of South Florida
140 7th Ave. South
St Petersburg, FL 33701
(727) 553-1103 (fax)
judd at marine.usf.edu
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.
More information about the Proj