Converting longitude/latitude to X/Y coordinate

The big issue with plotting maps is that the spherical surface of the Earth cannot be conveniently converted into a flat representation. There are a bunch of different projections that attempt to resolve this. Mercator is one of the simplest: it assumes that lines of equal latitude are parallel horizontals, while lines of equal longitude … Read more

How to make stroke width immune to the current transformation matrix

Edit: There is an attribute you can add to your rect to get exactly this behavior: vector-effect=”non-scaling-stroke” This was wrong: This will work if you apply the transform directly to the shape, not the group it is in. Of course, if you wanted to group several items and scale them all together, that approach won’t … Read more

How to set transform origin in SVG

To rotate use transform=”rotate(deg, cx, cy)”, where deg is the degree you want to rotate and (cx, cy) define the centre of rotation. For scaling/resizing, you have to translate by (-cx, -cy), then scale and then translate back to (cx, cy). You can do this with a matrix transform: transform=”matrix(sx, 0, 0, sy, cx-sx*cx, cy-sy*cy)” … Read more