I haven't really digged deeper into either geotools referencing or 
javax.measure so far, but my first idea was not to check if the unit is 
"degree" but to check if it is derived from "rad" and then to apply a scale 
factor. I'll have a go at that and post a patch if it works...
 
My NDS gets converted by javax.measure to "rad*1.46...E-9" automatically, so 
that should not be a problem.
 
Cheers,
Harald


  _____  

        Von: [email protected] 
[mailto:[email protected]] Im Auftrag von Jesse Eichar
        Gesendet: Donnerstag, 9. April 2009 09:17
        An: User-friendly Desktop Internet GIS
        Betreff: Re: [udig-devel] Using a non-standard CRS
        
        
        The idea is there is a very simple and accurate way to calculate scale 
if the units are linear.  So ScaleUtilities uses 2 ways to calculate the scale 
of the map.  The method should probably called usesAngularUnits or something 
like that.  But I copied the method so I left the name alone.  If you can 
determine a better way to detect if the units are angular please let me know.
        
        JEsse
        
        
        On Thu, Apr 9, 2009 at 2:19 AM, Jody Garnett <[email protected]> 
wrote:
        

                Hi Harald:
                
                I am not sure what ScaleUtils is doing here; I expect there is 
a gap.
                I think the assumption is about "units" rather than the name 
"lat" or
                "long". I suspect Jesse has an optimized path for lat/long and 
this
                method is used to check what is going on before taking a longer 
more
                expensive code path involving transformations?
                
                Have a look at what calls this method? Also note we may need to 
teach
                the java units system about "NDS" in order to get this to work.
                
                Jody
                


                On Thu, Apr 9, 2009 at 2:11 AM, Wellmann, Harald
                <[email protected]> wrote:
                > I'm trying to make uDig use a non-standard CRS (called NDS) 
on my data, instead of converting all coordinates to WGS84 before uDig sees 
them.
                >
                > My CRS is simply a scaled version of WGS84, where 360° = 
2^32. The CRS is defined by WKT, by replacing the UNIT clause from WGS84 by
                >
                > UNIT["NDS", 0.000000001462918079267]
                >
                > The MathTransforms between WGS84 and NDS seem to work.
                >
                > Now I'm getting the following exception when opening my map:
                >
                > Caused by: javax.measure.converter.ConversionException: 
rad*1.462918079267E-9 is not compatible with m
                >        at 
javax.measure.unit.Unit.getConverterTo(Unit.java:224)
                >        at 
net.refractions.udig.project.internal.render.impl.ScaleUtils.fromCrsToMeter(ScaleUtils.java:64)
                >        at 
net.refractions.udig.project.internal.render.impl.ScaleUtils.calculateScaleDenominator(ScaleUtils.java:325)
                >        at 
net.refractions.udig.project.internal.render.impl.ViewportModelImpl.getScaleDenominator(ViewportModelImpl.java:1048)
                >        at 
net.refractions.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:298)
                >
                >
                >
                > and the cause for this seems to be the isLatLong() method
                >
                >
                >        /**
                >         * Determines if the crs is a lat/long crs (has 
angular units)
                >         *
                >         * @return true if the crs is a latlong crs (has 
angular units)
                >         */
                >        public static boolean 
isLatLong(CoordinateReferenceSystem crs) {
                >                Unit<?> unit = getUnit(crs);
                >                Unit<?> degrees = 
getUnit(DefaultGeographicCRS.WGS84);
                >                boolean isLatLong = 
CRS.equalsIgnoreMetadata(unit, degrees);
                >                return isLatLong;
                >        }
                >
                > In fact the comment does not seem to match the 
implementation. My CRS is a lat/lon CRS and it has angular units, only the unit 
is not degree but a multiple of degree, both are derived from rad.
                >
                > Is something wrong with my definitions, is there a gap in the 
ScaleUtils, or are all my attempts futile, since the implicit assumption 
lat/long=degrees is used all over the place....?
                >
                > Any hints appreciated...
                >
                > Regards,
                >
                > Harald
                >
                > *******************************************
                > innovative systems GmbH Navigation-Multimedia
                > Geschaeftsfuehrung: Edwin Summers - Michael Juergen Mauser
                > Sitz der Gesellschaft: Hamburg - Registergericht: Hamburg HRB 
59980
                >
                > *******************************************
                > Diese E-Mail enthaelt vertrauliche und/oder rechtlich 
geschuetzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender 
und loeschen Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte 
Weitergabe dieser Mail ist nicht gestattet.
                > This e-mail may contain confidential and/or privileged 
information. If you are not the intended recipient (or have received this 
e-mail in error) please notify the sender immediately and delete this e-mail. 
Any unauthorized copying, disclosure or distribution of the contents in this 
e-mail is strictly forbidden.
                > *******************************************
                > _______________________________________________
                > User-friendly Desktop Internet GIS (uDig)
                > http://udig.refractions.net
                > http://lists.refractions.net/mailman/listinfo/udig-devel
                >
                _______________________________________________
                User-friendly Desktop Internet GIS (uDig)
                http://udig.refractions.net
                http://lists.refractions.net/mailman/listinfo/udig-devel
                


_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to