   kmldir = 'kml';
   nams = {'waddensea2005_mainland.kml',...
           'waddensea2005_texel.kml',...
           'waddensea2005_vlieland.kml',...
           'waddensea2005_terschelling.kml',...
           'waddensea2005_ameland.kml',...
           'waddensea2005 schiermonnikoog.kml',...
           'waddensea2005_griend.kml',...
           'waddensea2005_geleidedam_balgzand.kml',...        
           'waddensea2005_geleidedam_den_oever.kml',...        
           'waddensea2005_geleidedam_harlingen.kml'};
           
%% load

   P.X   = [];
   P.Y   = [];
   P.LON = [];
   P.LAT = [];
   for i=1:length(nams)
      tmp = KML2Coordinates([kmldir, filesep,nams{i}]);
      p(i).lon = tmp{1}(:,1);
      p(i).lat = tmp{1}(:,2);
      [p(i).x,p(i).y]=convertCoordinates(p(i).lon,p(i).lat,'CS1.code',4326,'CS2.code',28992);
      landboundary('write',[kmldir, filesep,filename(nams{i}),'.ldb'],p(i).x,p(i).y);
      
      P.X   = [P.X; nan; p(i).x];
      P.Y   = [P.Y; nan; p(i).y];
      P.LON = [P.LON; nan; p(i).lon];
      P.LAT = [P.LAT; nan; p(i).lat];
   end

   landboundary('write',['waddensea2005_28992.ldb'],P.X  ,P.Y  );
   landboundary('write',['waddensea2005_4326.ldb' ],P.LON,P.LAT);
   
%% NC

   nc_cf_line(['waddensea2005_4326.nc'],P.LON,P.LAT,...
         'title','Wadden Sea landboundary digitized in Google Earth in NWO-PACE project by Deltares.',...
       'version','$Id$ $HeadURL$',...
          'dump',['waddensea2005_4326.cdl'])

%% SHP

   PP.LON = poly_split(P.LON');
   PP.LAT = poly_split(P.LAT');
   for i=1:length(PP.LON)
       PP.LL{i} = [PP.LON{i}' PP.LAT{i}'];
   end
   %%
   shape('write',['waddensea2005_4326.shp'],'polygon',PP.LL);
