Beispiel #1
0
    float[] getCorners(G_LatLng center, float zoom, float mapWidth, float mapHeight)
    {
        float scale = Mathf.Pow(2, zoom);
        MercatorProjection proj = new MercatorProjection();

        G_Point centerPx = proj.fromLatLngToPoint(center);
        //G_LatLng centerPx = new G_LatLng (0, 0);
        G_Point SWPoint = new G_Point(centerPx.x-(mapWidth/2)/scale, centerPx.y+(mapHeight/2)/scale);
        G_LatLng SWLatLon = proj.fromPointToLatLng(SWPoint);
        G_Point NEPoint = new G_Point(centerPx.x+(mapWidth/2)/scale, centerPx.y-(mapHeight/2)/scale);
        G_LatLng NELatLon = proj.fromPointToLatLng(NEPoint);
        return new float[]{NELatLon.lat,
             NELatLon.lng,
             -SWLatLon.lat,
            SWLatLon.lng}; // north east south west
    }