public double getSemiMajorAxis() { return getReferencedObject().getSemiMajorAxis(); }
/** * @return the semiMajorAxis (a) of the ellipsoid of the datum. */ public final double getSemiMajorAxis( IGeographicCRS geographicCRS ) { return geographicCRS.getGeodeticDatum().getEllipsoid().getSemiMajorAxis(); }
/** * Export the ellipsoid to it's appropriate deegree-crs-definitions form. * * @param ellipsoid * to be exported * @param xmlWriter * to export the ellipsoid to. * @throws XMLStreamException */ protected void export( IEllipsoid ellipsoid, XMLStreamWriter xmlWriter ) throws XMLStreamException { if ( ellipsoid != null ) { xmlWriter.writeStartElement( CRSNS, "ellipsoid" ); // write the elements that are specific to Identifiable exportIdentifiable( ellipsoid, xmlWriter ); double sMajorAxis = ellipsoid.getSemiMajorAxis(); xmlWriter.writeStartElement( CRSNS, "semiMajorAxis" ); xmlWriter.writeCharacters( Double.toString( sMajorAxis ) ); xmlWriter.writeEndElement(); double inverseF = ellipsoid.getInverseFlattening(); xmlWriter.writeStartElement( CRSNS, "inverseFlattening" ); xmlWriter.writeCharacters( Double.toString( inverseF ) ); xmlWriter.writeEndElement(); export( ellipsoid.getUnits(), xmlWriter ); xmlWriter.writeEndElement(); } }
/** * Export the ellipsoid to it's appropriate deegree-crs-definitions form. * * @param ellipsoid * to be exported * @param xmlWriter * to export the ellipsoid to. * @throws XMLStreamException */ @Override protected void export( IEllipsoid ellipsoid, XMLStreamWriter xmlWriter ) throws XMLStreamException { if ( ellipsoid != null ) { xmlWriter.writeStartElement( CRSNS, "Ellipsoid" ); // write the elements that are specific to Identifiable exportIdentifiable( ellipsoid, xmlWriter ); export( ellipsoid.getUnits(), xmlWriter ); double sMajorAxis = ellipsoid.getSemiMajorAxis(); xmlWriter.writeStartElement( CRSNS, "SemiMajorAxis" ); xmlWriter.writeCharacters( Double.toString( sMajorAxis ) ); xmlWriter.writeEndElement(); double inverseF = ellipsoid.getInverseFlattening(); xmlWriter.writeStartElement( CRSNS, "InverseFlattening" ); xmlWriter.writeCharacters( Double.toString( inverseF ) ); xmlWriter.writeEndElement(); xmlWriter.writeEndElement(); } }
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() 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()
/** * @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 ); }
double a = ellips.getSemiMajorAxis(); double f = ellips.getInverseFlattening(); double b = ellips.getSemiMinorAxis();
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; }