- 积分
- 3638
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-10-21
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2019-1-21 10:55:15
|
显示全部楼层
今天把算法优化了一下,瞬间把“钻石”布满全球:
% Time elapsed: 0.27900004 seconds.
果然,反复开关文件是罪魁祸首!
附件中有IDL脚本和生成的kml文件。
pro rw
tic
head='<?xml version="1.0" encoding="UTF-8"?>'+$
'<kml xmlns="http://earth.google.com/kml/2.1"><Document>'
tail='</Document></kml>'
;地标的前半段:
up='<Placemark><name>p1</name><Style><LineStyle>'+$
'<width>5</width><color>ff0000ff</color>'+$
'</LineStyle><PolyStyle><outline>1</outline>'+$
'<color>7f00ff00</color></PolyStyle></Style>'+$
'<Polygon><extrude>0</extrude>'+$
'<altitudeMode>relativeToGround</altitudeMode>'+$
'<outerBoundaryIs><LinearRing><coordinates>'
;地标的后半段:
down='</coordinates></LinearRing>'+$
'</outerBoundaryIs></Polygon></Placemark>'
;写入kml固定开头
openw,lun,'C:\Users\Administrator\Desktop\out.kml',/get_lun,/append
writeu,lun,HEAD
for i=-180,180,4 do begin
for j=-90,90,4 do begin
A=STRING(10B)+strtrim(string(i),2)+','+strtrim(string(j),2)+',300000'
B=STRING(10B)+strtrim(string(i+2),2)+','+strtrim(string(j),2)+',300000'
C=STRING(10B)+strtrim(string(i+2),2)+','+strtrim(string(j+2),2)+',300000'
D=STRING(10B)+strtrim(string(i),2)+','+strtrim(string(j+2),2)+',300000'
E=STRING(10B)+strtrim(string(i+1),2)+','+strtrim(string(j+1),2)+',0'
F=STRING(10B)+strtrim(string(i+1),2)+','+strtrim(string(j+1),2)+',600000'
writeu,lun,up,A,B,E,A,STRING(10B),down,$
up,A,B,F,A,STRING(10B),down,$
up,A,B,E,A,STRING(10B),down,$
up,B,C,E,B,STRING(10B),down,$
up,B,C,F,B,STRING(10B),down,$
up,C,D,E,C,STRING(10B),down,$
up,C,D,F,C,STRING(10B),down,$
up,D,A,E,D,STRING(10B),down,$
up,D,A,F,D,STRING(10B),down
endfor
endfor
;写入收尾:
writeu,lun,tail
free_lun,lun
toc
end
|
-
-
rw.pro
1.67 KB, 下载次数: 1, 下载积分: 金钱 -5
-
-
out.kml
14.64 MB, 下载次数: 28, 下载积分: 金钱 -5
|