コード例 #1
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out coordtrans_t val, int index, int count)
 {
     // ignore count
     val = 0;
     ushort[] vals;
     if (GTIFKeyGet(gtif, thekey, out vals, index, 1) == 0)
     {
         return(0);
     }
     val = (coordtrans_t)vals[0];
     return(1);
 }
コード例 #2
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;
			}
		}
コード例 #3
0
ファイル: geo_set.cs プロジェクト: plynkus/libgeotiff.net
 public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, coordtrans_t val)
 {
     ushort[] val1 = new ushort[] { (ushort)val };
     return(GTIFKeySet(gtif, keyID, val1));
 }
コード例 #4
0
 public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out coordtrans_t val, int index)
 {
     return(GTIFKeyGet(gtif, thekey, out val, index, 0));
 }
コード例 #5
0
ファイル: geo_set.cs プロジェクト: LogoPhonix/libgeotiff.net
		public static bool GTIFKeySet(GTIF gtif, geokey_t keyID, coordtrans_t val)
		{
			ushort[] val1=new ushort[] { (ushort)val };
			return GTIFKeySet(gtif, keyID, val1);
		}
コード例 #6
0
ファイル: geo_get.cs プロジェクト: LogoPhonix/libgeotiff.net
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out coordtrans_t val, int index)
		{
			return GTIFKeyGet(gtif, thekey, out val, index, 0);
		}
コード例 #7
0
ファイル: geo_get.cs プロジェクト: LogoPhonix/libgeotiff.net
		public static int GTIFKeyGet(GTIF gtif, geokey_t thekey, out coordtrans_t val, int index, int count)
		{
			// ignore count
			val=0;
			ushort[] vals;
			if(GTIFKeyGet(gtif, thekey, out vals, index, 1)==0) return 0;
			val=(coordtrans_t)vals[0];
			return 1;
		}