Any person whose driver's license has been refused, revoked, suspended, canceled, or disqualified by the commissioner, except where the license is revoked or disqualified under section 169A.52 or 171.186, may file a petition for a hearing in the matter in the district court in the county wherein such person shall reside and, in the case of a nonresident, in the district court in any county, and such court is hereby vested with jurisdiction, and it shall be its duty, to set the matter for hearing upon 15 days' written notice to the commissioner, and thereupon to take testimony and examine into the facts of the case to determine whether the petitioner is entitled to a license or is subject to revocation, suspension, cancellation, disqualification, or refusal of license, and shall render judgment accordingly. The petition for hearing must either be filed within 180 days of the effective date of the order of revocation, suspension, cancellation, disqualification, or refusal to license or be filed before expiration of the withdrawal period, whichever occurs first. The petition shall be heard by the court without a jury and may be heard in or out of term. The commissioner may appear in person, or by agents or representatives, and may present evidence upon the hearing by affidavit personally, by agents, or by representatives. The petitioner may present evidence by affidavit, except that the petitioner must be present in person at such hearing for the purpose of cross-examination. In the event the department shall be sustained in these proceedings, the petitioner shall have no further right to make further petition to any court for the purpose of obtaining a driver's license until after the expiration of one year after the date of such hearing.