Package org.osgeo.proj4j

Examples of org.osgeo.proj4j.ProjectionException


    int azi = Double.isNaN(alpha) ? 0 : 1;
    if (azi != 0) { // alpha specified
      if (Math.abs(alpha) <= TOL ||
        Math.abs(Math.abs(projectionLatitude) - ProjectionMath.HALFPI) <= TOL ||
        Math.abs(Math.abs(alpha) - ProjectionMath.HALFPI) <= TOL)
        throw new ProjectionException("Obl 1");
    } else {
      if (Math.abs(phi1 - phi2) <= TOL ||
        (con = Math.abs(phi1)) <= TOL ||
        Math.abs(con - ProjectionMath.HALFPI) <= TOL ||
        Math.abs(Math.abs(projectionLatitude) - ProjectionMath.HALFPI) <= TOL ||
        Math.abs(Math.abs(phi2) - ProjectionMath.HALFPI) <= TOL) throw new ProjectionException("Obl 2");
    }
    com = (spherical = es == 0.) ? 1 : Math.sqrt(one_es);
    if (Math.abs(projectionLatitude) > EPS10) {
      sinphi0 = Math.sin(projectionLatitude);
      cosphi0 = Math.cos(projectionLatitude);
View Full Code Here


        if (con < 0.)
          us += Math.PI * al / bl;
      } else
        us = al * bl * lam;
    }
    if (Math.abs(Math.abs(ul) - 1.) <= EPS10) throw new ProjectionException("Obl 3");
    vs = .5 * al * Math.log((1. - ul) / (1. + ul)) / bl;
    us -= u_0;
    if (!rot) {
      xy.x = us;
      xy.y = vs;
View Full Code Here

    if ( projectionLatitude1 == 0 )
      projectionLatitude1 = projectionLatitude2 = projectionLatitude;

    if (Math.abs(projectionLatitude1 + projectionLatitude2) < 1e-10)
      throw new ProjectionException();
    n = sinphi = Math.sin(projectionLatitude1);
    cosphi = Math.cos(projectionLatitude1);
    secant = Math.abs(projectionLatitude1 - projectionLatitude2) >= 1e-10;
    spherical = (es == 0.0);
    if (!spherical) {
View Full Code Here

  }

  public void initialize() { // urmfps
    super.initialize();
    if (n <= 0. || n > 1.)
      throw new ProjectionException("-40");
    C_y = Cy / n;
  }
View Full Code Here

      cosphi = Math.cos(lpphi);
      cosz = cosphi * coslam;
      if (mode == OBLIQ)
        cosz = sinph0 * sinphi + cosph0 * cosz;
      if (!no_cut && cosz < -EPS)
        throw new ProjectionException("F");
      s = 1. - cosz;
      if (Math.abs(s) > EPS) {
        t = 0.5 * (1. + cosz);
        Krho = -Math.log(t)/s - Cb / t;
      } else
        Krho = 0.5 - Cb;
      out.x = Krho * cosphi * sinlam;
      if (mode == OBLIQ)
        out.y = Krho * (cosph0 * sinphi -
          sinph0 * cosphi * coslam);
      else
        out.y = Krho * sinphi;
      break;
    case S_POLE:
    case N_POLE:
      out.y = Math.abs(p_halfpi - lpphi);
      if (!no_cut && (lpphi - EPS) > ProjectionMath.HALFPI)
        throw new ProjectionException("F");
      if ((out.y *= 0.5) > EPS) {
        t = Math.tan(lpphi);
        Krho = -2.*(Math.log(Math.cos(lpphi)) / t + t * Cb);
        out.x = Krho * sinlam;
        out.y = Krho * coslam;
 
View Full Code Here

    if (spherical) {
      double rh;

      rh = ProjectionMath.distance(xyx, out.y = cphi1 - xyy);
      out.y = cphi1 + phi1 - rh;
      if (Math.abs(out.y) > ProjectionMath.HALFPI) throw new ProjectionException("I");
      if (Math.abs(Math.abs(out.y) - ProjectionMath.HALFPI) <= EPS10)
        out.x = 0.;
      else
        out.x = rh * Math.atan2(xyx, xyy) / Math.cos(out.y);
    } else {
      double s, rh;

      rh = ProjectionMath.distance(xyx, out.y = am1 - xyy);
      out.y = ProjectionMath.inv_mlfn(am1 + m1 - rh, es, en);
      if ((s = Math.abs(out.y)) < ProjectionMath.HALFPI) {
        s = Math.sin(out.y);
        out.x = rh * Math.atan2(xyx, xyy) *
           Math.sqrt(1. - es * s * s) / Math.cos(out.y);
      } else if (Math.abs(s - ProjectionMath.HALFPI) <= EPS10)
        out.x = 0.;
      else throw new ProjectionException("I");
    }
    return out;
  }
View Full Code Here

    double c;

//    phi1 = pj_param(params, "rlat_1").f;
    phi1 = ProjectionMath.HALFPI;
    if (Math.abs(phi1) < EPS10)
      throw new ProjectionException("-23");
    if (!spherical) {
      en = ProjectionMath.enfn(es);
      m1 = ProjectionMath.mlfn(phi1, am1 = Math.sin(phi1),
        c = Math.cos(phi1), en);
      am1 = c / (Math.sqrt(1. - es * am1 * am1) * am1);
 
View Full Code Here

    double lam, alf, esc, ess;

//FIXME    land = pj_param(params, "ilsat").i;
land = 1;
    if (land <= 0 || land > 5)
      throw new ProjectionException("-28");
//FIXME    path = pj_param(params, "ipath").i;
path = 120;
    if (path <= 0 || path > (land <= 3 ? 251 : 233))
      throw new ProjectionException("-29");
    if (land <= 3) {
      projectionLongitude = DTR * 128.87 - ProjectionMath.TWOPI / 251. * path;
      p22 = 103.2669323;
      alf = DTR * 99.092;
    } else {
View Full Code Here

      cosphi = Math.cos(phi);
      coslam = Math.cos(lam);
      switch (mode) {
      case EQUATOR:
        xy.y = 1. + cosphi * coslam;
        if (xy.y <= EPS10) throw new ProjectionException();
        xy.x = (xy.y = Math.sqrt(2. / xy.y)) * cosphi * Math.sin(lam);
        xy.y *= mode == EQUATOR ? sinphi :
           cosphi0 * sinphi - sinphi0 * cosphi * coslam;
        break;
      case OBLIQUE:
        xy.y = 1. + sinphi0 * sinphi + cosphi0 * cosphi * coslam;
        if (xy.y <= EPS10) throw new ProjectionException();
        xy.x = (xy.y = Math.sqrt(2. / xy.y)) * cosphi * Math.sin(lam);
        xy.y *= mode == EQUATOR ? sinphi :
           cosphi0 * sinphi - sinphi0 * cosphi * coslam;
        break;
      case NORTH_POLE:
        coslam = -coslam;
      case SOUTH_POLE:
        if (Math.abs(phi + projectionLatitude) < EPS10) throw new ProjectionException();
        xy.y = ProjectionMath.QUARTERPI - phi * .5;
        xy.y = 2. * (mode == SOUTH_POLE ? Math.cos(xy.y) : Math.sin(xy.y));
        xy.x = xy.y * Math.sin(lam);
        xy.y *= coslam;
        break;
      }
    } else {
      double coslam, sinlam, sinphi, q, sinb = 0, cosb = 0, b = 0;

      coslam = Math.cos(lam);
      sinlam = Math.sin(lam);
      sinphi = Math.sin(phi);
      q = ProjectionMath.qsfn(sinphi, e, one_es);
      if (mode == OBLIQUE || mode == EQUATOR) {
        sinb = q / qp;
        cosb = Math.sqrt(1. - sinb * sinb);
      }
      switch (mode) {
      case OBLIQUE:
        b = 1. + sinb1 * sinb + cosb1 * cosb * coslam;
        break;
      case EQUATOR:
        b = 1. + cosb * coslam;
        break;
      case NORTH_POLE:
        b = ProjectionMath.HALFPI + phi;
        q = qp - q;
        break;
      case SOUTH_POLE:
        b = phi - ProjectionMath.HALFPI;
        q = qp + q;
        break;
      }
      if (Math.abs(b) < EPS10) throw new ProjectionException();
      switch (mode) {
      case OBLIQUE:
        xy.y = ymf * ( b = Math.sqrt(2. / b) )
           * (cosb1 * sinb - sinb1 * cosb * coslam);
        xy.x = xmf * b * cosb * sinlam;
 
View Full Code Here

  public ProjCoordinate projectInverse(double x, double y, ProjCoordinate lp) {
    if (spherical) {
      double  cosz = 0, rh, sinz = 0;

      rh = ProjectionMath.distance(x, y);
      if ((lp.y = rh * .5 ) > 1.) throw new ProjectionException();
      lp.y = 2. * Math.asin(lp.y);
      if (mode == OBLIQUE || mode == EQUATOR) {
        sinz = Math.sin(lp.y);
        cosz = Math.cos(lp.y);
      }
View Full Code Here

TOP

Related Classes of org.osgeo.proj4j.ProjectionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.