Class SlippyTilePersistenceScheme
- java.lang.Object
-
- org.openstreetmap.atlas.generator.persistence.scheme.SlippyTilePersistenceScheme
-
- All Implemented Interfaces:
java.io.Serializable
public class SlippyTilePersistenceScheme extends java.lang.Object implements java.io.SerializableThis 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 inSlippyTilePersistenceSchemeType.
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
-
-
Constructor Summary
Constructors Constructor Description SlippyTilePersistenceScheme(SlippyTilePersistenceSchemeType type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Stringcompile(java.lang.String zoom, java.lang.String xIndex, java.lang.String yIndex)java.lang.Stringcompile(org.openstreetmap.atlas.geography.sharding.SlippyTile tile)java.lang.StringgetScheme()static SlippyTilePersistenceSchemegetSchemeInstanceFromString(java.lang.String string)
-
-
-
Field Detail
-
ZOOM
public static final java.lang.String ZOOM
- See Also:
- Constant Field Values
-
X_INDEX
public static final java.lang.String X_INDEX
- See Also:
- Constant Field Values
-
Y_INDEX
public static final java.lang.String Y_INDEX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SlippyTilePersistenceScheme
public SlippyTilePersistenceScheme(SlippyTilePersistenceSchemeType type)
-
-
Method Detail
-
getSchemeInstanceFromString
public static SlippyTilePersistenceScheme getSchemeInstanceFromString(java.lang.String string)
-
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()
-
-