Class SlippyTilePersistenceScheme

  • All Implemented Interfaces:
    java.io.Serializable

    public class SlippyTilePersistenceScheme
    extends java.lang.Object
    implements java.io.Serializable
    This class helps users construct storage paths dynamically based on the name of the target resource to be saved. The various allowed storage schemes are defined in SlippyTilePersistenceSchemeType.

    For example, one PBF storage scheme is 'ZZ_XX_YY_SUBFOLDERS_PBF', which is defined as 'zz/xx/yy/zz-xx-yy.pbf'. This means that when saving the PBF '12-34-48.pbf' to a remote store, users can easily construct the proper storage path for that PBF (i.e. 12/34/48/12-34-48.pbf) and use that to save the file. An example usage:

    // Pbf is tile 12-34-48
    // Assume we have some kind of PBF object
    Pbf myPbfObject;
    SlippyTilePersistenceScheme scheme = new SlippyTilePersistenceScheme(SlippyTilePersistenceSchemeType.ZZ_XX_YY_SUBFOLDERS_PBF);
    // OR
    SlippyTilePersistenceScheme scheme = SlippyTilePersistenceScheme.getSchemeInstanceFromString("ZZ_XX_YY_SUBFOLDERS_PBF");
    WritableResource resource = new File(SparkFileHelper.combine("hdfs://myPBFs", scheme.compile(myPbfObject.getShard())));
    myPbfObject.save(resource);
    // we now have a PBF saved at "hdfs://myPBFs/12/34/48/12-34-48.pbf"
    See Also:
    Serialized Form
    • Method Detail

      • compile

        public java.lang.String compile​(org.openstreetmap.atlas.geography.sharding.SlippyTile tile)
      • compile

        public java.lang.String compile​(java.lang.String zoom,
                                        java.lang.String xIndex,
                                        java.lang.String yIndex)
      • getScheme

        public java.lang.String getScheme()