fork(2) download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4.  
  5. std::string FormatPlacemark(double, double, double, double);
  6.  
  7. int main() {
  8. std::cout << "<?xml version='1.0' encoding='utf-8'?>\n";
  9. std::cout << "<kml xmlns='http://w...content-available-to-author-only...s.net/kml/2.2'>\n";
  10.  
  11. std::string placemark = FormatPlacemark(-76.2, 38.5, -76.1, 38.6);
  12. std::cout << placemark;
  13.  
  14. std::cout << "</kml>\n";
  15.  
  16. return 0;
  17. }
  18.  
  19. std::string FormatPlacemark(double lat1, double long1, double lat2, double long2)
  20. {
  21. std::ostringstream ss;
  22. ss << "<Placemark>\n"
  23. << "<name>Path</name>\n"
  24. << "<description>This is the path between the 2 points</description>\n"
  25. << "<styleUrl>#pathstyle</styleUrl>\n"
  26. << "<LineString>\n"
  27. << "<tessellate>1</tessellate>\n"
  28. << "<coordinates>"
  29. << long1 << "," << lat1 << ",0"
  30. << " "
  31. << long2 << "," << lat2 << ",0"
  32. << "</coordinates>\n"
  33. << "</LineString>\n"
  34. << "</Placemark>\n";
  35.  
  36. return ss.str();
  37. }
Success #stdin #stdout 0s 3432KB
stdin
Standard input is empty
stdout
<?xml version='1.0' encoding='utf-8'?>
<kml xmlns='http://w...content-available-to-author-only...s.net/kml/2.2'>
<Placemark>
<name>Path</name>
<description>This is the path between the 2 points</description>
<styleUrl>#pathstyle</styleUrl>
<LineString>
<tessellate>1</tessellate>
<coordinates>38.5,-76.2,0 38.6,-76.1,0</coordinates>
</LineString>
</Placemark>
</kml>