Java Long to longToX(final double longitude, final int zoom)

Here you can find the source of longToX(final double longitude, final int zoom)

Description

get the x tile index for specified longitude and zoom level

License

Open Source License

Parameter

Parameter Description
longitude longitude
zoom zoom level

Return

x tile index

Declaration

public static int longToX(final double longitude, final int zoom) 

Method Source Code

//package com.java2s;
/*/*from  www.j  a  v  a2s.c  o  m*/
 * Copyright (c) JenSoft API
 * This source file is part of JenSoft API, All rights reserved.
 * JENSOFT PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

public class Main {
    /**
     * get the x tile index for specified longitude and zoom level
     * 
     * @param longitude
     *            longitude
     * @param zoom
     *            zoom level
     * @return x tile index
     */
    public static int longToX(final double longitude, final int zoom) {
        int xtile = (int) Math.floor((longitude + 180) / 360 * (1 << zoom));
        return xtile;
    }
}

Related

  1. longToStringAddress(long addr)
  2. longToStringWithZeroFill(long longValue, int width)
  3. longToTimeString(long time)
  4. longToX(double longitudeDegrees, double radius)
  5. longToX(double longitudeDegrees, double radius)
  6. longToZigZag(final long n)