Announcement

Collapse
No announcement yet.

New Projection + zoom

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • New Projection + zoom

    Hello.

    I implemented a new projection extending the FlatGlobe class in WWJ, but when I zoom the map the application doesn't apply the zoom, it seems that it is always on level 0 zoom. How does WWJ implement the zoom factor? Is there any other class that I need to extend?

    Thanks,
    Denis

  • #2
    I have implemented my projection (Azimuthal Equidistant) using the equations described in this link http://mathworld.wolfram.com/Azimuth...rojection.html

    So I implemented methods geodeticToCartesian

    Code:
    Angle lonDif = Angle.fromRadians(longitude.radians - azLonCenter.radians);
    
    if(lonDif.radians == 0) {
    	lonDif = Angle.fromRadians(0.000001);
    }
    
    double c = Math.acos(azLatCenter.sin() * latitude.sin() + azLatCenter.cos() * latitude.cos() * lonDif.cos());
    double k = c / Math.sin(c);
    
    double x = this.equatorialRadius * k * latitude.cos() * lonDif.sin();
    double y = this.equatorialRadius * k * (azLatCenter.cos()*latitude.sin() - azLatCenter.sin()*latitude.cos()*lonDif.cos());
    
    cart = new Vec4(x, y, metersElevation);
    and cartesianToGeodetic
    Code:
    double x = cart.x / this.equatorialRadius;
    double y = cart.y / this.equatorialRadius;
    double c = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
    if(c == 0) {
    	c = 0.000000000001;
    }
    double lat;
    double lon;
    
    lat = Math.asin(Math.cos(c) * azLatCenter.sin() + (y * Math.sin(c) * azLatCenter.cos() / c));
    
    if(azLatCenter.degrees == 90.0) {
    	lon = azLonCenter.radians + Math.atan2(-x, y);
    } else if(azLatCenter.degrees == -90.0) {
    	lon = azLonCenter.radians + Math.atan2(x, y);
    } else {
    	lon = azLonCenter.radians + Math.atan2((x * Math.sin(c)), (c * azLatCenter.cos() * Math.cos(c) - y * azLatCenter.sin() * Math.sin(c)));
    }
    
    pos = Position.fromRadians(lat, lon, cart.z);
    That's ok, but when I zoom in a local close to my map center (azLatCenter and azLonCenter), WWJ doesn't change the zoom level, it seems that it is always in level 0. If it is far form the map center, WWJ apply the zoom factor correctly. I noticed that if i change the x formula in geodeticToCartesian, for example using the x for Plate Carree (x = this.equatorialRadius * longitude.radians), it works fine. So, I'm trying to debug the BasicTiledImageLayer and TiledImageLayer to find why it is not calculating the correctly zoom level, but it's not working. How does WWJ calculate the zoom level based on projection? Hope someone can help me.

    Thanks,
    Denis

    Comment


    • #3
      Hello Denis,
      I am also trying to integrate a bunch of projections in the FlatWorld case... see end of:
      http://forum.worldwindcentral.com/sh...ger-Projection!
      I'm getting quite close to complete, but noticed also the lack of tile downloads in this mode, i suppose now it is due to the zoom level calculation, as you say.
      I'll try to investigate when I'll have time and when all my projections will get working (still a problem with some local projections (UTMs...)
      Cheers

      Comment


      • #4
        Hello.

        I was trying to debug the problem and I noticed that the problem is in the method needToSplit in TiledImageLayer.java. This method is always returning false, so it is never changing the zoom level. I noticed that this method uses one parameter, detailFactor and it is always 2.8. I tried to change the return multiplying the return for some values (0.009 for example) and it changed the zoom level, but it is not working fine yet. It seems that for greater levels it is not calculating correctly and it tries to load lot of tiles. What does this parameter (detail factor) means? And there are some parameters that I don't know well what are they for, like texelSize and cellHeight. It seems that this method depends of the projection to calculate if it is necessary to split or not, but for some reason it is not working for my azimuthal projection. Hope someone can help me.

        Thanks,
        Denis

        Comment


        • #5
          We have found and repaired an issue in World Wind Java's TiledImageLayer class that was causing this issue.

          The changes are in the WWJ 2.0 source in SVN revision #1823 and the daily build on January 21, 2014. See the following JIRA ticket for more information:
          http://issues.worldwind.arc.nasa.gov...browse/WWJ-448
          Dave
          WW Team

          Comment


          • #6
            I tried to change the return multiplying the return for some values (0.009 for example) and it changed the zoom level, but it is not working fine yet. It seems that for greater levels it is not calculating correctly and it tries to load lot of tiles.
            Nox Vidmate VLC

            Comment

            Working...
            X