Hi, I am an experienced person in this direction. At one time, I made maps based on the “megapixel” format, also known as the “Polish” format. This is a fairly simple format for understanding and there are converters from the OSM in it, but it is not very convenient to render it, just like the bare OSM itself (OSM is actually much more complicated).
First, you define a couple of functions: the transformation of latitude / longitude into screen pixels and back. Somewhere here you can use formulas for various projections, for example, often choose the Mercator projection. If the projection or the task allows, then all coordinates can be transformed into screen coordinates at once - it will be faster and more convenient to work.
Then you take points from your map, transform it into screen coordinates, and if it is on the screen, you draw on the canvas / scene that you have there. If behind the screen - it is better not to draw. To make it work faster, you make an index based on p-three or quad-three.
Drawing lines and polygons follows the same principle, but there is a nuance: a line, and even more so a polygon must be drawn even if it goes beyond the boundaries of the screen. Therefore, it is wiser to first break the map into small areas, with polygon recalculation. Roughly speaking, if we have a huge lake, then after splitting it will become a bunch of small rectangles with simple polygons along the edges, which can be rendered easier and in case of going beyond the screen boundaries, the losses will be minimal.
Polygons can be pre-packaged in a fan or snake sequence, which may give a little advantage when working with some hardware, but nowadays, I think, it does not have a big role. This I used to pick out performance like that.
Well, in general, all that is necessary is already there. It remains to write the indexer, which will lay out the cut lines and polygons in different areas, some kind of optimizer, so that at different scales the points merging into a single whole thinned out, and the benchmark will not get tired of it yet. Work with the profiler continues until there are more or less smooth animations or it does not get bored.
Add inscriptions on top (it is more convenient to store them in a separate layer), some icons, markers, and so on, and if we draw all this in full screen, above all we draw our own goo. Everything, the application works, there is a map, we are not dependent on anyone.