private boolean isEllipsoidTransformNeeded( ICRS sourceCRS, ICRS targetCRS ) { final IGeodeticDatum sourceDatum = sourceCRS.getGeodeticDatum(); final IGeodeticDatum targetDatum = targetCRS.getGeodeticDatum(); if ( !sourceDatum.equals( targetDatum ) ) { final IEllipsoid sourceEllipsoid = sourceDatum.getEllipsoid(); final IEllipsoid targetEllipsoid = targetDatum.getEllipsoid(); // If the two coordinate systems use different ellipsoid, a // transformation needs to take place. return sourceEllipsoid != null && !sourceEllipsoid.equals( targetEllipsoid ); } return false; }
/** * @return the ellipsoid of the datum. */ public IEllipsoid getEllipsoid( IGeographicCRS geographicCRS ) { return geographicCRS.getGeodeticDatum().getEllipsoid(); }
/** * @return the eccentricity of the ellipsoid of the datum. */ public final double getEccentricity( IGeographicCRS geographicCRS ) { return geographicCRS.getGeodeticDatum().getEllipsoid().getEccentricity(); }
/** * @return the semiMajorAxis (a) of the ellipsoid of the datum. */ public final double getSemiMajorAxis( IGeographicCRS geographicCRS ) { return geographicCRS.getGeodeticDatum().getEllipsoid().getSemiMajorAxis(); }
/** * @return the semiMinorAxis (a) of the ellipsoid of the datum. */ public final double getSemiMinorAxis( IGeographicCRS geographicCRS ) { return geographicCRS.getGeodeticDatum().getEllipsoid().getSemiMinorAxis(); }
/** * @return the eccentricity of the ellipsoid of the datum. */ public final double getSquaredEccentricity( IGeographicCRS geographicCRS ) { return geographicCRS.getGeodeticDatum().getEllipsoid().getSquaredEccentricity(); }
public boolean isSpherical( IGeographicCRS geographicCRS ) { return geographicCRS.getGeodeticDatum().getEllipsoid().getEccentricity() < 0.0000001; }
xmlWriter.writeCharacters( datum.getEllipsoid().getCode().getOriginal().toLowerCase() ); xmlWriter.writeEndElement();
xmlWriter.writeCharacters( datum.getEllipsoid().getCode().toString() ); xmlWriter.writeEndElement();
String toEllips = gsf.getToEllipsoid(); IEllipsoid sourceEl = sourceCRS.getGeodeticDatum().getEllipsoid(); IEllipsoid targetEl = targetCRS.getGeodeticDatum().getEllipsoid();
IGeodeticDatum d = (GeodeticDatum) crs.getDatum(); datums.add( d ); ellipsoids.add( d.getEllipsoid() );
/** * @param sourceCRS * @param targetCRS * @param id * @param gsf * the loaded gridshift file */ public NTv2Transformation( ICRS sourceCRS, ICRS targetCRS, CRSResource id, GridShiftFile gsf ) { this( sourceCRS, targetCRS, id ); this.gsf = gsf; String fromEllips = gsf.getFromEllipsoid(); String toEllips = gsf.getToEllipsoid(); IEllipsoid sourceEl = sourceCRS.getGeodeticDatum().getEllipsoid(); IEllipsoid targetEl = targetCRS.getGeodeticDatum().getEllipsoid(); // rb: patched the gridshift file for access to the axis if ( Math.abs( sourceEl.getSemiMajorAxis() - gsf.getFromSemiMajor() ) > 0.001 || Math.abs( sourceEl.getSemiMinorAxis() - gsf.getFromSemiMinor() ) > 0.001 ) { LOG.warn( "The given source CRS' ellipsoid (" + sourceEl.getCode().getOriginal() + ") does not match the 'from' ellipsoid (" + fromEllips + ")defined in the gridfile: " + gridURL ); } if ( Math.abs( targetEl.getSemiMajorAxis() - gsf.getToSemiMajor() ) > 0.001 || Math.abs( targetEl.getSemiMinorAxis() - gsf.getToSemiMinor() ) > 0.001 ) { LOG.warn( "The given target CRS' ellipsoid (" + targetEl.getCode().getOriginal() + ") does not match the 'to' ellipsoid (" + toEllips + ") defined in the gridfile: " + gridURL ); } isIdentity = ( Math.abs( gsf.getFromSemiMajor() - gsf.getToSemiMajor() ) < 0.001 ) && ( Math.abs( gsf.getFromSemiMinor() - gsf.getToSemiMinor() ) < 0.001 ); }
IEllipsoid ellips = d.getEllipsoid(); String ellpsName = rs.getString( count++ );
final IGeocentricCRS sourceGCS = ( sourceDatum.getEllipsoid().isSphere() && isIdentity( sourceH ) ) ? GeocentricCRS.WGS84 : new GeocentricCRS( sourceDatum, name ); name = targetCRS.getName() + "_Geocentric"; final IGeocentricCRS targetGCS = ( targetDatum.getEllipsoid().isSphere() && isIdentity( targetH ) ) ? GeocentricCRS.WGS84 : new GeocentricCRS( targetDatum,
private void calcParams() { if ( getSourceCRS().getType() == CRSType.COMPOUND ) { this.hasHeight = true; defaultHeightValue = ( (ICompoundCRS) getSourceCRS() ).getDefaultHeight(); } else if ( getTargetCRS().getType() == CRSType.COMPOUND ) { this.hasHeight = true; defaultHeightValue = ( (ICompoundCRS) getTargetCRS() ).getDefaultHeight(); } else { this.hasHeight = false; defaultHeightValue = 0; } IEllipsoid ellipsoid = getSourceCRS().getGeodeticDatum().getEllipsoid(); semiMajorAxis = Unit.METRE.convert( ellipsoid.getSemiMajorAxis(), ellipsoid.getUnits() ); semiMinorAxis = Unit.METRE.convert( ellipsoid.getSemiMinorAxis(), ellipsoid.getUnits() ); squaredSemiMajorAxis = semiMajorAxis * semiMajorAxis; squaredSemiMinorAxis = semiMinorAxis * semiMinorAxis; squaredEccentricity = ellipsoid.getSquaredEccentricity(); // e2 = ( a2 - b2 ) / a2; ep2 = ( squaredSemiMajorAxis - squaredSemiMinorAxis ) / squaredSemiMinorAxis; }