コード例 #1
0
        private static string DoCell(H3Index h3, H3ToGeoBoundaryArguments argParser)
        {
            var sb = new StringBuilder();
            var gb = h3.ToGeoBoundary();

            if (argParser.Kml)
            {
                string name = string.IsNullOrEmpty(argParser.KmlName)
                                  ? "H3 Geometry"
                                  : argParser.KmlDescription;
                string desc = string.IsNullOrEmpty(argParser.KmlDescription)
                                  ? "Generated by h3ToGeoBoundary"
                                  : argParser.KmlDescription;

                sb.Append(Kml.PtsHeader(name, desc));
                sb.Append(Kml.OutputBoundaryKML(gb, h3.ToString()));
                sb.Append(Kml.PtsFooter());
            }
            else
            {
                sb.AppendLine(h3.ToString());
                sb.Append(Utility.GeoBoundaryPrintLines(gb));
            }

            return(sb.ToString());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: RichardVasquez/h3net
        private static string DoCell(H3Index h3, H3ToGeoArguments argParser)
        {
            var sb = new StringBuilder();
            var gc = h3.ToGeoCoord();

            if (argParser.Kml)
            {
                string name = string.IsNullOrEmpty(argParser.KmlName)
                                  ? "H3 Geometry"
                                  : argParser.KmlDescription;
                string desc = string.IsNullOrEmpty(argParser.KmlDescription)
                                  ? "Generated by h3ToGeo"
                                  : argParser.KmlDescription;

                sb.Append(Kml.PtsHeader(name, desc));
                sb.Append(Kml.OutputPointKml(gc, h3.ToString()));
                sb.Append(Kml.PtsFooter());
            }
            else
            {
                sb.Append($"{gc.Latitude.RadiansToDegrees(),10:f8}, {gc.Longitude.RadiansToDegrees(),10:f8}");
            }

            return(sb.ToString());
        }