{"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":"markdown","source":"### Make kml file code","metadata":{}},{"cell_type":"code","source":"!pip install simplekml","metadata":{"execution":{"iopub.status.busy":"2021-06-16T12:56:59.628125Z","iopub.execute_input":"2021-06-16T12:56:59.628495Z","iopub.status.idle":"2021-06-16T12:57:06.249333Z","shell.execute_reply.started":"2021-06-16T12:56:59.628467Z","shell.execute_reply":"2021-06-16T12:57:06.248023Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import simplekml\nimport pandas as pd","metadata":{"execution":{"iopub.status.busy":"2021-06-16T12:57:06.252053Z","iopub.execute_input":"2021-06-16T12:57:06.252527Z","iopub.status.idle":"2021-06-16T12:57:06.258934Z","shell.execute_reply.started":"2021-06-16T12:57:06.252473Z","shell.execute_reply":"2021-06-16T12:57:06.257525Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"../input/google-smartphone-decimeter-challenge/baseline_locations_test.csv\")","metadata":{"execution":{"iopub.status.busy":"2021-06-16T12:57:06.262038Z","iopub.execute_input":"2021-06-16T12:57:06.262572Z","iopub.status.idle":"2021-06-16T12:57:06.413352Z","shell.execute_reply.started":"2021-06-16T12:57:06.262519Z","shell.execute_reply":"2021-06-16T12:57:06.412121Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"names = df[\"phone\"].unique()\nlen(df[\"phone\"].unique())","metadata":{"execution":{"iopub.status.busy":"2021-06-16T12:57:06.416176Z","iopub.execute_input":"2021-06-16T12:57:06.416704Z","iopub.status.idle":"2021-06-16T12:57:06.447269Z","shell.execute_reply.started":"2021-06-16T12:57:06.416634Z","shell.execute_reply":"2021-06-16T12:57:06.445900Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"kml = simplekml.Kml(open=1)\nfor name_ in names:\n    temp  = df[df[\"phone\"] == name_]\n    temp_ = []\n    for ele in temp[[\"lngDeg\",\"latDeg\"]].values.tolist():\n        temp_.append(tuple(ele))\n    linestring = kml.newlinestring(name = name_)\n    linestring.style.linestyle.width = 30\n#     linestring.style.linestyle.color = simplekml.Color.azure\n    linestring.coords = temp_\nkml.savekmz('test.kmz')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-06-16T12:57:06.448994Z","iopub.execute_input":"2021-06-16T12:57:06.449435Z","iopub.status.idle":"2021-06-16T12:57:07.546257Z","shell.execute_reply.started":"2021-06-16T12:57:06.449391Z","shell.execute_reply":"2021-06-16T12:57:07.545198Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}