-
Notifications
You must be signed in to change notification settings - Fork 4
/
loadf.py
39 lines (31 loc) · 1.14 KB
/
loadf.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
##########################
# Remove colunas
###########################
import csv
out= open("C:/Users/Pedro/remote.csv")
rdr= csv.reader(out)
result= open("C:/Users/Pedro/remotevel.csv","w")
wtr= csv.writer ( result,delimiter=',',lineterminator='\n')
for row in rdr:
wtr.writerow( (row[3], row[4], row[8],row[13]) )
out.close()
result.close()
#nameloadfile="""C:/Users/Pedro/remotevel.csv"""
#InFlnm = nameloadfile
#InDrPth=filename
#InFlPth="file:///"+InDrPth
#uri1 = InFlPth+"?delimiter=%s&xField=%s&yField=%s&crs=epsg:4326" % (",","LON","LAT")
InFlnm='Heigt Values2222'
InDrPth='C:/Users/Pedro/remotevel.csv'
InFlPth="file:///"+InDrPth
uri1 = InFlPth+"?delimiter=%s&xField=%s&yField=%s" % (",","LON","LAT")
lyr = QgsVectorLayer(uri1, InFlnm, "delimitedtext")
##uri += """type=csv&"""
#uri += """delimiter=","&"""
##uri += """trimFields=Yes&"""
#uri += """xField="LONG"&"""
#uri += """yField="LAT"&"""
#uri += """crs=epsg:4326"""
uri = InFlPth+"?delimiter=%s&xField=%s&yField=%s&crs=epsg:4326" % (",","LON","LAT")
layer=QgsVectorLayer(uri,"pedro","delimitedtext")
QgsMapLayerRegistry.instance().addMapLayers([layer])