# Map csv file data in a map of any country

**URL:** <https://discourse.processing.org/t/map-csv-file-data-in-a-map-of-any-country/22565>\
**Category:** Coding Questions\
**Created:** [July 12, 2020, 9:10am UTC](https://discourse.processing.org/t/map-csv-file-data-in-a-map-of-any-country/22565 "2020-07-12T09:10:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeathEater](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DeathEater](https://discourse.processing.org/u/DeathEater)\
**Post date:** [July 12, 2020, 9:10am UTC](https://discourse.processing.org/t/map-csv-file-data-in-a-map-of-any-country/22565/1 "2020-07-12T09:10:40Z")

</div>

Hello guys , I am new to processing and I have a question about my program. I am planning to plot the Corona virus data in the map of Nepal. I have a SVG file for the map, and csv files for corona virus data and Latitude and longitude of each district of Nepal. I am not sure how to use the latitude and longitude to plot in the exact location. maybe I need to configure the map before plotting it. I could not find any good documentation on how to do it either. Could anybody guide me on how to do it ?  
Thank you in advance

```auto
import java.util.HashMap;
Table table;
PShape baseMap;
String p[];
String[] Data;
Table location;

StringList strDistrict;
IntList intConfirmedCases;
IntList intTotalDeath;
IntList intTotalRecovered;
FloatList floatLat;
FloatList floatLong;

void setup() {
  size(1000, 800);
  background(255);
  noLoop();

  //loading the map and the csv file
  baseMap=loadShape("nepalmap.svg");
  table=loadTable("corona.csv", "header");
  location=loadTable("location.csv", "header");
}

void draw() {
  shape(baseMap, 0, 0, width, height); //display the map
  strDistrict=new StringList();
  intConfirmedCases=new IntList();
  intTotalDeath=new IntList();
  intTotalRecovered=new IntList();
  floatLat=new FloatList();
  floatLong=new FloatList();

  for (TableRow row : table.rows()) {
    String District=row.getString("District");
    int Confirmed_Cases=row.getInt("Confirmed Cases"); 
    int Total_Death=row.getInt("Total Death");
    int Recovered_Cases=row.getInt("Total Recovered");
    strDistrict.append(District);
    intConfirmedCases.append(Confirmed_Cases); //appending the data of confirmed cases in a stringlist
    intTotalDeath.append(Total_Death); //appending the data of confirmed cases in a stringlist
    intTotalRecovered.append(Recovered_Cases);
  }

  for (TableRow row : location.rows()) {

    Float Latitude=row.getFloat("Latitude"); 
    Float Longitude=row.getFloat("Longitude");

    floatLat.append(Latitude); 
    floatLong.append(Longitude); 
  }

  for ( int i=1; i<floatLat.size(); i++) {
    float graphLong=map(floatLong.get(i), 90, -90, 0, height);
    float graphLat=map(floatLat.get(i), -180, 180, 0, width);
    fill(255, 0, 0, 50);
    ellipse(graphLat, graphLong, 5, 5);
  }

  text("Index", 30, height-130);
  fill(#F21642);
  ellipse(40, height-100, 30, 30);
  fill(#0E0F0E);
  text("--> Confirmed Corona Cases", 70, height-97);
}

```

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 13, 2020, 5:57am UTC](https://discourse.processing.org/t/map-csv-file-data-in-a-map-of-any-country/22565/2 "2020-07-13T05:57:57Z")

</div>

Please check these previous posts. Key word: Webmercator

- [https://forum.processing.org/two/discussion/21135/add-latitude-longitude-to-csv-file-and-make-interactive-map-with-the-data](https://forum.processing.org/two/discussion/21135/add-latitude-longitude-to-csv-file-and-make-interactive-map-with-the-data)
- [Can't seem to map latitude and longitude coordinates correctly in Processing 3](https://discourse.processing.org/t/cant-seem-to-map-latitude-and-longitude-coordinates-correctly-in-processing-3/734/9)
- [https://forum.processing.org/one/topic/mercator-map-project-problem-help-needed.html](https://forum.processing.org/one/topic/mercator-map-project-problem-help-needed.html)

I also suggest using [unfoldingmaps](http://unfoldingmaps.org/tutorials/getting-started-in-processing.html). A previous post:

- [https://forum.processing.org/two/discussion/27650/unfolding-maps-how-to-map-separate-lat-long-coordinates-in-an-array-to-screen](https://forum.processing.org/two/discussion/27650/unfolding-maps-how-to-map-separate-lat-long-coordinates-in-an-array-to-screen)

Kf
