I have several txt files with entries containing different latitude and longitudinal coordinates as well as some other data. I want to input these data into separate tables, differentiated by their latitude and longitudinal coordinates. However, I am a little unsure on how I best will do that. This is my idea so far:
minlong, minlat, maxlong, maxlat is lists of latitude/longitude of different areas where minlong[i], minlat[i], maxlong[i], maxlat[i] contains the same area for all i. Each area got its own table.
for filename in os.listdir('data'):
with open("data/"+filename) as f:
data = f.readlines()
for line in data:
words = line.split(";")
longitude = float(words[2])
latitude = float(words[3])
for i in range(0,len(minlat)):
if minlong[i]<=longitude and maxlong[i]>=longitude and maxlat[i]>=latitude and minlat[i]<=latitude:
port = int(words[0])
mmsi = int(words[1])
unixtime = int(words[6])
I'm unsure of the next step. How should I store the information for each area, before I bulk insert them to the appropiate sqlite table?
Or is it better to first store all the information in one table, then sort it in different tables?
Aucun commentaire:
Enregistrer un commentaire