WEMAPPERS PLATFORM
Welcome, please log-in to participate in this (your) platform, by logging in you agree to abide by the rules of this forum. Until you make your FIRST Login and post.
WEMAPPERS PLATFORM

WE ARE FOCUSING TO BE THE BEST SOURCE OF GEOSPATIAL KNOWLEDGE IN THE GLOBE

Who is online?
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest

None

Most users ever online was 117 on Sat Apr 20, 2024 9:17 pm
Discord Server
Statistics
We have 256 registered users
The newest registered user is AwezGeo

Our users have posted a total of 153 messages in 55 subjects
Top posting users this week
No user

Latest topics
» Application of remote sensing
Topics tagged under data on WEMAPPERS PLATFORM  EmptyThu Aug 04, 2022 5:16 pm by Admin

» GOOD MAP MAKING TIPS TIP1
Topics tagged under data on WEMAPPERS PLATFORM  EmptyFri Jul 15, 2022 8:09 pm by CarolinaLiki

» Web mapping programming Language
Topics tagged under data on WEMAPPERS PLATFORM  EmptySat Nov 13, 2021 12:47 pm by Afro Teop

» WHY LIDAR REMOTE SENSING IS SO EXPENSIVE? IF YOU HAVE AN ANSWER PLEASE DROP DOWN,,
Topics tagged under data on WEMAPPERS PLATFORM  EmptyMon Nov 01, 2021 11:36 am by Tumaini apolinary

» GIS analysis question
Topics tagged under data on WEMAPPERS PLATFORM  EmptyWed Jun 30, 2021 11:56 am by Geoffrey venust

» We successful performed the second geotalk
Topics tagged under data on WEMAPPERS PLATFORM  EmptyThu Jun 24, 2021 3:25 pm by Admin

» GIS DATA ANALYSIS
Topics tagged under data on WEMAPPERS PLATFORM  EmptyWed Jun 23, 2021 12:59 pm by Admin

» How Geospatial Technologies Are Being Used to Study Light Pollution
Topics tagged under data on WEMAPPERS PLATFORM  EmptyWed Jun 23, 2021 12:25 pm by Afro Teop

» DODOMA ORPHANAGE MAP
Topics tagged under data on WEMAPPERS PLATFORM  EmptyWed Jun 23, 2021 11:47 am by Afro Teop


You are not connected. Please login or register

WEMAPPERS PLATFORM  » Advanced Search

Search found 1 match for data

GIS DATA ANALYSIS - Wed Jun 23, 2021 12:11 pm

GIS analysis been one of upcoming data analysis in world that is providing solution to spatial problem and environmental problems has made a great shift in statistical world.Data collaboration has improved data visualization through use of map and chart in representing data.
In this post I shall illustrate on how corona data from John Hopkins University data collection in form of csv file is merged with spatial world data to form a spatial data (geojson,shp).

Programming language used is python,this is effective as GIS software use spatial data only and non-spatial data cannot be used.This post creates data harmonisation.
Python libraries used are Pandas and Geopandas

First we merge the csv file with the world map shp(for all confirmed,death and recovery data)

#import python libraries

Code:
import pandas as pd
import geopandas as gpd


#get the required data

Code:
confirmed=('csse_covid_19_time_series_confirmed_global.csv')
death=('time_series_covid19_deaths_global.csv')
recovered=('time_series_covid19_recovered_global.csv')
world = gpd.read_file('world.geojson')
data_cont = pd.read_csv('Countries-Continents.csv')


#data merging
Code:

# csv file
data_confirmed = pd.read_csv(confirmed)
data_confirmed = data_confirmed[['Country/Region',data_confirmed.columns[-1]]]
data_confirmed.columns = ['country','confirmed']
data_confirmed.head(10)



Code:
# continent data
data_cont.columns = ['continent','country']
data_merge_confirmed_cont = pd.merge(left=data_cont, right=data_confirmed,
                    how='left', right_on='country',
                    left_on='country')
data_merge_confirmed_cont.head(10)


Code:
# world spatial data
world = gpd.read_file('world.geojson')
world = world[['NAME','geometry']]
world.columns = ['country','geometry']
world.plot(figsize=(15,20),color='white',edgecolor='black')


Code:
# data merging
data_merge_confirmed = pd.merge(left=data_merge_confirmed_cont,
                            right=world, how='left',
                            left_on='country', right_on='country'
                           )
data_merge_confirmed.head(10)


Code:

# data transformation from dataframe to geodataframe

geo_data_confirmed = gpd.GeoDataFrame(data_merge_confirmed)



Code:
# selecting Africa
africa_confirmed = geo_data_confirmed[geo_data_confirmed['continent']=='Africa']

# plot Africa data

africa_confirmed.plot(figsize=(7,10),color='white',edgecolor='black')


Code:
africa_confirmed.head(10)


#data exporting

Code:
# geojson
africa_confirmed.to_file("africa_confirmed.geojson",driver='GeoJSON')
# shp
africa_confirmed.to_file("africa_confirmed.shp")
# csv
africa_confirmed.to_file("africa_confirmed.csv")
# excel
africa_confirmed.to_file("africa_confirmed.xslx")


Algothim above can be used to create data for other data for other continent.

I will attach the code and data together with images.
Search in: GIS programming  Topic: GIS DATA ANALYSIS  Replies: 1  Views: 411

Search found 1 match for data

Back to top