An apparatus (400; 500) comprising at least one processor (452; 502) and at least one memory (454; 504) including a computer program code, wherein the at least one memory (454; 504) and the computer program code are configured, with the at least one processor (452; 502), to cause the apparatus (400; 500) to perform operations comprising: acquiring indoor non-labeled Earth's magnetic field, EMF, data sets representing at least one of magnitude and direction of the EMF in a building from a plurality of mobile devices, wherein routes corresponding to the non-labeled EMF data sets in the building are unknown, and wherein locations of respective measurements are unknown in the non-labeled EMF data sets; acquiring motion data sets from the plurality of mobile devices; estimating route models of the travelled routes on the basis of the motion data sets, wherein the estimated route models indicate estimated paths of the travelled routes; generating EMF fingerprints for the travelled routes by associating the acquired EMF data sets with corresponding points of the route models; clustering the plurality of the mobile devices geographically on the basis of the generated EMF fingerprints; determining the locations of the travelled routes with respect to each other among mobile devices of the same cluster on the basis of at least one of the following: i) by identifying substantially similar EMF fingerprints at one part of two route models that is denoted as a common part and deciding that the two route models overlap at the common part, and ii) by detecting that shapes of two route models are substantially similar for a part of the two route models and determining that the similar parts of the two route models overlap; and generating an EMF map of the building on the basis of the locations of the travelled routes of the clustered mobile devices with respect to each other and the EMF fingerprints. acquiring indoor non-labeled Earth's magnetic field, EMF, data sets representing at least one of magnitude and direction of the EMF in a building from a plurality of mobile devices, wherein routes corresponding to the non-labeled EMF data sets in the building are unknown, and wherein locations of respective measurements are unknown in the non-labeled EMF data sets; acquiring motion data sets from the plurality of mobile devices; estimating route models of the travelled routes on the basis of the motion data sets, wherein the estimated route models indicate estimated paths of the travelled routes; generating EMF fingerprints for the travelled routes by associating the acquired EMF data sets with corresponding points of the route models; clustering the plurality of the mobile devices geographically on the basis of the generated EMF fingerprints; determining the locations of the travelled routes with respect to each other among mobile devices of the same cluster on the basis of at least one of the following: i) by identifying substantially similar EMF fingerprints at one part of two route models that is denoted as a common part and deciding that the two route models overlap at the common part, and ii) by detecting that shapes of two route models are substantially similar for a part of the two route models and determining that the similar parts of the two route models overlap; and generating an EMF map of the building on the basis of the locations of the travelled routes of the clustered mobile devices with respect to each other and the EMF fingerprints.