(defun C:convert_txt_katalog_to_kml( / FILE_POINTS_LIST LIST-STRINGS LIST_POINTS_LIST PUT-FILE list-ggs list-head
				    DESCRIPTION H KLASS-H KLASS-XY razrad-xy MARKA MSK-64-X MSK-64-Y MSK-X MSK-Y MSK-ZONE N NAME SK-42-X SK-42-Y SK-63-X SK-63-Y TYPE_CN TYPE_ZN WGS-84_B WGS-84_L)
  
  (load_global_variable)
  (defun creat-kml-by-list (file list-punct list-up / n nn list-strings discription)
    (setq list-strings (list
			   "<?xml version=\"1.0\" encoding=\"windows-1251\"?>"
			   "<kml xmlns=\"http://earth.google.com/kml/2.2\">"
			   "<Document>"
			   )
	    )
    
    (foreach z list-punct
      (setq discription "")
      (setq nn 0)
      (foreach y list-up
	(setq discription (strcat discription(if (/=(nth nn z)"")
					       (if (eq y "Карточка")
						 (strcat"<a href=\"http://andrey.noip.me/punkts/card/"(nth nn z)"\"><img src=\"http://andrey.noip.me/punkts/card/"(nth nn z)"\" height=\"500\"/></a><br>")
						 (strcat y "=" (nth nn z)"<br>"))
					       "")))
	(setq nn (1+ nn))
	)
      (setq list-strings
	     (append list-strings
		     (list
		       (strcat"  <Placemark><name>" (if(not (eq(nth 1 z)"")) (strcat"["(nth 1 z)"]")"")(nth 0 z)
			      "</name><description><![CDATA["
			      discription
			      "]]></description><Point><coordinates>"
			      (vl-string-subst "." "," (nth (- (length list-up)(length(member "WGS-84 L" list-up))) z)) "," (vl-string-subst "." "," (nth (- (length list-up)(length(member "WGS-84 B" list-up))) z))
			      ",0.000000</coordinates></Point></Placemark>")
		       )
		     )
	    )
      )
    (setq list-strings
	   (append list-strings
		   (list
		     "</Document>"
		     "</kml>"
		     )
		   )
	  )
    
    (file_write_list_to_file file list-strings)
    
    (princ)
    )






  
  (if(setq put-file (getfiled "Выбор файла координат" (getvar "DWGPREFIX")  "txt" 0))
    (progn
      (setq file_points_list(file_read_to_list put-file))
      (foreach x file_points_list
	(setq list_points_list (append list_points_list (list (convert-string-to-list-be-delimiter x "\t"))))
	)
      (setq list-head (car list_points_list))
      (foreach g (cdr list_points_list)
	(setq list-ggs(append list-ggs(list g)))
	)
      (creat-kml-by-list (strcat (vl-filename-directory put-file)"\\"(vl-filename-base put-file)".kml") list-ggs list-head)
      )
    )
  
  
  (princ)
  )