j k

j k

  • 0
  • 34
  • 0

Dictionaty and List assitance requested

Oct 6 2013 10:35 AM
Hi All,
I need your assitance with the following:
i have created a small application that is taking information from a DB, puting it in a datagridview and then will create a KML file.
i have add support on the datagridview from a previous post and now i am stuck with the following:

basically the sql query will give you the following:

State Name Long Lat
Day AZ1 11.11111 22.2222 
Day  AZ1  11.22222  22.3333 
Day  AZ1  11.33333  22.4444 
Day  AZ1  11.44444  22.5555 
Day  AZ2  11.11111  22.2222 
Day  AZ2  22.22222 33.3333 
Day  AZ2  22.33333  33.4444 
Day  AZ2  22.44444  33.5555 
Night  AZ1  11.11111  22.2222 
Night  AZ1  11.22222  22.3333 
Night  AZ1  11.33333  22.4444 
Night  AZ1  11.44444  22.5555 
Night  AZ5  55.11111  66.2222 
Night  AZ5  55.22222  66.3333 
Night  AZ5  55.33333  66.4444 
Night  AZ5  55.44444  66.5555 

The output of the creatkml should be a kml file ( i know how to create it, just have issues with putting the above correctly)

[code]
<Folder>
<name>Day</name>
 <Placemark>
  <name>AZ1</name>
  <styleUrl>#m_ylw-pushpin</styleUrl>
  <Polygon>
  <tessellate>1</tessellate>
  <outerBoundaryIs>
  <LinearRing>
  <coordinates>
11.11111,22.2222,0 11.22222,22.3333,01 1.33333,22.4444,0 11.44444,22.5555,0
  </coordinates>
  </LinearRing>
  </outerBoundaryIs>
  </Polygon>
</Placemark>
 <Placemark>
  <name>AZ2</name>
  < styleUrl>#m_ylw-pushpin</styleUrl>
  < Polygon>
  < tessellate>1</tessellate>
  < outerBoundaryIs>
  < LinearRing>
  < coordinates>
11.11111,22.2222,0 22.22222,33.3333,0 22.33333,33.4444,0  22.44444,33.5555
  < /coordinates>
  < /LinearRing>
  </outerBoundaryIs>
  < /Polygon>
</Placemark>
</Folder>
<Folder>
<name>Night</name>
...
.
.
..... basically the same as the above placemarks just with the night names


[/code]

when clicking on the createKML button the application stops with the following error in the phase of : LatLongCollectionByName.Add(matchHandle, lst);

ERROR MESSAGE "An item with the same key has already been added."

the attached code is suppose to collect all the names and the points (without the state value. this is something new i added).

i have uploaded the code and a small sample of the DB

hope i am clear

thanks alot
Jonathan

Attachment: wistokml.zip

Answers (2)