In-plane heterostructures of hexagonal boron nitride (h-BN) and graphene (Gr) have recently appeared in the focus of material science research owing to their intriguing and tunable electronic properties. However, disclosure of the atomic structure and properties of one-dimensional heterojunctions between Gr and h-BN domains remains a largely unexplored and challenging task. Here, we report an approach to obtain a perfectly oriented and atomically thin hybrid h-BN-Gr heterolayer on the Co(0001) surface. A perfect matching of the lattice parameters ensures an epitaxial growth of both Gr and h-BN on the close-packed Co surface. High crystalline quality of the resulting interface allowed to uncover the structural and electronic properties of the lateral h-BN/Gr heterojunctions by means of complementary microscopic and spectroscopic techniques. In particular, we established the coexistence of two types of zigzag boundaries made of B-C bonds, while the boundaries with N-C bonds were found to be unfavorable. Observation of spin-polarized edge states at the C-zigzag edges of Gr domains allowed us to determine the atomic structure of C-BN heterojunctions with scanning tunneling microscopy.