コード例 #1
0
 private string ToProj4Datum(Datum datum)
 {
     using (OGCWkt2Proj4Mapper dm = new OGCWkt2Proj4Mapper())
     {
         return(dm.ToProj4Datum(datum));
     }
 }
コード例 #2
0
        private NameMapItem GetPrjName(WktItem wktItem)
        {
            using (OGCWkt2Proj4Mapper map = new OGCWkt2Proj4Mapper())
            {
                string prjName = wktItem.Value.Split(',')[0].Replace("\"", string.Empty);
                switch (_wktSource)
                {
                case enumWKTSource.EsriPrjFile:
                    return(map.GetPrjNameFromEsriName(prjName));

                case enumWKTSource.GDAL:
                    return(map.GetPrjNameFromWKTName(prjName));

                default:
                    return(map.GetPrjNameFromWKTName(prjName));
                }
            }
        }
コード例 #3
0
        private NameValuePair[] GetPrjParameters(WktItem[] wktItems)
        {
            List <NameValuePair> values = new List <NameValuePair>();

            using (OGCWkt2Proj4Mapper map = new OGCWkt2Proj4Mapper())
            {
                for (int i = 0; i < wktItems.Length; i++)
                {
                    NameMapItem name   = null;
                    WktItem     witem  = wktItems[i];
                    string[]    vs     = witem.Value.Split(',');
                    string      pname  = vs[0].Replace("\"", string.Empty);
                    double      pvalue = double.Parse(vs[1]);
                    try
                    {
                        switch (_wktSource)
                        {
                        case enumWKTSource.EsriPrjFile:
                            name = map.GetParameterFromEsriName(pname);
                            break;

                        case enumWKTSource.GDAL:
                            name = map.GetParameterFromWKTName(pname);
                            break;

                        default:
                            name = map.GetParameterFromWKTName(pname);
                            break;
                        }
                        if (name != null)
                        {
                            values.Add(new NameValuePair(name, pvalue));
                        }
                    }
                    catch { continue; }
                }
            }
            return(values.Count > 0 ? values.ToArray() : null);
        }