-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeopandas_9-7-2022.py
63 lines (50 loc) · 1.89 KB
/
geopandas_9-7-2022.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 7 10:49:45 2022
@author: xiw
"""
# Title: Plotting Ultra (On Demand Transit) graph GUI desktop app development
# Contact: [email protected]
# Author: Wang Xi
# Last Updated: 09-07-2022
# Update notes: plotting geographic data with latitude and longitude on a map
# File Format: .py file
# Import library
import os
import pandas as pd
import datetime
from datetime import timedelta, datetime
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.dates import date2num
import tkinter as tk
# import customtkinter
from PIL import Image, ImageTk
from resizeimage import resizeimage
# from tkinter import ttk
import tkinter.font as font
from tkinter import filedialog
import numpy
import pandas
import geopandas as gpd
# import pysal
import seaborn
import contextily
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from shapely.geometry import Point, Polygon
import descartes
# Set up directory
os.chdir(r'S:\LeeTran\Planning\Intern\Wang Xi\LeeTran_Wang\Bonita Springs Ultra GUI App')
os.getcwd()
df = pd.read_excel('Ultra_data.xlsx')
# df.info()
# Generate scatter plot
pick_up = seaborn.jointplot(x="Pickup Long", y="Pickup Lat", data=df, s=0.5)
plt.savefig(r'S:\LeeTran\Planning\Technology\Python Projects\Bonita Springs Ultra GUI App\Pick-up Geolocation Patterns as Dots on a Map.jpg', dpi=300,bbox_inches='tight')
drop_off = seaborn.jointplot(x="Dropoff Long", y="Dropoff Lat", data=df, s=0.5)
plt.savefig(r'S:\LeeTran\Planning\Technology\Python Projects\Bonita Springs Ultra GUI App\Drop-off Geolocation Patterns as Dots on a Map.jpg', dpi=300,bbox_inches='tight')
major_roads = gpd.read_file(r'C:\Users\xiw\Documents\ArcGIS\Projects\Ultra Ridership Analysis\major_roads.shp')
fig, ax = plt.subplots(figsize = (15,15))
major_roads.plot(ax = ax)