map needs to be rotated 90 degree to get points correct
in
Programming Questions
•
8 months ago
I have locations in latitude and longitude of places in venice.
If i look at maps and google earth etc, then venice is always like this:
If i map the points then i have to rotate the map 90 degrees in order to get it correct.
I can understand that you have to flip something vertical or horizontal, but rotating 90 degrees?
Does someone have a idea?
- // Store the number of columns for in case the number changes in future
- static final int N_COLUMNS = 97;
- /*
- Indices for rows is Excel index - 1
- Be aware that some might change when the data sheet gets updated.
- */
- static final int VENICE_BIENNIAL_2013 = 0;
- static final int NAME = 1;
- static final int JONAS_OF_VINCENT = 2;
- static final int BIENNALE_EDITION_55 = 3;
- static final int CURATOR_MASSIMILIANO_GIONI = 4;
- static final int TITLE_THE_ENCYCLOPEDIC_PALACE = 5;
- static final int COUNTRY = 7;
- static final int COUNTRY_NAME = 8;
- static final int IN_CASE_OF_GROUPPAVILION_PARTICIPATING_STATES = 9;
- static final int FOOTNOTE_1_BIENNALE_HISTORY = 10;
- static final int PARTICIPATING_SINCE = 11;
- static final int POSITION_OF_PAVILION_VENUE = 12;
- static final int NAME_OF_PAVILION_BUILDING = 13;
- static final int EXHIBITION_TITLE = 15;
- static final int COMMISSIONER = 16;
- static final int ARTISTS = 17;
- static final int CURATORS = 18;
- static final int VENICE_ENTRY_TOTAL_BUDGET = 19;
- static final int OPEN_CALL = 20;
- static final int SELECTION_PROCEDURE = 21;
- static final int BASIC_INFORMATION = 23;
- static final int CAPITAL = 24;
- static final int DISTANCE_CAPITAL_VENICE = 25;
- static final int TOTAL_AREA_LAND = 26;
- static final int HUMAN_DEVELOPMENT_INDEX_2011 = 28;
- static final int URBAN_POPULATION_WORLD_BANK_ = 29;
- static final int RURAL_POPULATION_WORLD_BANK = 30;
- static final int FOOTNOTE_2_POLITICO_ECONOMICAL_SITUATION = 32;
- static final int DEMOCRACY_INDEX_RANK_2011 = 33;
- static final int FREEDOM_HOUSE_RANK = 34;
- static final int POLITICAL_STABILITY_AND_ABSENCE_OF_VIOLENCE_2011 = 35;
- static final int GLOBAL_PEACE_INDEX_RANK_2012 = 36;
- static final int TYPE_OF_GOVERNMENT = 37;
- static final int CURRENT_POLITICO_IDEOLOGICAL_ORIENTATION = 38;
- static final int PRESS_FREEDOM_INDEX_RANK_2012 = 39;
- static final int ECONOMIC_SITUATION = 41;
- static final int POPULATION = 42;
- static final int GDP_PER_CAPITA_2011 = 43;
- static final int MOST_RECENT_GINI_INDEX = 44;
- static final int TOTAL_GOVERNMENT_EXPENDITURES_BILLION = 46;
- static final int OECD_AID_RECEIVED_2011 = 48;
- static final int OECD_AID_DONATED_2011 = 49;
- static final int MILITARY_EXPENDITURE_2011 = 50;
- static final int EXPENDITURE_OF_MINISTERY_OF_CULTURE_2011 = 51;
- static final int UNEMPLOYMENT = 53;
- static final int EMPLOYMENT_CULTURAL_SECTOR_OF_TOTAL_EMPLOYMENT = 54;
- static final int NATIONAL_EXPORTS_OF_GOODS_AND_SERVICES = 56;
- static final int NATIONAL_IMPORTS_OF_GOODS_OF_SERVICES = 57;
- static final int IMPORT_OF_CULTURAL_GOODS = 58;
- static final int EXPORT_OF_CULTURAL_GOODS = 59;
- static final int IMPORT_OF_MILITARY_GOODS = 60;
- static final int EXPORT_OF_MILITARY_GOODS = 61;
- static final int FOOTNOTE_3_OCCUPATION_AND_INDEPENDENCE = 63;
- static final int LAST_DATE_OF_INDEPENDENCE = 64;
- static final int DETAILS = 65;
- static final int LAST_REVISION_OF_BORDERS = 66;
- static final int FORMER_CURRENT_COLONIZER = 67;
- static final int COUNTRY_COLONIZED_COLONIZED_BY = 68;
- static final int COMMONWEALTH = 69;
- static final int FORMER_USSR_SATELLITE_STATE = 70;
- static final int OF_MILITARY_ALLIANCES = 72;
- static final int GLOBAL_MILITARIZATION_INDEX = 74;
- static final int THREE_MOST_PROMINENT_ALLIES = 75;
- static final int ARMED_CONFLICT_ON_NATIONAL_TERRITORY = 76;
- static final int ARMED_CONFLICT_ON_FOREIGN_TERRITORY = 77;
- static final int PERSONEL_DEPLOYED_IN_MULTINATIONAL_MISSIONS = 79;
- static final int CASUALTIES_SUFFERED_BY_COUNTRY_IN_MULTINATIONAL_MISSIONS = 80;
- static final int MULTINATIONAL_MISSIONS_ON_STATE_TERRITORY = 81;
- static final int WEAPONS_EMBARGOS = 82;
- static final int FOOTNOTE_4_WIKIPEDIA_LINK = 84;
- static final int CULTURAL_INFRASTRUCTURE = 85;
- static final int NO_OF_MUSEUMS = 86;
- static final int TOP_100_BEST_VISITED_MUSEUMS = 87;
- static final int INTERNET_USERS_PER_100_PEOPLE = 88;
- static final int CURATOR = 90;
- static final int CURATOR_NAME = 91;
- static final int CURATOR_YEARS_PARTICIPATING = 92;
- static final int CURATOR_GENDER = 93;
- static final int CURATOR_YEAR_OF_BIRTH_DEATH = 94;
- static final int CURATOR_PLACE_OF_BIRTH = 95;
- static final int CURATOR_COUNTRY_OF_BIRTH = 96;
- static final int CURATOR_NATIONALITY_OF_REPRESENTED_STATE = 97;
- static final int CURATOR_MULTIPLE_NATIONALITIES = 98;
- static final int CURATOR_NATIONALITIES_OTHER_THAN_REPRESENTED_COUNTRY = 99;
- static final int CURATOR_CITY_OF_MAIN_RESIDENCY = 100;
- static final int CURATOR_COUNTRY_OF_MAIN_RESIDENCY = 101;
- static final int CURATOR_DISTANCE_MAIN_RESIDENCY_VENICE = 102;
- static final int CURATOR_RELATED_TO_POLITICAL_ORGANIZATION = 103;
- static final int CURATOR_IMPRISONED_LENGTH = 104;
- static final int ARTIST = 106;
- static final int ARTIST_NAME = 107;
- static final int ARTIST_YEARS_PARTICIPATING = 108;
- static final int ARTIST_GENDER = 109;
- static final int ARTIST_YEAR_OF_BIRTH = 110;
- static final int ARTIST_YEAR_OF_DEATH = 111;
- static final int ARTIST_PLACE_OF_BIRTH = 112;
- static final int ARTIST_COUNTRY_OF_BIRTH = 113;
- static final int ARTIST_NATIONALITY_OF_REPRESENTED_STATE = 114;
- static final int ARTIST_MULTIPLE_NATIONALITIES = 115;
- static final int ARTIST_NATIONALITIES_OTHER_THAN_REPRESENTED_COUNTRY = 116;
- static final int ARTIST_CITY_OF_MAIN_RESIDENCY = 117;
- static final int ARTIST_COUNTRY_OF_MAIN_RESIDENCY = 118;
- static final int ARTIST_DISTANCE_MAIN_RESIDENCY_VENICE = 119;
- static final int ARTIST_STUDIED_ABROAD = 120;
- static final int ARTIST_RESIDENCES = 121;
- static final int ARTIST_AFFILIATED_WITH_POLITICAL_ORGANIZATION = 122;
- static final int ARTIST_IMPRISONED = 123;
- static final int ARTIST_MILITARY_SERVICE = 124;
- static final int ARTISTIC_PRACTICE = 127;
- static final int GALLERY_REPRESENTATION = 128;
- static final int CITY_OF_GALLERY_REPRESENTATION = 129;
- static final int DISTANCE_GALLERY_REPRESENTATION_VENICE = 130;
- static final int ARTFACTS_RANKING = 131;
- static final int PUBLIC_EXHIBITIONS = 132;
- static final int SOLO_SHOWS = 133;
- static final int MEDIUM = 134;
- static final int AVERAGE_LAST_FIVE_SALES = 135;
- static final int TOTAL_STATE_SUPPORT_RECEIVED = 136;
- static final int MAP_FILTERS_INTERNATIONAL_ALLIANCES_CONFLICTS = 139;
- static final int WTO_MEMBER = 141;
- static final int OPEC_MEMBER = 142;
- static final int OECD_MEMBER = 143;
- static final int NATO_MEMBER = 144;
- static final int IMF_MEMBER = 145;
- static final int WORLD_BANK_MEMBER = 146;
- static final int G8_ = 147;
- static final int G20 = 148;
- static final int COALITION_OF_THE_WILLING = 149;
- static final int ARABIC_LEAGUE = 150;
- static final int RELATION_TO_INTERNATIONAL_CRIMINAL_COURT = 152;
- static final int CASES_FOR_INTERNATIONAL_COURT_OF_JUSTICE = 153;
- static final int NUCLEAR_POWER = 154;
- static final int NUCLEAR_FORCES = 155;
- color white = color(255);
- color black = color(0);
- PShape map_venice;
- PImage map_venice_img;
- ArrayList<Country> countries = new ArrayList<Country>();
- // - - - - - - - - - - - - - - - - - - - - - - -
- void setup() {
- map_venice = loadShape("map_venice_01.svg");
- map_venice_img = loadImage("map_venice_02.png");
- // println("map_venice.width: "+map_venice.width+"\tmap_venice.height: "+map_venice.height);
- size((int)map_venice_img.width, (int)map_venice_img.height);
- loadDataSheet("Venice Biennial Data Sheet.csv");
- loadLonLat("landen_lon_lat.tsv");
- //noLoop();
- }
- // - - - - - - - - - - - - - - - - - - - - - - -
- void loadDataSheet(String file) {
- println("#### loadDataSheet: "+file+" ####");
- String[] lines = loadStrings(file);
- String[] tokens;
- // let's first check all lines
- // to see if the splitting is still ok
- for (int i = 0; i < lines.length; i++ ) {
- tokens = split(lines[i], "@");
- if (tokens.length != N_COLUMNS) {
- println("WARNING: tokens.length is: "+lines[i]+" instead of "+N_COLUMNS+" on line "+i);
- }
- }
- // load the countries
- tokens = split(lines[COUNTRY_NAME], "@");
- for (int i = 1; i < N_COLUMNS; i++) {
- // Whales has no data, neither a name so skip it for now
- if (!tokens[i].equals("")) {
- Country c = new Country(tokens[i]);
- countries.add(c);
- }
- }
- println("loaded "+countries.size()+" countries");
- println();
- }
- // - - - - - - - - - - - - - - - - - - - - - - -
- void loadLonLat(String file) {
- println("#### loadLonLat: "+file+" ####");
- // indices
- int COUNTRY = 0;
- int LAT = 2;
- int LON = 1;
- String[] lines = loadStrings(file);
- String[] tokens;
- for (int i = 0; i < lines.length; i++ ) {
- tokens = split(lines[i], '\t');
- boolean found = false;
- if (tokens.length == 3) {
- for (Country c : countries) {
- if (c.name.equals(tokens[COUNTRY])) {
- c.lon = float(tokens[LON]);
- c.lat = float(tokens[LAT]);
- found = true;
- }
- }
- }
- if (!found) {
- println("WARNING: no longitude and latitude found for: "+tokens[COUNTRY]);
- }
- }
- }
- // - - - - - - - - - - - - - - - - - - - - - - -
- float min_lat = MAX_FLOAT;
- float max_lat = MIN_FLOAT;
- float min_lon = MAX_FLOAT;
- float max_lon = MIN_FLOAT;
- void draw() {
- background(255);
- //shape(map_venice, 0, 0);
- image(map_venice_img, 0, 0);
- // float min_lat = MAX_FLOAT;
- // float max_lat = MIN_FLOAT;
- // float min_lon = MAX_FLOAT;
- // float max_lon = MIN_FLOAT;
- min_lat = 45.41894;
- max_lat = 45.45958;
- min_lon = 12.28709;
- max_lon = 12.37391;
- /*
- for(Country c : countries) {
- if(c.lat == -1 || c.lon == -1) continue;
- min_lat = min(c.lat, min_lat);
- max_lat = max(c.lat, max_lat);
- min_lon = min(c.lon, min_lon);
- max_lon = max(c.lon, max_lon);
- }
- */
- //println(min_lat+"\t"+max_lat+"\t"+min_lon+"\t"+max_lon);
- fill(black);
- for(Country c : countries) {
- float x = map(c.lat, min_lat, max_lat, 0, width);
- float y = map(c.lon, min_lon, max_lon, 0, height);
- println(c.lon);
- // println(x+"\t"+y);
- ellipse(x, y, 10, 10);
- }
- }
- // - - - - - - - - - - - - - - - - - - - - - - -
1