Example #1
0
        public string MakeSearchQuery()
        {
            //Returns a url string for querying the TNS website

            //figure out site location
            string scrubbedTargetName       = ScrubSmallBodyName(TgtName);
            string siteLong                 = (360 - MPC_Observatory.BestObservatory.MySiteLong).ToString("0.000"); //converted to the 0-360 form that MPC likes it
            string siteLat                  = MPC_Observatory.BestObservatory.MySiteLat.ToString("0.000");
            string siteElev                 = MPC_Observatory.BestObservatory.MySiteElev.ToString("0.000");
            string center                   = siteLong + ":" + siteLat + ":" + siteElev;
            string startTime                = EphStart.ToString("yyyy-MMM-dd");
            string endTime                  = EphEnd.ToString("yyyy-MMM-dd");
            NameValueCollection queryString = System.Web.HttpUtility.ParseQueryString(string.Empty);

            queryString[hFormat]         = hFormatTypeText;
            queryString[hCommand]        = "\'NAME=" + scrubbedTargetName + "\'"; // ";" means that it is a small body search for name
            queryString[hMakeEphemeris]  = hYes;
            queryString[hEphemerisType]  = hObserverType;
            queryString[hCenter]         = "399";     //Earth
            queryString[hSiteCoordinate] = center;    //e-long(degrees):lat(degrees):elevation(km)
            queryString[hStartTime]      = startTime; // "2021-01-12";
            queryString[hStopTime]       = endTime;   // "2021-01-13";
            queryString[hStepSize]       = "1m";      // shortest time that horizons can do
            queryString[hAngleFormat]    = hAngleFormatDegrees;
            queryString[hTimeDigits]     = "Seconds";
            //queryString[hQuantities ] = "'1,9,20,23,24,29'";
            queryString[hOutUnits]             = hUnitTypeKMS;
            queryString[hExtraPrecisionFormat] = hYes;
            string q = queryString.ToString();

            //fix bug where queryString inserts %2f instead of %2F for the "/" char
            q = q.Replace("%2f", "%2F");
            return(q); // Returns "key1=value1&key2=value2", all URL-encoded
        }
Example #2
0
        private string MakeSearchQuery(string tgtName, string mpc_observatory_code = "500")
        {
            //Returns a url query string for Scout website
            // "key1=value1&key2=value2", all URL-encoded
            // MPC observation code is optional.  If not filled in, then geocentric is used.

            NameValueCollection queryString = System.Web.HttpUtility.ParseQueryString(string.Empty);

            queryString["tdes"]      = tgtName;
            queryString["n-orbits"]  = "1";
            queryString["eph-start"] = EphStart.ToString("yyyy-MM-ddTHH:mm:ss");
            queryString["eph-stop"]  = EphEnd.ToString("yyyy-MM-ddTHH:mm:ss");
            queryString["eph-step"]  = EphStep.Minutes.ToString("0") + "m";
            queryString["obs-code"]  = mpc_observatory_code;
            queryString["ranges"]    = "true";
            return(queryString.ToString());
        }