Here you can find the source of longToX(final double longitude, final int zoom)
Parameter | Description |
---|---|
longitude | longitude |
zoom | zoom level |
public static int longToX(final double longitude, final int zoom)
//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; } }