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

org.openstreetmap.atlas.geography.sharding.converters.DynamicTileShardingGeoJsonConverter Maven / Gradle / Ivy

There is a newer version: 7.0.8
Show newest version
package org.openstreetmap.atlas.geography.sharding.converters;

import org.openstreetmap.atlas.geography.sharding.DynamicTileSharding;
import org.openstreetmap.atlas.streaming.resource.File;
import org.openstreetmap.atlas.streaming.resource.Resource;
import org.openstreetmap.atlas.streaming.resource.WritableResource;
import org.openstreetmap.atlas.utilities.runtime.Command;
import org.openstreetmap.atlas.utilities.runtime.CommandMap;

/**
 * Save an existing serialized tree into a Geojson file.
 *
 * @author matthieun
 */
public class DynamicTileShardingGeoJsonConverter extends Command
{
    public static final Switch GEOJSON = new Switch<>("geojson",
            "The resource where to save the geojson tree for debugging", File::new,
            Optionality.REQUIRED);
    public static final Switch INPUT = new Switch<>("input",
            "The resource where to read the serialized tree", File::new, Optionality.REQUIRED);

    public static void main(final String[] args)
    {
        new DynamicTileShardingGeoJsonConverter().run(args);
    }

    @Override
    protected int onRun(final CommandMap command)
    {
        final Resource input = (Resource) command.get(INPUT);
        final WritableResource geojson = (WritableResource) command.get(GEOJSON);
        new DynamicTileSharding(input).saveAsGeoJson(geojson);
        return 0;
    }

    @Override
    protected SwitchList switches()
    {
        return new SwitchList().with(GEOJSON, INPUT);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy