/** * Factory method for obtaining a new <code>LatLon</code> from two angles expressed in degrees. * * @param latitude in degrees * @param longitude in degrees * * @return a new <code>LatLon</code> from the given angles, which are expressed as degrees */ public static LatLon fromDegrees(double latitude, double longitude) { return new LatLon(latitude, longitude); }
/** * Returns a list of the Lat/Lon coordinates of a Sector's corners. * * @return an array of the four corner locations, in the order SW, SE, NE, NW */ public LatLon[] getCorners() { LatLon[] corners = new LatLon[4]; corners[0] = new LatLon(this.minLatitude, this.minLongitude); corners[1] = new LatLon(this.minLatitude, this.maxLongitude); corners[2] = new LatLon(this.maxLatitude, this.maxLongitude); corners[3] = new LatLon(this.maxLatitude, this.minLongitude); return corners; }
/** * Factor method for obtaining a new <code>LatLon</code> from two angles expressed in radians. * * @param latitude in radians * @param longitude in radians * * @return a new <code>LatLon</code> from the given angles, which are expressed as radians */ public static LatLon fromRadians(double latitude, double longitude) { return new LatLon(Math.toDegrees(latitude), Math.toDegrees(longitude)); }
public static List<LatLon> getLocations(List<Double> angles) { List<LatLon> locations = new ArrayList<LatLon>(); Angle latitude = null; Angle longitude = null; int index = 0; for (Double angle : angles) { if (0 == index % 2) { latitude = Angle.fromDegrees(angle); } else { longitude = Angle.fromDegrees(angle); locations.add(new LatLon(latitude, longitude)); } index++; } return locations; }
public LatLon next() { if (this.position > 3) throw new NoSuchElementException(); LatLon p; switch (this.position) { case 0: p = new LatLon(Sector.this.getMinLatitude(), Sector.this.getMinLongitude()); break; case 1: p = new LatLon(Sector.this.getMinLatitude(), Sector.this.getMaxLongitude()); break; case 2: p = new LatLon(Sector.this.getMaxLatitude(), Sector.this.getMaxLongitude()); break; default: p = new LatLon(Sector.this.getMaxLatitude(), Sector.this.getMinLongitude()); break; } ++this.position; return p; }
return p; return new LatLon( Angle.fromRadians(endLatRadians).normalizedLatitude(), Angle.fromRadians(endLonRadians).normalizedLongitude());
@Override @Nonnull public LatLon next() { final Coordinate coordinate = featureManagerSpi.findCoordinate(iterator.next()); return new LatLon(Angle.fromDegreesLatitude(coordinate.getLatitude()), Angle.fromDegreesLongitude(coordinate.getLongitude())); }
public LatLon subtract(LatLon that) { if (that == null) { throw new IllegalArgumentException("Angle Is Null"); } Angle lat = Angle.normalizedLatitude(this.latitude.subtract(that.latitude)); Angle lon = Angle.normalizedLongitude(this.longitude.subtract(that.longitude)); return new LatLon(lat, lon); }
public LatLon add(LatLon that) { if (that == null) { throw new IllegalArgumentException("Angle Is Null"); } Angle lat = Angle.normalizedLatitude(this.latitude.add(that.latitude)); Angle lon = Angle.normalizedLongitude(this.longitude.add(that.longitude)); return new LatLon(lat, lon); }
return p; return new LatLon( Angle.fromRadians(lat2).normalizedLatitude(), Angle.fromRadians(lon2).normalizedLongitude());
/** * Convenience method for converting a UTM coordinate to a geographic location. * * @param zone the UTM zone: 1 to 60. * @param hemisphere the hemisphere, either {@link gov.nasa.worldwind.avlist.AVKey#NORTH} or {@link * gov.nasa.worldwind.avlist.AVKey#SOUTH}. * @param easting the easting distance in meters * @param northing the northing distance in meters. * @param globe the <code>Globe</code>. Can be null (will use WGS84). * * @return the geographic location corresponding to the specified UTM coordinate. */ public static LatLon locationFromUTMCoord(int zone, String hemisphere, double easting, double northing) { UTMCoord coord = UTMCoord.fromUTM(zone, hemisphere, easting, northing); return new LatLon(coord.getLatitude(), coord.getLongitude()); }
/** * Convert a single MGRS coordinate to a decimal degree {@link Point} * * @param mgrs * The input MGRS coordinate {@link String} * * @return A {@link Point} converted from a MGRS coordinate string * * @throws IllegalArgumentException * If the input MGRS string is not valid */ public static Point toLatLonPoint(final String mgrs) { if (!MgrsConverter.isValid(mgrs)) { throw new IllegalArgumentException("MGRS string is not valid."); } // Creates a MGRS reference for conversion // The param for global is left null, which will default the projection to WGS84 final MGRSCoord mgrsCoordinate = MGRSCoord.fromString(mgrs); final GeometryFactory gf = new GeometryFactory(); //Returns MGRS Point to wayPoints Conversion final LatLon latLon = new LatLon(mgrsCoordinate.getLatitude(), mgrsCoordinate.getLongitude()); return gf.createPoint(new Coordinate(latLon.getLongitude().degrees, latLon.getLatitude().degrees)); }
public LatLon add(Position that) { if (that == null) { throw new IllegalArgumentException("Angle Is Null"); } Angle lat = Angle.normalizedLatitude(this.latitude.add(that.getLatitude())); Angle lon = Angle.normalizedLongitude(this.longitude.add(that.getLongitude())); return new LatLon(lat, lon); }
public LatLon subtract(Position that) { if (that == null) { throw new IllegalArgumentException("Angle Is Null"); } Angle lat = Angle.normalizedLatitude(this.latitude.subtract(that.getLatitude())); Angle lon = Angle.normalizedLongitude(this.longitude.subtract(that.getLongitude())); return new LatLon(lat, lon); }
/** * Returns the latitude and longitude of the sector's angular center: (minimum latitude + maximum latitude) / 2, * (minimum longitude + maximum longitude) / 2. * * @return The latitude and longitude of the sector's angular center */ public LatLon getCentroid() { Angle la = Angle.fromDegrees(0.5 * (this.getMaxLatitude().degrees + this.getMinLatitude().degrees)); Angle lo = Angle.fromDegrees(0.5 * (this.getMaxLongitude().degrees + this.getMinLongitude().degrees)); return new LatLon(la, lo); }
private double computeSegmentLength(Path path, DrawContext dc, Position posA, Position posB) { final LatLon llA = new LatLon(posA.getLatitude(), posA.getLongitude()); final LatLon llB = new LatLon(posB.getLatitude(), posB.getLongitude()); Angle ang; String pathType = path.getPathType(); if (Objects.equals(pathType, AVKey.LINEAR)) { ang = LatLon.linearDistance(llA, llB); } else if (Objects.equals(pathType, AVKey.RHUMB_LINE) || Objects.equals(pathType, AVKey.LOXODROME)) { ang = LatLon.rhumbDistance(llA, llB); } else { // Great circle ang = LatLon.greatCircleDistance(llA, llB); } if (path.getAltitudeMode() == WorldWind.CLAMP_TO_GROUND) { return ang.radians * (dc.getGlobe().getRadius()); } final double height = 0.5 * (posA.getElevation() + posB.getElevation()); return ang.radians * (dc.getGlobe().getRadius() + height * dc.getVerticalExaggeration()); }
@Nonnull public /* FIXME */ static AVList makeParams (final @Nonnull TileProviderDescriptor descriptor) { final AVList params = new AVListImpl(); params.setValue(AVKey.TILE_WIDTH, descriptor.getTileSize().width); params.setValue(AVKey.TILE_HEIGHT, descriptor.getTileSize().height); params.setValue(AVKey.DATA_CACHE_NAME, descriptor.getDataCacheName()); params.setValue(AVKey.SERVICE, "http://xxx/xxx"); params.setValue(AVKey.DATASET_NAME, "x"); params.setValue(AVKey.FORMAT_SUFFIX, ".xxx"); params.setValue(AVKey.NUM_LEVELS, descriptor.getLevelCount()); params.setValue(AVKey.NUM_EMPTY_LEVELS, 0); final int n = 4; params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, new LatLon(Angle.fromDegrees(90.0 / n), Angle.fromDegrees(180.0 / n))); params.setValue(AVKey.SECTOR, new MercatorSector(-1.0, +1.0, Angle.NEG180, Angle.POS180)); params.setValue(AVKey.TILE_URL_BUILDER, new UrlBuilderAdapter(descriptor)); return params; }
private static LevelSet makeLevels(URLBuilder urlBuilder) { AVList params = new AVListImpl(); params.setValue(AVKey.TILE_WIDTH, 512); params.setValue(AVKey.TILE_HEIGHT, 512); params.setValue(AVKey.DATA_CACHE_NAME, "Earth/BRGM"); params.setValue(AVKey.SERVICE, "http://ogcpublic.brgm.fr/geologie"); params.setValue(AVKey.DATASET_NAME, "scan_50"); params.setValue(AVKey.FORMAT_SUFFIX, ".jpg"); params.setValue(AVKey.NUM_LEVELS, 20); params.setValue(AVKey.NUM_EMPTY_LEVELS, 0); params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, new LatLon(Angle.fromDegrees(.2d), Angle.fromDegrees(.2d))); params.setValue(AVKey.SECTOR, Sector.fromDegrees(41.32526397666552, 51.20139642647427, -5.625179091996616, 11.1443951255116)); params.setValue(AVKey.TILE_URL_BUILDER, urlBuilder); //params.setValue(AVKey.EXPIRY_TIME, new GregorianCalendar(2007, 7, 6).getTimeInMillis()); return new LevelSet(params); }
private static LevelSet makeLevels(URLBuilder urlBuilder) { AVList params = new AVListImpl(); params.setValue(AVKey.TILE_WIDTH, 512); params.setValue(AVKey.TILE_HEIGHT, 512); params.setValue(AVKey.DATA_CACHE_NAME, "Earth/Geosignal/Raster"); params.setValue(AVKey.SERVICE, "http://www.geosignal.org/cgi-bin/wmsmap"); params.setValue(AVKey.DATASET_NAME, "RASTER"); params.setValue(AVKey.FORMAT_SUFFIX, ".dds"); params.setValue(AVKey.NUM_LEVELS, 14); params.setValue(AVKey.NUM_EMPTY_LEVELS, 0); params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, new LatLon(Angle.fromDegrees(36d), Angle.fromDegrees(36d))); params.setValue(AVKey.SECTOR, Sector.fromDegrees(41.1632, 51.2918, -6.06258, 10.8783)); params.setValue(AVKey.TILE_URL_BUILDER, urlBuilder); //params.setValue(AVKey.EXPIRY_TIME, new GregorianCalendar(2007, 7, 6).getTimeInMillis()); return new LevelSet(params); } private static final String[] layerNames = {"4000", "4000", "4000", "4000", "1000", "1000", "500", "250", "100", "50", "25", "5", "5", "5", "5"};
LatLon location = new LatLon(center.getLatitude(), center.getLongitude());