That’s ok. Bad timing, I guess…
Do you have any suggestions as to how to go about generating the coordinates? The czml format used for the country border data is fairly straight-forward. However, the .shp files are binary, so they aren’t as easy to just look at. I’ve been programming for a few decades now and have the gray hairs to prove it. I’m no stranger to having to figure things out; it’s just helpful when I don’t have to.
Obviously, you must have used czml-writer in the process. This utility is woefully lacking in terms of documentation or how it is to be used. I know it’s been many years since you looked at it, but any pointers you might have would be most appreciated.
Thanks so much for replying!
[edit]
After looking at the czml-writer project, I discovered it wasn’t as difficult to use as I had feared. I made a quick and dirty console app passing a shape file from Natural Earth (ne_10m_admin_0_countries.shp, if interested) and was able to make an assumption that at least seems plausible.
I’m including my source code. Please excuse the terrible variable names… I’m more wanting to verify that I’m on the right track. I can clean it up later. As I explain below, I used Albania for my test, and the numbers in the shapefile are close to those reported in the czml file that you provided several years ago.
static void Main(string[] args)
{
ShapefileReader sf = new ShapefileReader("c:/build/cesium/country_data/ne_10m_admin_0_countries.shp");
if (sf == null)
{
System.Console.WriteLine("uh-oh");
return;
}
foreach (Shape s in sf._shapes)
{
PolygonShape ps = s as PolygonShape;
if (ps != null)
{
string country = s.GetMetadataValue("brk_name");
// discovered that country names might have a long trail of
// \0 characters.
int nullIndex = country.IndexOf("\0");
if (nullIndex >= 0)
{
country = country.Substring(0, nullIndex);
}
// I chose Albania at random.
// First few coordinates in czml file (see linked post) for Albania
// [ 0.3593676114556317, 0.7305146123647166, 0.0,
// 0.3571497806121453, 0.7245749925925384, 0.0,
// 0.35962826745960563, 0.7170899262362601, 0.0, ... ]
if (country == "Albania")
{
for (int i=0; i<ps.Count; i++)
{
ShapePart sp = ps[i];
if (sp != null)
{
for (int posIndex = 0; posIndex < sp.Count; posIndex++)
{
Cartographic c = sp[posIndex];
if (c != null)
{
// first 5 coordinates are:
// 0.358964, 0.730825
// 0.358521, 0.730622
// 0.358504, 0.730331
// 0.358499, 0.730236
// 0.358638, 0.729795
// These aren't exact matches to what was in the CZML file, but they seem close.
Console.WriteLine($"{c.Longitude.ToString("0.000000")}, " +
$"{c.Latitude.ToString("0.000000")}");
}
}
}
}
}
}
}
return;
}