public Stream GetFEMAInfo(string strAddress) { FEMAData femadata = new FEMAData(); //Get the XY coordinates from the user-entered address Dictionary<string,double> dicCoords = Geocode(strAddress); double x, y = 0; x = dicCoords["x"]; y = dicCoords["y"]; femadata.x = x; femadata.y = y; //Get Panel and Suffix attributes using the Address XY. (Point in Polygon query) Dictionary<string,string> dicPanelSuffix = GetPanelandSuffix(x,y); femadata.Panel = dicPanelSuffix["FIRM_PAN"]; femadata.Suffix = dicPanelSuffix["SUFFIX"]; //Get Hazard Zone attribute using the Address XY. (Point in Polygon query) string strHazardZone = Get_FEMA_attribute(strHazardZoneURL, x, y, "FLD_ZONE"); femadata.HazardZone = strHazardZone; //Get Community ID# attribute using the Address XY. (Point in Polygon query) string strCID = Get_FEMA_attribute(strCIDURL, x, y, "CID"); femadata.CID = strCID; //Serialize to JSON and return string jsonAttributes = new JavaScriptSerializer().Serialize(femadata); byte[] resultBytes = Encoding.UTF8.GetBytes(jsonAttributes); WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain"; return new MemoryStream(resultBytes); }
public Stream GetFEMAInfo(string strAddress) { FEMAData femadata = new FEMAData(); //Get the XY coordinates from the user-entered address Dictionary <string, double> dicCoords = Geocode(strAddress); double x, y = 0; x = dicCoords["x"]; y = dicCoords["y"]; femadata.x = x; femadata.y = y; //Get Panel and Suffix attributes using the Address XY. (Point in Polygon query) Dictionary <string, string> dicPanelSuffix = GetPanelandSuffix(x, y); femadata.Panel = dicPanelSuffix["FIRM_PAN"]; femadata.Suffix = dicPanelSuffix["SUFFIX"]; //Get Hazard Zone attribute using the Address XY. (Point in Polygon query) string strHazardZone = Get_FEMA_attribute(strHazardZoneURL, x, y, "FLD_ZONE"); femadata.HazardZone = strHazardZone; //Get Community ID# attribute using the Address XY. (Point in Polygon query) string strCID = Get_FEMA_attribute(strCIDURL, x, y, "CID"); femadata.CID = strCID; //Serialize to JSON and return string jsonAttributes = new JavaScriptSerializer().Serialize(femadata); byte[] resultBytes = Encoding.UTF8.GetBytes(jsonAttributes); WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain"; return(new MemoryStream(resultBytes)); }