I am new to OSM. I have created an osm server and installed one UK county in the database. It’s not a powerful server but has quite a lot of disk space so I have pre-rendered the county to zoom level 15. That’s the max I need. It all seems to work but I would prefer to have less information on the map. i.e. no footpaths, no road numbers, no tram routes, no hospitals etc. I am not sure if I need to import a different file without this data (where would I get it?) or render with different options (what is the command?). Also is there a easy way to calculate the road distance from one point to another using Ways.
Which style do you use? In the case of a standard map (which uses osm-carto) you can try to identify and remove relevant portions of the code. It might be a problem in the future if you want to keep updating it, but such fork should be quite easy to maintain.
But maybe you need something much lighter - then you can use some other style, like OSM Bright for example: https://github.com/mapbox/osm-bright .
For distance, ignoring roads close to the poles or that cross longitude 180, take take each consecutive pair of coordinates for the construction nodes, using degrees versions of functions, calculate sqrt(lat**2 + (long*(cos(lat))**2). Sum for the whole road. Then multiply by pi * R / 180, where R is the radius of the earth.
This does not correct for the oblateness of the earth, and assumes that construction nodes are sufficiently close together that euclidean geometry can be used for each pair, even though it allows for spherical geometry for the full way. It also gives the distance projected onto a flat surface at mean sea level. It doesn’t correct for slopes or for the greater effective radius at higher altitudes. OSM doesn’t contain the information needed to do that.
In the “OSM Carto” style the style rendering of things like tram routes is in https://github.com/gravitystorm/openstreetmap-carto/blob/master/roads.mss - if you search that for “tram” you see there are 3 or 4 sections that mention it. It can be tricky working out what all the sections mean. but “removing all references to X” is easier provided that the brackets still match afterwards. Search the *.mss files for other tag names to see where they’re dealt with. There’s also https://github.com/gravitystorm/openstreetmap-carto/blob/master/project.mml that handles selection of data to throw at each layer (.mss file), editing that is (in my experience) trickier to get right first time.
If you’re using a different carto-based style then the file names will differ but the principle will be the same, but if you’re using a different technology altogether then yo’d need to provide more details.