[Proj] Using jniwrap

Michael Speth spethm at landcareresearch.co.nz
Wed Nov 23 12:38:23 PST 2011


I was able to use the jar without issue after compiling with make 
install (had to do a make clean first).  My next question is how do I 
use the tool?

The command that I have been using with the proj binary is:
proj +proj=healpix -f '%.'17'f' +lon_0=0 +a=1 -E
0 0
EOF

I'm not sure what sourcePJ should be in the following example

[code]
         PJ sourcePJ = new PJ("+a=1 +lon_0=0");
         PJ targetPJ = new PJ("+proj=healpix");
         double[] coordinates = {
             0,       0,
         };
         sourcePJ.transform(targetPJ, 2, coordinates, 0, 1);
         System.out.println(Arrays.toString(coordinates));
[/code]

Thanks

On 23/11/11 14:57, Michael Speth wrote:
> Anyone have experience with using the jniwrap java wrapper?
>
> I've compiled the jar and set the native library path; however, I get 
> an error when I try to run the example from the README.  Is there 
> something that I haven't configured correctly?
>
> [code]
>         PJ sourcePJ = new PJ("+init=epsg:32632");           // (x,y) 
> axis order
>         PJ targetPJ = new PJ("+proj=latlong +datum=WGS84"); // (λ,φ) 
> axis order
>         double[] coordinates = {
>             500000,       0,   // First coordinate
>             400000,  100000,   // Second coordinate
>             600000, -100000    // Third coordinate
>         };
>         sourcePJ.transform(targetPJ, 2, coordinates, 0, 3);
>         System.out.println(Arrays.toString(coordinates));
>
> [output]
> Exception in thread "main" java.lang.IllegalArgumentException: 
> +init=epsg:32632
>     at org.proj4.PJ.<init>(Unknown Source)
>     at 
> org.landcare.scenzgrid.proj4.test.HEALPixTest.main(HEALPixTest.java:36)
>
> Thanks
> -- 
> Michael Speth
> Research Systems Developer
> Landcare Research


-- 
Michael Speth
Research Systems Developer
Landcare Research

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20111124/282764e9/attachment.html>


More information about the Proj mailing list