Android Open Source - android-gmaps-addons Open Street Map Tile Provider






From Project

Back to project page android-gmaps-addons.

License

The source code is released under:

Copyright (c) 2014 Jonathan Baker Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...

If you think the Android project android-gmaps-addons listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.cocoahero.android.gmaps.addons.osm;
//from w  w  w . j a  v a  2 s  .c om
import java.net.MalformedURLException;
import java.net.URL;

import com.google.android.gms.maps.model.UrlTileProvider;

public class OpenStreetMapTileProvider extends UrlTileProvider {
    
    // ------------------------------------------------------------------------
    // Private Constants
    // ------------------------------------------------------------------------
    
    private static final String FORMAT = "http://tile.openstreetmap.org/%d/%d/%d.png";
    
    // ------------------------------------------------------------------------
    // Constructors
    // ------------------------------------------------------------------------

    public OpenStreetMapTileProvider() {
        super(256, 256);
    }
    
    // ------------------------------------------------------------------------
    // Public Methods
    // ------------------------------------------------------------------------

    @Override
    public URL getTileUrl(int x, int y, int z) {
        try {
            return new URL(String.format(FORMAT, z, x, y));
        }
        catch (MalformedURLException e) {
            return null;
        }
    }

}




Java Source Code List

com.cocoahero.android.gmaps.addons.mapbox.MapBoxOfflineTileProvider.java
com.cocoahero.android.gmaps.addons.mapbox.MapBoxOnlineTileProvider.java
com.cocoahero.android.gmaps.addons.osm.OpenStreetMapTileProvider.java
com.cocoahero.android.gmaps.addons.util.LatLngBoundsUtils.java
com.cocoahero.android.gmaps.addons.util.LocationUtils.java
com.cocoahero.android.gmaps.addons.util.PolygonUtils.java