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
Would you like to react to this message? Create an account in a few clicks or log in to continue.
WEMAPPERS PLATFORM

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

Who is online?
In total there are 47 users online :: 0 Registered, 0 Hidden and 47 Guests

None

Most users ever online was 140 on Sat Oct 19, 2024 9:16 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
GIS DATA ANALYSIS EmptyThu Aug 04, 2022 5:16 pm by Admin

» GOOD MAP MAKING TIPS TIP1
GIS DATA ANALYSIS EmptyFri Jul 15, 2022 8:09 pm by CarolinaLiki

» Web mapping programming Language
GIS DATA ANALYSIS 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,,
GIS DATA ANALYSIS EmptyMon Nov 01, 2021 11:36 am by Tumaini apolinary

» GIS analysis question
GIS DATA ANALYSIS EmptyWed Jun 30, 2021 11:56 am by Geoffrey venust

» We successful performed the second geotalk
GIS DATA ANALYSIS EmptyThu Jun 24, 2021 3:25 pm by Admin

» GIS DATA ANALYSIS
GIS DATA ANALYSIS EmptyWed Jun 23, 2021 12:59 pm by Admin

» How Geospatial Technologies Are Being Used to Study Light Pollution
GIS DATA ANALYSIS EmptyWed Jun 23, 2021 12:25 pm by Afro Teop

» DODOMA ORPHANAGE MAP
GIS DATA ANALYSIS EmptyWed Jun 23, 2021 11:47 am by Afro Teop


You are not connected. Please login or register

GIS DATA ANALYSIS

2 posters

Go down  Message [Page 1 of 1]

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

Afro Teop



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.

Admin and Afro Teop like this post

2GIS DATA ANALYSIS Empty Re: GIS DATA ANALYSIS Wed Jun 23, 2021 12:59 pm

Admin

Admin
Admin

This is fantastic

Admin and Afro Teop like this post

https://wemapper.africamotion.net

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum