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

org.wikibrain.spatial.cookbook.tflevaluate.ToblersLawEvaluatorTest Maven / Gradle / Ivy

The newest version!
package org.wikibrain.spatial.cookbook.tflevaluate;

import com.vividsolutions.jts.geom.Geometry;
import org.wikibrain.conf.Configurator;
import org.wikibrain.core.cmd.Env;
import org.wikibrain.core.cmd.EnvBuilder;
import org.wikibrain.core.lang.LanguageSet;
import org.wikibrain.spatial.dao.SpatialDataDao;

import java.io.File;
import java.util.*;

/**
 * Created by toby on 4/17/14.
 *
 */
public class ToblersLawEvaluatorTest {


    public static void main(String[] args) throws Exception {

        Env env = EnvBuilder.envFromArgs(args);
        Configurator conf = env.getConfigurator();
        ToblersLawEvaluator evaluator = new ToblersLawEvaluator(env, new LanguageSet("simple"));
        SpatialDataDao sdDao = conf.get(SpatialDataDao.class);
        Map allGeometries = sdDao.getAllGeometriesInLayer("wikidata", "earth");
        Map geometryMap = new HashMap();
        int counter = 0;




        for(Integer id: allGeometries.keySet()){
            geometryMap.put(id, allGeometries.get(id));
            counter ++;
            if(counter >= 100)
                break;
        }
        //evaluator.retrieveLocations(allGeometries);
        evaluator.retrieveAllLocations();
        //evaluator.evaluateAll(new File("testTFL.csv"));
        evaluator.evaluateSample(new File("testTFL-2.csv"), 1000000);
    }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy