示例#1
0
        public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out string val, int index, int count)
        {
            val = null;
            if (count < 0)
            {
                return(0);
            }

            if (!gtif.gt_keys.ContainsKey(thekey))
            {
                return(0);
            }
            GeoKey key = gtif.gt_keys[thekey];

            if (key.gk_type != tagtype_t.TYPE_ASCII)
            {
                return(0);
            }

            string val_ = (string)key.gk_data;

            if (count == 0 || (count + index) > val_.Length)
            {
                val = val_.Substring(index);
            }
            else
            {
                val = val_.Substring(index, count);
            }

            return(val.Length);
        }
示例#2
0
        public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out double[] val, int index, int count)
        {
            val = null;
            if (!gtif.gt_keys.ContainsKey(thekey))
            {
                return(0);
            }
            GeoKey key = gtif.gt_keys[thekey];

            if (key.gk_type != tagtype_t.TYPE_DOUBLE)
            {
                return(0);
            }

            double[] val_ = (double[])key.gk_data;
            if (count == 0 || (count + index) > val_.Length)
            {
                count = val_.Length - index;
            }
            if (count <= 0)
            {
                return(0);
            }
            val = new double[count];
            Array.Copy(val_, index, val, 0, count);
            return(count);
        }
示例#3
0
		public static string GTIFValueName(geokey_t key, int value)
		{
			KeyInfo[] info;

			switch(key)
			{
				// All codes using linear/angular/whatever units
				case geokey_t.GeogLinearUnitsGeoKey:
				case geokey_t.ProjLinearUnitsGeoKey:
				case geokey_t.GeogAngularUnitsGeoKey:
				case geokey_t.GeogAzimuthUnitsGeoKey:
				case geokey_t.VerticalUnitsGeoKey: info=_geounitsValue; break;

				// put other key-dependent lists here
				case geokey_t.GTModelTypeGeoKey: info=_modeltypeValue; break;
				case geokey_t.GTRasterTypeGeoKey: info=_rastertypeValue; break;
				case geokey_t.GeographicTypeGeoKey: info=_geographicValue; break;
				case geokey_t.GeogGeodeticDatumGeoKey: info=_geodeticdatumValue; break;
				case geokey_t.GeogEllipsoidGeoKey: info=_ellipsoidValue; break;
				case geokey_t.GeogPrimeMeridianGeoKey: info=_primemeridianValue; break;
				case geokey_t.ProjectedCSTypeGeoKey: info=_pcstypeValue; break;
				case geokey_t.ProjectionGeoKey: info=_projectionValue; break;
				case geokey_t.ProjCoordTransGeoKey: info=_coordtransValue; break;
				case geokey_t.VerticalCSTypeGeoKey: info=_vertcstypeValue; break;
				case geokey_t.VerticalDatumGeoKey: info=_vdatumValue; break;

				// And if all else fails...
				default: info=_csdefaultValue; break;
			}

			return FindName(info, value);
		}
示例#4
0
		public static int GTIFKeyInfo(GTIF gtif, geokey_t key, out tagtype_t type)
		{
			type=tagtype_t.TYPE_UNKNOWN;
			if(!gtif.gt_keys.ContainsKey(key)) return 0;
			GeoKey keyptr=gtif.gt_keys[key];
			type=keyptr.gk_type;
			return keyptr.gk_count;
		}
示例#5
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out vdatum_t val, int index, int count)
 {
     // ignore count
     val = 0;
     ushort[] vals;
     if (GTIFKeyGet(gtif, thekey, out vals, index, 1) == 0)
     {
         return(0);
     }
     val = (vdatum_t)vals[0];
     return(1);
 }
示例#6
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out double val, int index, int count)
 {
     // ignore count
     val = 0;
     double[] vals;
     if (GTIFKeyGet(gtif, thekey, out vals, index, 1) == 0)
     {
         return(0);
     }
     val = vals[0];
     return(1);
 }
示例#7
0
        public static int GTIFKeyInfo(GTIF gtif, geokey_t key, out tagtype_t type)
        {
            type = tagtype_t.TYPE_UNKNOWN;
            if (!gtif.gt_keys.ContainsKey(key))
            {
                return(0);
            }
            GeoKey keyptr = gtif.gt_keys[key];

            type = keyptr.gk_type;
            return(keyptr.gk_count);
        }
示例#8
0
        public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out string val)
        {
            val = null;
            if (!gtif.gt_keys.ContainsKey(thekey))
            {
                return(0);
            }
            GeoKey key = gtif.gt_keys[thekey];

            if (key.gk_type != tagtype_t.TYPE_ASCII)
            {
                return(0);
            }

            val = (string)key.gk_data;

            return(val.Length);
        }
示例#9
0
        public static string GTIFValueName(geokey_t key, int value)
        {
            KeyInfo[] info;

            switch (key)
            {
            // All codes using linear/angular/whatever units
            case geokey_t.GeogLinearUnitsGeoKey:
            case geokey_t.ProjLinearUnitsGeoKey:
            case geokey_t.GeogAngularUnitsGeoKey:
            case geokey_t.GeogAzimuthUnitsGeoKey:
            case geokey_t.VerticalUnitsGeoKey: info = _geounitsValue; break;

            // put other key-dependent lists here
            case geokey_t.GTModelTypeGeoKey: info = _modeltypeValue; break;

            case geokey_t.GTRasterTypeGeoKey: info = _rastertypeValue; break;

            case geokey_t.GeographicTypeGeoKey: info = _geographicValue; break;

            case geokey_t.GeogGeodeticDatumGeoKey: info = _geodeticdatumValue; break;

            case geokey_t.GeogEllipsoidGeoKey: info = _ellipsoidValue; break;

            case geokey_t.GeogPrimeMeridianGeoKey: info = _primemeridianValue; break;

            case geokey_t.ProjectedCSTypeGeoKey: info = _pcstypeValue; break;

            case geokey_t.ProjectionGeoKey: info = _projectionValue; break;

            case geokey_t.ProjCoordTransGeoKey: info = _coordtransValue; break;

            case geokey_t.VerticalCSTypeGeoKey: info = _vertcstypeValue; break;

            case geokey_t.VerticalDatumGeoKey: info = _vdatumValue; break;

            // And if all else fails...
            default: info = _csdefaultValue; break;
            }

            return(FindName(info, value));
        }
示例#10
0
        public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, double[] val)
        {
            if (val == null)          // delete the indicated tag
            {
                if (!gtif.gt_keys.ContainsKey(keyID))
                {
                    return(false);
                }
                gtif.gt_keys.Remove(keyID);
                gtif.gt_flags |= gtiff_flags.FLAG_FILE_MODIFIED;
                return(true);
            }

            if (gtif.gt_keys.ContainsKey(keyID))
            {
                gtif.gt_keys.Remove(keyID);
                gtif.gt_flags |= gtiff_flags.FLAG_FILE_MODIFIED;
            }

            // We need to create the key
            try
            {
                GeoKey key = new GeoKey();
                key.gk_key   = keyID;
                key.gk_type  = tagtype_t.TYPE_DOUBLE;
                key.gk_count = val.Length;

                double[] tmp = new double[val.Length];
                val.CopyTo(tmp, 0);
                key.gk_data = tmp;

                gtif.gt_keys.Add(keyID, key);
                gtif.gt_flags |= gtiff_flags.FLAG_FILE_MODIFIED;
                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#11
0
        public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, string val)
        {
            if (val == null)          // delete the indicated tag
            {
                if (!gtif.gt_keys.ContainsKey(keyID))
                {
                    return(false);
                }
                gtif.gt_keys.Remove(keyID);
                gtif.gt_flags |= gtiff_flags.FLAG_FILE_MODIFIED;
                return(true);
            }

            if (gtif.gt_keys.ContainsKey(keyID))
            {
                gtif.gt_keys.Remove(keyID);
                gtif.gt_flags |= gtiff_flags.FLAG_FILE_MODIFIED;
            }

            val = val.Trim('\0');

            // We need to create the key
            try
            {
                GeoKey key = new GeoKey();
                key.gk_key   = keyID;
                key.gk_type  = tagtype_t.TYPE_ASCII;
                key.gk_count = val.Length;
                key.gk_data  = val.Substring(0, val.Length);
                gtif.gt_keys.Add(keyID, key);
                gtif.gt_flags |= gtiff_flags.FLAG_FILE_MODIFIED;
                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#12
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out primemeridian_t val, int index)
 {
     return(GTIFKeyGet(gtif, thekey, out val, index, 0));
 }
示例#13
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out projection_t val, int index)
		{
			return GTIFKeyGet(gtif, thekey, out val, index, 0);
		}
示例#14
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out double val, int index, int count)
		{
			// ignore count
			val=0;
			double[] vals;
			if(GTIFKeyGet(gtif, thekey, out vals, index, 1)==0) return 0;
			val=vals[0];
			return 1;
		}
示例#15
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out string val)
		{
			val=null;
			if(!gtif.gt_keys.ContainsKey(thekey)) return 0;
			GeoKey key=gtif.gt_keys[thekey];

			if(key.gk_type!=tagtype_t.TYPE_ASCII) return 0;

			val=(string)key.gk_data;

			return val.Length;
		}
示例#16
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out primemeridian_t val, int index)
		{
			return GTIFKeyGet(gtif, thekey, out val, index, 0);
		}
示例#17
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out coordtrans_t val, int index)
		{
			return GTIFKeyGet(gtif, thekey, out val, index, 0);
		}
示例#18
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out vdatum_t val, int index, int count)
		{
			// ignore count
			val=0;
			ushort[] vals;
			if(GTIFKeyGet(gtif, thekey, out vals, index, 1)==0) return 0;
			val=(vdatum_t)vals[0];
			return 1;
		}
示例#19
0
        static int ReadKey(GTIF gt, GTIFReadMethod scan, object aux)
        {
            string message = scan(aux);

            if (message == null)
            {
                return(-1);
            }
            if (message.Length >= 12)
            {
                if (message.ToLower().Substring(0, 12) == FMT_KEYEND.ToLower().Substring(0, 12))
                {
                    return(0);
                }
            }

            try
            {
                int firstp = message.IndexOfAny(new char[] { '(', ' ', '\t' });
                if (firstp < 0)
                {
                    return(StringError(message));
                }

                string name     = message.Substring(0, firstp).Trim();
                string message1 = message.Substring(firstp);

                int colon = message1.IndexOf(':');
                if (colon < 0)
                {
                    return(StringError(message1));
                }

                string head = message1.Substring(0, colon);
                head = head.Trim(' ', '\t', '(', ')');

                string[] spl = head.Split(',');
                if (spl.Length != 2)
                {
                    return(StringError(head));
                }

                string type  = spl[0];
                int    count = int.Parse(spl[1]);

                // skip white space
                string data = message1.Substring(colon + 1).Trim();
                if (data.Length == 0)
                {
                    return(StringError(message));
                }

                if (GTIFKeyCode(name) < 0)
                {
                    return(StringError(name));
                }
                geokey_t key = (geokey_t)GTIFKeyCode(name);

                if (GTIFTypeCode(type) < 0)
                {
                    return(StringError(type));
                }
                tagtype_t ktype = (tagtype_t)GTIFTypeCode(type);

                switch (ktype)
                {
                case tagtype_t.TYPE_ASCII:
                {
                    string cdata = "";

                    int firstDoubleQuote = data.IndexOf('"');
                    if (firstDoubleQuote < 0)
                    {
                        return(StringError(data));
                    }

                    data = data.Substring(firstDoubleQuote + 1);

                    bool wasesc = false;
                    char c      = '\0';
                    for (int i = 0; i < data.Length; i++)
                    {
                        c = data[i];
                        if (wasesc)
                        {
                            if (c == '\\')
                            {
                                cdata += '\\';
                            }
                            else if (c == '"')
                            {
                                cdata += '"';
                            }
                            else if (c == 'n')
                            {
                                cdata += '\n';
                            }
                            else if (c == 't')
                            {
                                cdata += '\t';
                            }
                            else if (c == 'b')
                            {
                                cdata += '\b';
                            }
                            else if (c == 'r')
                            {
                                cdata += '\r';
                            }
                            else if (c == '0')
                            {
                                cdata += '\0';
                            }

                            wasesc = false;
                            continue;
                        }

                        if (c == '\\')
                        {
                            wasesc = true;
                            continue;
                        }

                        if (c == '\0')
                        {
                            break;
                        }
                        if (c == '"')
                        {
                            break;
                        }

                        cdata += c;

                        if (cdata.Length == count)
                        {
                            c = data[i + 1];
                            break;
                        }
                    }

                    if (cdata.Length < count)
                    {
                        return(StringError(message));
                    }
                    if (c != '"')
                    {
                        return(StringError(message));
                    }

                    GTIFKeySet(gt, key, cdata);
                }
                break;

                case tagtype_t.TYPE_DOUBLE:
                {
                    double[] dptr = new double[count];
                    int      i    = 0;
                    for (; count > 0; count -= 3)
                    {
                        spl = data.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                        if (spl.Length != Math.Min(3, count))
                        {
                            return(StringError(data));
                        }

                        foreach (string part in spl)
                        {
                            message   = part;
                            dptr[i++] = GTIFAtof(part);
                        }

                        if (count > 3)
                        {
                            message = data = scan(aux);
                        }
                    }
                    GTIFKeySet(gt, key, dptr);
                }
                break;

                case tagtype_t.TYPE_SHORT:
                    if (count == 1)
                    {
                        int icode = GTIFValueCode(key, data);
                        if (icode < 0)
                        {
                            return(StringError(data));
                        }
                        ushort code = (ushort)icode;
                        GTIFKeySet(gt, key, code);
                    }
                    else                             // multi-valued short - no such thing yet
                    {
                        ushort[] sptr = new ushort[count];
                        int      i    = 0;
                        for (; count > 0; count -= 3)
                        {
                            spl = data.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                            if (spl.Length != Math.Min(3, count))
                            {
                                return(StringError(data));
                            }

                            foreach (string part in spl)
                            {
                                message   = part;
                                sptr[i++] = ushort.Parse(part);
                            }

                            if (count > 3)
                            {
                                message = data = scan(aux);
                            }
                        }
                        GTIFKeySet(gt, key, sptr);
                    }
                    break;

                default: return(-1);
                }
            }
            catch
            {
                return(StringError(message));
            }
            return(1);
        }
示例#20
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out double val, int index)
		{
			return GTIFKeyGet(gtif, thekey, out val, index, 0);
		}
示例#21
0
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, double val)
		{
			double[] val1=new double[] { val };
			return GTIFKeySet(gtif, keyID, val1);
		}
示例#22
0
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, ushort val)
		{
			ushort[] val1=new ushort[] { val };
			return GTIFKeySet(gtif, keyID, val1);
		}
示例#23
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out double[] val, int index, int count)
		{
			val=null;
			if(!gtif.gt_keys.ContainsKey(thekey)) return 0;
			GeoKey key=gtif.gt_keys[thekey];

			if(key.gk_type!=tagtype_t.TYPE_DOUBLE) return 0;

			double[] val_=(double[])key.gk_data;
			if(count==0||(count+index)>val_.Length) count=val_.Length-index;
			if(count<=0) return 0;
			val=new double[count];
			Array.Copy(val_, index, val, 0, count);
			return count;
		}
示例#24
0
 public static string GTIFKeyName(geokey_t key)
 {
     return(FindName(_keyInfo, (int)key));
 }
示例#25
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out coordtrans_t val, int index)
 {
     return(GTIFKeyGet(gtif, thekey, out val, index, 0));
 }
示例#26
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out rastertype_t val, int index)
 {
     return(GTIFKeyGet(gtif, thekey, out val, index, 0));
 }
示例#27
0
 public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, double val)
 {
     double[] val1 = new double[] { val };
     return(GTIFKeySet(gtif, keyID, val1));
 }
示例#28
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out rastertype_t val, int index)
		{
			return GTIFKeyGet(gtif, thekey, out val, index, 0);
		}
示例#29
0
 public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, projection_t val)
 {
     ushort[] val1 = new ushort[] { (ushort)val };
     return(GTIFKeySet(gtif, keyID, val1));
 }
示例#30
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out double val, int index)
 {
     return(GTIFKeyGet(gtif, thekey, out val, index, 0));
 }
示例#31
0
 public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, rastertype_t val)
 {
     ushort[] val1 = new ushort[] { (ushort)val };
     return(GTIFKeySet(gtif, keyID, val1));
 }
示例#32
0
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, double[] val)
		{
			if(val==null) // delete the indicated tag
			{
				if(!gtif.gt_keys.ContainsKey(keyID)) return false;
				gtif.gt_keys.Remove(keyID);
				gtif.gt_flags|=gtiff_flags.FLAG_FILE_MODIFIED;
				return true;
			}

			if(gtif.gt_keys.ContainsKey(keyID))
			{
				gtif.gt_keys.Remove(keyID);
				gtif.gt_flags|=gtiff_flags.FLAG_FILE_MODIFIED;
			}
			
			// We need to create the key
			try
			{
				GeoKey key=new GeoKey();
				key.gk_key=keyID;
				key.gk_type=tagtype_t.TYPE_DOUBLE;
				key.gk_count=val.Length;

				double[] tmp=new double[val.Length];
				val.CopyTo(tmp, 0);
				key.gk_data=tmp;

				gtif.gt_keys.Add(keyID, key);
				gtif.gt_flags|=gtiff_flags.FLAG_FILE_MODIFIED;
				return true;
			}
			catch
			{
				return false;
			}
		}
示例#33
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out string val, int index, int count)
		{
			val=null;
			if(count<0) return 0;

			if(!gtif.gt_keys.ContainsKey(thekey)) return 0;
			GeoKey key=gtif.gt_keys[thekey];

			if(key.gk_type!=tagtype_t.TYPE_ASCII) return 0;

			string val_=(string)key.gk_data;
			if(count==0||(count+index)>val_.Length) val=val_.Substring(index);
			else val=val_.Substring(index, count);

			return val.Length;
		}
示例#34
0
        static void PrintKey(GeoKey key, GTIFPrintMethod print, object aux)
        {
            print("\t\t", aux);

            geokey_t keyid = key.gk_key;

            print(GTIFKeyName(keyid), aux);

            int    count   = key.gk_count;
            string message = string.Format(" ({0},{1}): ", GTIFTypeName(key.gk_type), count);

            print(message, aux);

            object data = key.gk_data;

            switch (key.gk_type)
            {
            case tagtype_t.TYPE_ASCII:
            {
                string str = data as string;
                if (str == null)
                {
                    throw new Exception("string expected.");
                }
                if (str.Length < count)
                {
                    throw new Exception("string too short.");
                }

                message = "\"";

                for (int i = 0; i < count; i++)
                {
                    char c = str[i];

                    if (c == '\n')
                    {
                        message += "\\n";
                    }
                    else if (c == '\\')
                    {
                        message += "\\\\";
                    }
                    else if (c == '\t')
                    {
                        message += "\\t";
                    }
                    else if (c == '\b')
                    {
                        message += "\\b";
                    }
                    else if (c == '\r')
                    {
                        message += "\\r";
                    }
                    else if (c == '"')
                    {
                        message += "\\\"";
                    }
                    else if (c == '\0')
                    {
                        message += "\\0";
                    }
                    else
                    {
                        message += c;
                    }
                }

                message += "\"\n";
                print(message, aux);
            }
            break;

            case tagtype_t.TYPE_DOUBLE:
                double[] dptr = data as double[];
                if (dptr == null)
                {
                    throw new Exception("double[] expected.");
                }
                if (dptr.Length < count)
                {
                    throw new Exception("double[] too short.");
                }
                for (int i = 0; i < count; i += 3)
                {
                    int done = Math.Min(i + 3, count);
                    for (int j = i; j < done; j++)
                    {
                        message = string.Format(FMT_DOUBLE, dptr[j]);
                        print(message, aux);
                    }
                    print("\n", aux);
                }
                break;

            case tagtype_t.TYPE_SHORT:
                ushort[] sptr = data as ushort[];
                if (sptr == null)
                {
                    throw new Exception("ushort[] expected.");
                }
                if (sptr.Length < count)
                {
                    throw new Exception("ushort[] too short.");
                }
                if (count == 1)
                {
                    print(GTIFValueName(keyid, sptr[0]), aux);
                    print("\n", aux);
                }
                else
                {
                    for (int i = 0; i < count; i += 3)
                    {
                        int done = Math.Min(i + 3, count);
                        for (int j = i; j < done; j++)
                        {
                            message = string.Format(FMT_SHORT, sptr[j]);
                            print(message, aux);
                        }
                        print("\n", aux);
                    }
                }
                break;

            default:
                message = string.Format("Unknown Type ({0})\n", key.gk_type);
                print(message, aux);
                break;
            }
        }
示例#35
0
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, string val)
		{
			if(val==null) // delete the indicated tag
			{
				if(!gtif.gt_keys.ContainsKey(keyID)) return false;
				gtif.gt_keys.Remove(keyID);
				gtif.gt_flags|=gtiff_flags.FLAG_FILE_MODIFIED;
				return true;
			}

			if(gtif.gt_keys.ContainsKey(keyID))
			{
				gtif.gt_keys.Remove(keyID);
				gtif.gt_flags|=gtiff_flags.FLAG_FILE_MODIFIED;
			}

			val=val.Trim('\0');

			// We need to create the key
			try
			{
				GeoKey key=new GeoKey();
				key.gk_key=keyID;
				key.gk_type=tagtype_t.TYPE_ASCII;
				key.gk_count=val.Length;
				key.gk_data=val.Substring(0, val.Length);
				gtif.gt_keys.Add(keyID, key);
				gtif.gt_flags|=gtiff_flags.FLAG_FILE_MODIFIED;
				return true;
			}
			catch
			{
				return false;
			}
		}
示例#36
0
 public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, ushort val)
 {
     ushort[] val1 = new ushort[] { val };
     return(GTIFKeySet(gtif, keyID, val1));
 }
示例#37
0
		// This function writes a geokey_t value to a GeoTIFF file.
		//
		// @param gtif The geotiff information handle from GTIFNew().
		//
		// @param keyID The geokey_t name (such as ProjectedCSTypeGeoKey).
		// This must come from the list of legal geokey_t values
		// (an enumeration) listed below.
		//
		// Note that key values aren't actually flushed to the file until
		// GTIFWriteKeys() is called. Till then
		// the new values are just kept with the GTIF structure.
		//
		// Example:
		//
		//	GTIFKeySet(gtif, GTRasterTypeGeoKey, RasterPixelIsArea);
		//	GTIFKeySet(gtif, GTCitationGeoKey, "UTM 11 North / NAD27");
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, geodeticdatum_t val)
		{
			ushort[] val1=new ushort[] { (ushort)val };
			return GTIFKeySet(gtif, keyID, val1);
		}
示例#38
0
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, projection_t val)
		{
			ushort[] val1=new ushort[] { (ushort)val };
			return GTIFKeySet(gtif, keyID, val1);
		}
示例#39
0
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, coordtrans_t val)
		{
			ushort[] val1=new ushort[] { (ushort)val };
			return GTIFKeySet(gtif, keyID, val1);
		}
示例#40
0
 // This function writes a geokey_t value to a GeoTIFF file.
 //
 // @param gtif The geotiff information handle from GTIFNew().
 //
 // @param keyID The geokey_t name (such as ProjectedCSTypeGeoKey).
 // This must come from the list of legal geokey_t values
 // (an enumeration) listed below.
 //
 // Note that key values aren't actually flushed to the file until
 // GTIFWriteKeys() is called. Till then
 // the new values are just kept with the GTIF structure.
 //
 // Example:
 //
 //	GTIFKeySet(gtif, GTRasterTypeGeoKey, RasterPixelIsArea);
 //	GTIFKeySet(gtif, GTCitationGeoKey, "UTM 11 North / NAD27");
 public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, geodeticdatum_t val)
 {
     ushort[] val1 = new ushort[] { (ushort)val };
     return(GTIFKeySet(gtif, keyID, val1));
 }
示例#41
0
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, rastertype_t val)
		{
			ushort[] val1=new ushort[] { (ushort)val };
			return GTIFKeySet(gtif, keyID, val1);
		}
示例#42
0
 public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, coordtrans_t val)
 {
     ushort[] val1 = new ushort[] { (ushort)val };
     return(GTIFKeySet(gtif, keyID, val1));
 }
示例#43
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out geodeticdatum_t val, int index)
 {
     return(GTIFKeyGet(gtif, thekey, out val, index, 0));
 }
示例#44
0
		public static string GTIFKeyName(geokey_t key)
		{
			return FindName(_keyInfo, (int)key);
		}
示例#45
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out projection_t val, int index)
 {
     return(GTIFKeyGet(gtif, thekey, out val, index, 0));
 }
示例#46
0
		//**********************************************************************
		//							SetGTParmIds()
		//
		//		This is hardcoded logic to set the GeoTIFF parmaeter
		//		identifiers for all the EPSG supported projections. As the
		//		trf_method.csv table grows with new projections, this code
		//		will need to be updated.
		//**********************************************************************
		static bool SetGTParmIds(coordtrans_t CTProjection, geokey_t[] projParmId, int[] EPSGCodes)
		{
			if(EPSGCodes==null) EPSGCodes=new int[7];
			if(projParmId==null) projParmId=new geokey_t[7];

			// psDefn.nParms=7;
			switch(CTProjection)
			{
				case coordtrans_t.CT_CassiniSoldner:
				case coordtrans_t.CT_NewZealandMapGrid:
					projParmId[0]=geokey_t.ProjNatOriginLatGeoKey;
					projParmId[1]=geokey_t.ProjNatOriginLongGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGNatOriginLat;
					EPSGCodes[1]=EPSGNatOriginLong;
					EPSGCodes[5]=EPSGFalseEasting;
					EPSGCodes[6]=EPSGFalseNorthing;
					return true;

				case coordtrans_t.CT_ObliqueMercator:
					projParmId[0]=geokey_t.ProjCenterLatGeoKey;
					projParmId[1]=geokey_t.ProjCenterLongGeoKey;
					projParmId[2]=geokey_t.ProjAzimuthAngleGeoKey;
					projParmId[3]=geokey_t.ProjRectifiedGridAngleGeoKey;
					projParmId[4]=geokey_t.ProjScaleAtCenterGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGProjCenterLat;
					EPSGCodes[1]=EPSGProjCenterLong;
					EPSGCodes[2]=EPSGAzimuth;
					EPSGCodes[3]=EPSGAngleRectifiedToSkewedGrid;
					EPSGCodes[4]=EPSGInitialLineScaleFactor;
					EPSGCodes[5]=EPSGProjCenterEasting; // EPSG proj method 9812 uses EPSGFalseEasting, but 9815 uses EPSGProjCenterEasting
					EPSGCodes[6]=EPSGProjCenterNorthing; // EPSG proj method 9812 uses EPSGFalseNorthing, but 9815 uses EPSGProjCenterNorthing
					return true;

				case coordtrans_t.CT_ObliqueMercator_Laborde:
					projParmId[0]=geokey_t.ProjCenterLatGeoKey;
					projParmId[1]=geokey_t.ProjCenterLongGeoKey;
					projParmId[2]=geokey_t.ProjAzimuthAngleGeoKey;
					projParmId[4]=geokey_t.ProjScaleAtCenterGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGProjCenterLat;
					EPSGCodes[1]=EPSGProjCenterLong;
					EPSGCodes[2]=EPSGAzimuth;
					EPSGCodes[4]=EPSGInitialLineScaleFactor;
					EPSGCodes[5]=EPSGProjCenterEasting;
					EPSGCodes[6]=EPSGProjCenterNorthing;
					return true;

				case coordtrans_t.CT_LambertConfConic_1SP:
				case coordtrans_t.CT_Mercator:
				case coordtrans_t.CT_ObliqueStereographic:
				case coordtrans_t.CT_PolarStereographic:
				case coordtrans_t.CT_TransverseMercator:
				case coordtrans_t.CT_TransvMercator_SouthOriented:
					projParmId[0]=geokey_t.ProjNatOriginLatGeoKey;
					projParmId[1]=geokey_t.ProjNatOriginLongGeoKey;
					projParmId[4]=geokey_t.ProjScaleAtNatOriginGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGNatOriginLat;
					EPSGCodes[1]=EPSGNatOriginLong;
					EPSGCodes[4]=EPSGNatOriginScaleFactor;
					EPSGCodes[5]=EPSGFalseEasting;
					EPSGCodes[6]=EPSGFalseNorthing;
					return true;

				case coordtrans_t.CT_LambertConfConic_2SP:
					projParmId[0]=geokey_t.ProjFalseOriginLatGeoKey;
					projParmId[1]=geokey_t.ProjFalseOriginLongGeoKey;
					projParmId[2]=geokey_t.ProjStdParallel1GeoKey;
					projParmId[3]=geokey_t.ProjStdParallel2GeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGFalseOriginLat;
					EPSGCodes[1]=EPSGFalseOriginLong;
					EPSGCodes[2]=EPSGStdParallel1Lat;
					EPSGCodes[3]=EPSGStdParallel2Lat;
					EPSGCodes[5]=EPSGFalseOriginEasting;
					EPSGCodes[6]=EPSGFalseOriginNorthing;
					return true;

				case coordtrans_t.CT_AlbersEqualArea:
					projParmId[0]=geokey_t.ProjStdParallel1GeoKey;
					projParmId[1]=geokey_t.ProjStdParallel2GeoKey;
					projParmId[2]=geokey_t.ProjNatOriginLatGeoKey;
					projParmId[3]=geokey_t.ProjNatOriginLongGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGStdParallel1Lat;
					EPSGCodes[1]=EPSGStdParallel2Lat;
					EPSGCodes[2]=EPSGFalseOriginLat;
					EPSGCodes[3]=EPSGFalseOriginLong;
					EPSGCodes[5]=EPSGFalseOriginEasting;
					EPSGCodes[6]=EPSGFalseOriginNorthing;
					return true;

				case coordtrans_t.CT_SwissObliqueCylindrical:
					projParmId[0]=geokey_t.ProjCenterLatGeoKey;
					projParmId[1]=geokey_t.ProjCenterLongGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGProjCenterLat;
					EPSGCodes[1]=EPSGProjCenterLong;
					EPSGCodes[5]=EPSGFalseOriginEasting;
					EPSGCodes[6]=EPSGFalseOriginNorthing;
					return true;

				case coordtrans_t.CT_LambertAzimEqualArea:
					projParmId[0]=geokey_t.ProjCenterLatGeoKey;
					projParmId[1]=geokey_t.ProjCenterLongGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGNatOriginLat;
					EPSGCodes[1]=EPSGNatOriginLong;
					EPSGCodes[5]=EPSGFalseEasting;
					EPSGCodes[6]=EPSGFalseNorthing;
					return true;

				case coordtrans_t.CT_CylindricalEqualArea:
					projParmId[0]=geokey_t.ProjStdParallel1GeoKey;
					projParmId[1]=geokey_t.ProjNatOriginLongGeoKey;
					projParmId[5]=geokey_t.ProjFalseEastingGeoKey;
					projParmId[6]=geokey_t.ProjFalseNorthingGeoKey;

					EPSGCodes[0]=EPSGStdParallel1Lat;
					EPSGCodes[1]=EPSGFalseOriginLong;
					EPSGCodes[5]=EPSGFalseOriginEasting;
					EPSGCodes[6]=EPSGFalseOriginNorthing;
					return true;

				default:
					return false;
			}
		}
示例#47
0
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out geodeticdatum_t val, int index)
		{
			return GTIFKeyGet(gtif, thekey, out val, index, 0);
		}