代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 10 22:50:05 2020
@author: TSON
"""
'''
-------------------------------------------------
File_Name: DouglasPeuker drawing
Author : L_ZONGYANG
date: 2020/03/17
-------------------------------------------------
'''
import pylab as plt
import pandas as pd
import math
import plot_map
fig = plt.figure(1,(10,8),dpi = 400)
ax = plt.subplot(111)
# bounds = [121.9,30.16,122.10,30.30]
bounds = [121.97,30.2,122.055,30.25]
plot_map.plot_map(plt,bounds,zoom = 12,style = 3)
data = pd.read_csv('E:\\Desktop\\zs\\csv\\4ships.csv')
print(data.index)#获取行的索引名称
print(data.columns)#获取列的索引名称
MMSIDATA=data['mmsi']
print(MMSIDATA)
SHIPSMMSI = list(set(MMSIDATA))
print(SHIPSMMSI)
lens=len(SHIPSMMSI)
print(lens)
for i in range(lens):
mmsi=SHIPSMMSI[i]
ONESHIP=data.iloc[:,:][data[data.T.index[0]]==mmsi]
ONESHIP=ONESHIP.sort_values(by=["Unixtime"],axis=0)
point_num=len(ONESHIP)
start=0
for j in range(point_num):
if point_num<2:
break
if j+2>point_num:
break
time=(ONESHIP.iloc[j+1])['Unixtime']-(ONESHIP.iloc[j])['Unixtime']
if time >36000:
#print('oneshiptrack:time')
start=j
else:
track=ONESHIP[j:j+2]
x_axis_data = track['longitude']
y_axis_data = track['latitude']
plt.plot(x_axis_data, y_axis_data, color="black", linewidth=0.5)
#print('oneshiptrack:line')
start=j
plt.title('AIS data',fontsize=18)
plt.xlabel('longitude')
plt.ylabel('latitude')
plt.show()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。