public void setup() { size(900, 700, OPENGL); map = new UnfoldingMap(this, new Google.GoogleMapProvider()); MapUtils.createDefaultEventDispatcher(this, map); map.setScaleRange(5, 50000); // map.zoomAndPanTo(14, new Location(32.881, -117.238)); MapUtils.createDefaultEventDispatcher(this, map); List<Feature> countries = GeoJSONReader.loadData(this, countryFile); countryMarkers = MapUtils.createSimpleMarkers(countries); List<Feature> craters = GeoJSONReader.loadData(this, craterFile); craterMarkers = new ArrayList<Marker>(); for (Feature crater : craters) { isOnEarthLand((PointFeature) crater); craterMarkers.add(new CraterMarker(crater)); } map.addMarkers(craterMarkers); // run in setup to hide craters that are lower than initial value of requestedCraterSize cratersToShow(); } // End Setup
public void setup() { // (1) Initializing canvas and map tiles size(900, 700, OPENGL); if (offline) { map = new UnfoldingMap(this, 200, 50, 650, 600, new MBTilesMapProvider(mbTilesString)); earthquakesURL = "2.5_week.atom"; // The same feed, but saved August 7, 2015 } else { map = new UnfoldingMap(this, 200, 50, 650, 600, new Google.GoogleMapProvider()); // IF YOU WANT TO TEST WITH A LOCAL FILE, uncomment the next line // earthquakesURL = "2.5_week.atom"; } MapUtils.createDefaultEventDispatcher(this, map); // FOR TESTING: Set earthquakesURL to be one of the testing files by uncommenting // one of the lines below. This will work whether you are online or offline // earthquakesURL = "test1.atom"; // earthquakesURL = "test2.atom"; // Uncomment this line to take the quiz earthquakesURL = "quiz2.atom"; // (2) Reading in earthquake data and geometric properties // STEP 1: load country features and markers List<Feature> countries = GeoJSONReader.loadData(this, countryFile); countryMarkers = MapUtils.createSimpleMarkers(countries); // STEP 2: read in city data List<Feature> cities = GeoJSONReader.loadData(this, cityFile); cityMarkers = new ArrayList<Marker>(); for (Feature city : cities) { cityMarkers.add(new CityMarker(city)); } // STEP 3: read in earthquake RSS feed List<PointFeature> earthquakes = ParseFeed.parseEarthquake(this, earthquakesURL); quakeMarkers = new ArrayList<Marker>(); for (PointFeature feature : earthquakes) { // check if LandQuake if (isLand(feature)) { quakeMarkers.add(new LandQuakeMarker(feature)); } // OceanQuakes else { quakeMarkers.add(new OceanQuakeMarker(feature)); } } // could be used for debugging printQuakes(); // (3) Add markers to map // NOTE: Country markers are not added to the map. They are used // for their geometric properties map.addMarkers(quakeMarkers); map.addMarkers(cityMarkers); sortAndPrint(20); } // End setup
public void setup() { // (1) Initializing canvas and map tiles size(900, 700, OPENGL); if (offline) { map = new UnfoldingMap(this, 200, 50, 650, 600, new MBTilesMapProvider(mbTilesString)); earthquakesURL = "2.5_week.atom"; // The same feed, but saved August 7, 2015 } else { map = new UnfoldingMap(this, 200, 50, 650, 600, new Google.GoogleMapProvider()); // IF YOU WANT TO TEST WITH A LOCAL FILE, uncomment the next line // earthquakesURL = "2.5_week.atom"; } MapUtils.createDefaultEventDispatcher(this, map); // (2) Reading in earthquake data and geometric properties // STEP 1: load country features and markers List<Feature> countries = GeoJSONReader.loadData(this, countryFile); countryMarkers = MapUtils.createSimpleMarkers(countries); // STEP 2: read in city data List<Feature> cities = GeoJSONReader.loadData(this, cityFile); cityMarkers = new ArrayList<Marker>(); for (Feature city : cities) { System.out.println( city.getProperty("name") + ", " + city.getProperty("country") + " Pop: " + city.getProperty("population") + "Million"); cityMarkers.add(new CityMarker(city)); } // STEP 3: read in earthquake RSS feed List<PointFeature> earthquakes = ParseFeed.parseEarthquake(this, earthquakesURL); quakeMarkers = new ArrayList<Marker>(); for (PointFeature feature : earthquakes) { // check if LandQuake if (isLand(feature)) { quakeMarkers.add(new LandQuakeMarker(feature)); } // OceanQuakes else { quakeMarkers.add(new OceanQuakeMarker(feature)); } } // could be used for debugging printQuakes(); // (3) Add markers to map // NOTE: Country markers are not added to the map. They are used // for their geometric properties map.addMarkers(quakeMarkers); map.addMarkers(cityMarkers); } // End setup
public void setup() { size(800, 600, OPENGL); map = new UnfoldingMap(this, 50, 50, 700, 500, new Google.GoogleMapProvider()); MapUtils.createDefaultEventDispatcher(this, map); lifeExpByCountry = loadLifeExpectancyFromCSV("../data/LifeExpectancyWorldBank.csv"); countries = GeoJSONReader.loadData(this, "countries.geo.json"); countryMarkers = MapUtils.createSimpleMarkers(countries); map.addMarkers(countryMarkers); shadeCountries(); }
public void setup() { size(800, 600, P2D); // Set up the Applet window to be 800x600 // The OPENGL argument indicates to use the // Processing library's 2D drawing // You'll learn more about processing in Module 3 // This sets the background color for the Applet. // Play around with these numbers and see what happens! this.background(00, 255, 0); // Select a map provider AbstractMapProvider provider = new Google.GoogleTerrainProvider(); // Set a zoom level int zoomLevel = 10; if (offline) { // If you are working offline, you need to use this provider // to work with the maps that are local on your computer. provider = new MBTilesMapProvider(mbTilesString); // 3 is the maximum zoom level for working offline zoomLevel = 3; } // Create a new UnfoldingMap to be displayed in this window. // The 2nd-5th arguments give the map's x, y, width and height // When you create your map we want you to play around with these // arguments to get your second map in the right place. // The 6th argument specifies the map provider. // There are several providers built-in. // Note if you are working offline you must use the MBTilesMapProvider map1 = new UnfoldingMap(this, 50, 50, 350, 500, provider); // The next line zooms in and centers the map at // 32.9 (latitude) and -117.2 (longitude) map1.zoomAndPanTo(zoomLevel, new Location(32.9f, -117.2f)); // This line makes the map interactive MapUtils.createDefaultEventDispatcher(this, map1); map2 = new UnfoldingMap(this, 450, 50, 350, 500, provider); map2.zoomAndPanTo(zoomLevel, new Location(40.7f, -74.1f)); MapUtils.createDefaultEventDispatcher(this, map2); // TODO: Add code here that creates map2 // Then you'll modify draw() below }
public void setup() { size(800, 600, GLConstants.GLGRAPHICS); map = new UnfoldingMap(this); map.zoomAndPanTo(new Location(52.5f, 13.4f), 10); mask = new MaskUI(this); MapUtils.createDefaultEventDispatcher(this, map); }
public void setup() { // first setup a clean map and draw size(800, 600, OPENGL); map = new UnfoldingMap(this, 50, 50, 700, 500, new Google.GoogleMapProvider()); MapUtils.createDefaultEventDispatcher(this, map); // Load Life Expectancy from CSV lifeExpByCountry = loadLifeExpectancyFromCSV("LifeExpectancyWorldBankModule3.csv"); println("Loaded " + lifeExpByCountry.size() + " data entries."); // Load country polygons and add them as markers countries = GeoJSONReader.loadData(this, "countries.geo.json"); coutryMarkers = MapUtils.createSimpleMarkers(countries); map.addMarkers(coutryMarkers); // shade country markers by life expectancy shadeCountries(); }
public void setup() { size(1900, 1000, GLConstants.GLGRAPHICS); smooth(); gfx = new ToxiclibsSupport(this); font = createFont("Arial", 30); textFont(font); String line; numbers = new ArrayList<String>(); try { BufferedReader br = new BufferedReader( new FileReader( Constants.RESULT_PATH + File.separator + "11_home_work_lat_long" + File.separator + "home_2_work")); while ((line = br.readLine()) != null) { String[] tokens = line.split("\t"); String number = tokens[0]; numbers.add(number); String home = tokens[1]; num2home.put(number, home); String work = tokens[2]; num2work.put(number, work); } } catch (Exception e) { logger.error("not happend", e); } map = new Map(this, new Google.GoogleMapProvider()); // map = new Map(this, new Microsoft.RoadProvider()); // map = new Map(this, new Yahoo.HybridProvider()); map.zoomAndPanTo(new Location(41.387628f, 2.1698f), 13); // lat-long MapUtils.createDefaultEventDispatcher(this, map); try { BufferedReader br = new BufferedReader(new FileReader(Constants.BARCELONA_CELL_INFO_PATH)); while ((line = br.readLine()) != null) { if (line.startsWith("cell")) continue; // skip the first line of column description Cell cell = new Cell(line); String btsID = cell.getBTSID(); BTS2Location.put( btsID, new Location((float) cell.getLatitude(), (float) cell.getLongitude())); } } catch (IOException e) { logger.error(e); } catch (ParseException e) { logger.error(e); } loadIndividualMarkov(); }
public void setup() { size(950, 600, OPENGL); if (offline) { map = new UnfoldingMap(this, 200, 50, 700, 500, new MBTilesMapProvider(mbTilesString)); earthquakesURL = "2.5_week.atom"; // Same feed, saved Aug 7, 2015, for working offline } else { map = new UnfoldingMap(this, 200, 50, 700, 500, new Google.GoogleMapProvider()); // IF YOU WANT TO TEST WITH A LOCAL FILE, uncomment the next line // earthquakesURL = "2.5_week.atom"; } map.zoomToLevel(2); MapUtils.createDefaultEventDispatcher(this, map); // The List you will populate with new SimplePointMarkers List<Marker> markers = new ArrayList<Marker>(); // Use provided parser to collect properties for each earthquake // PointFeatures have a getLocation method List<PointFeature> earthquakes = ParseFeed.parseEarthquake(this, earthquakesURL); // These print statements show you (1) all of the relevant properties // in the features, and (2) how to get one property and use it if (earthquakes.size() > 0) { PointFeature f = earthquakes.get(0); System.out.println(f.getProperties()); Object magObj = f.getProperty("magnitude"); float mag = Float.parseFloat(magObj.toString()); // PointFeatures also have a getLocation method // here we looped through each PointFeature in earthquakes for (PointFeature pf : earthquakes) { // we created a new simplePointMarker for each earthquake SimplePointMarker spm = createMarker(pf); // we added that simplepointmarker to the marker list markers.add(spm); } } // added the markers to the map map.addMarkers(markers); // Here is an example of how to use Processing's color method to generate // an int that represents the color yellow. // int yellow = color(255, 255, 0); // Done: Add code here as appropriate addKey(); }
public void setup() { handy = new HandyRenderer(this); map = new UnfoldingMap(this, "myMap"); map.zoomAndPanTo(16, new Location(52.501, 13.395)); MapUtils.createDefaultEventDispatcher(this, map); // map.setBackgroundColor(bgColor); debugDisplay = new DebugDisplay(this, map); vectorTilesUtils = new VectorTilesUtils(this, map); features = vectorTilesUtils.loadFeaturesForScreenPos(featureLayer, width / 2, height / 2); map.addMarkers(createSketchMarkers(features)); }
public void setup() { size(800, 600, OPENGL); // size(800, 600); smooth(); map = new UnfoldingMap(this); map.zoomToLevel(3); map.panTo(new Location(40f, -98f)); MapUtils.createDefaultEventDispatcher(this, map); Location berlinLocation = new Location(40f, -98f); berlinMarker = new TestMarker(berlinLocation); berlinMarker.setColor(color(255, 0, 0, 100)); berlinMarker.setStrokeColor(color(255, 0, 0)); berlinMarker.setStrokeWeight(2); map.addMarkers(berlinMarker); }
public void setup() { size(800, 600, GLConstants.GLGRAPHICS); map1 = new Map(this, "map1", 10, 10, 385, 580, true, false, new Microsoft.AerialProvider()); map1.setTweening(false); map2 = new Map( this, "map2", 405, 10, 385, 580, true, false, new OpenStreetMap.CloudmadeProvider(MapDisplayFactory.OSM_API_KEY, 30635)); map2.setTweening(false); MapUtils.createDefaultEventDispatcher(this, map1, map2); }
private void addCountryMarker() { List<Feature> countries = GeoJSONReader.loadData(p, p.sketchPath("data/data/countries.geo.json")); List<Marker> countryMarkers = MapUtils.createSimpleMarkers(countries); map.addMarkers(countryMarkers); }