{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip install simdkalman\n!pip install pynmea2\n!pip install django\nimport pandas as pd\nimport numpy as np\nimport pynmea2","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-07-30T01:44:48.616305Z","iopub.execute_input":"2022-07-30T01:44:48.617767Z","iopub.status.idle":"2022-07-30T01:45:20.896691Z","shell.execute_reply.started":"2022-07-30T01:44:48.617625Z","shell.execute_reply":"2022-07-30T01:45:20.895480Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"16450*0.85","metadata":{"execution":{"iopub.status.busy":"2022-07-30T01:45:20.898458Z","iopub.execute_input":"2022-07-30T01:45:20.898703Z","iopub.status.idle":"2022-07-30T01:45:20.908091Z","shell.execute_reply.started":"2022-07-30T01:45:20.898674Z","shell.execute_reply":"2022-07-30T01:45:20.907165Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/gnss-classification/GNSS_raw_train.csv')\ndf['Location'] = 0\ndf.loc[0:10390,'Location'] = 'Tsim Sha Tsui'\ndf.loc[10391:38142,'Location'] = 'Scenario Whampo'\ndf.loc[38143:,'Location'] = 'Scenario Mong Kok'\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-30T01:45:20.908967Z","iopub.execute_input":"2022-07-30T01:45:20.909171Z","iopub.status.idle":"2022-07-30T01:45:21.198068Z","shell.execute_reply.started":"2022-07-30T01:45:20.909142Z","shell.execute_reply":"2022-07-30T01:45:21.197130Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df","metadata":{"execution":{"iopub.status.busy":"2022-07-30T01:45:21.199782Z","iopub.execute_input":"2022-07-30T01:45:21.199992Z","iopub.status.idle":"2022-07-30T01:45:21.247836Z","shell.execute_reply.started":"2022-07-30T01:45:21.199964Z","shell.execute_reply":"2022-07-30T01:45:21.246632Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# import geopandas as gp\n# from geopandas import GeoDataFrame\n# import matplotlib.pyplot as plt\n# from shapely.geometry import Point\n# COLOR = ['red','blue','green']\n# for (i,marker) in enumerate(df['Location'].unique().tolist()):\n#     fig,ax = plt.subplots()\n#     d = df[df.Location==marker]\n#     xy = [Point(xy) for xy in zip(d.Longitude,d.Latitude)]\n#     pts = gp.GeoSeries(xy)\n#     print(f'{marker}')\n#     pts.plot(figsize=(100,120),ax=ax,marker = i,color = COLOR[i],markersize = 2)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-30T01:45:21.248913Z","iopub.execute_input":"2022-07-30T01:45:21.249114Z","iopub.status.idle":"2022-07-30T01:45:21.253732Z","shell.execute_reply.started":"2022-07-30T01:45:21.249086Z","shell.execute_reply":"2022-07-30T01:45:21.252837Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import plotly.express as px\ndef visualize_trafic(DF,key):\n    center = {\"lat\":np.mean(DF['Latitude']), \"lon\":np.mean(DF['Longitude'])}\n    print(type(center['lat']))\n\n    fig = px.scatter_mapbox(DF,\n                            \n                            # Here, plotly gets, (x,y) coordinates\n                            lat=\"Latitude\",\n                            lon=\"Longitude\",\n                            \n                            #Here, plotly detects color of series\n                            color=key,\n                            labels=\"Label\",\n#                             size=\"small\",\n                            zoom=13,\n                            center=center,\n                            height=400,\n                            width=400)\n    fig.update_layout(mapbox_style='stamen-terrain')\n    fig.update_layout(margin={\"r\": 0, \"t\": 0, \"l\": 0, \"b\": 0})\n    fig.update_layout(title_text=\"GPS trafic\")\n    fig.show()\n\n\n\nvisualize_trafic(df,'Location')","metadata":{"execution":{"iopub.status.busy":"2022-07-30T01:45:21.255109Z","iopub.execute_input":"2022-07-30T01:45:21.255386Z","iopub.status.idle":"2022-07-30T01:45:24.600250Z","shell.execute_reply.started":"2022-07-30T01:45:21.255358Z","shell.execute_reply":"2022-07-30T01:45:24.599387Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import plotly.express as px\ndef visualize_trafic(DF,key):\n    center = {\"lat\":np.mean(DF['Latitude']), \"lon\":np.mean(DF['Longitude'])}\n    print(type(center['lat']))\n\n    fig = px.scatter_mapbox(DF,\n                            \n                            # Here, plotly gets, (x,y) coordinates\n                            lat=\"Latitude\",\n                            lon=\"Longitude\",\n                            \n                            #Here, plotly detects color of series\n                            color=key,\n                            labels=\"Label\",\n#                             size=\"small\",\n                            zoom=13,\n                            center=center,\n                            height=400,\n                            width=400)\n    fig.update_layout(mapbox_style='stamen-terrain')\n    fig.update_layout(margin={\"r\": 0, \"t\": 0, \"l\": 0, \"b\": 0})\n    fig.update_layout(title_text=\"GPS trafic\")\n    fig.show()\n\n\n\nvisualize_trafic(df,'Label')","metadata":{"execution":{"iopub.status.busy":"2022-07-30T01:45:24.602024Z","iopub.execute_input":"2022-07-30T01:45:24.602453Z","iopub.status.idle":"2022-07-30T01:45:24.800719Z","shell.execute_reply.started":"2022-07-30T01:45:24.602414Z","shell.execute_reply":"2022-07-30T01:45:24.798431Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}