All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.aipark.api.tile.TileMapper Maven / Gradle / Ivy

Go to download

AIPARK offers detailed parking information for more than 1.8 Mio parking areas in Germany with nationwide coverage. Additionally, accurate occupancy predictions are derived using data from a network of more than 5 million smartphones. Use the AIPARK API Explorer application to try out and test the interface. Please send a request via email if you are a developer and require an API key. We'll be in touch with you shortly. This application is provided via a demo backend environment. Please note that API load tests do not reflect the performance of the productive system. Mail: [email protected]

There is a newer version: 30.06
Show newest version
package de.aipark.api.tile;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.impl.CoordinateArraySequence;
import de.aipark.api.tile.Tile;

/**
 * Created by torgen on 15.06.17.
 */
public class TileMapper {

    /**
     *
     * @param tile
     * @return left upper corner of given tile
     */
    public static Point getLatLngFromTileIndex(Tile tile){
        double lat, lng;
        lat = Math.atan(Math.sinh(Math.PI- tile.getY()/Math.pow(2, tile.getZoom())*2*Math.PI))*180/Math.PI;
        lng = tile.getX()/Math.pow(2, tile.getZoom())*360-180;
        return new Point(new CoordinateArraySequence(new Coordinate[]{new Coordinate(lng,lat)}), new GeometryFactory());
    }

    /**
     *
     * @param point point
     * @param zoom zoom level
     * @return  tile of this point with given zoom level
     */
    public static Tile getTileIndexFromLatLng(Point point, int zoom){
        double xtile =  (point.getX() + 180) / 360 * (1<= (1<= (1<




© 2015 - 2024 Weber Informatics LLC | Privacy Policy