(1) Use osm2pgsql, imposm3 or a similar tool to import only ways that are tagged highway=* (and not motor_vehicle=no). Both of these tools can use custom style sheets to specify in great detail what objects to import, and what tags should correspond with columns in the database.

(2) Use the PostGIS function to divide linestrings into segments of the desired length. This is a little tricky, but there's a worked example at https://postgis.net/docs/ST_LineSubstring.html (which makes 100-unit strings) that you can adapt.

I don't understand exactly what it is you want to do with 'crossroads intersection'. If by this you mean, that no segment of a road should continue past an intersection with another road, then it sounds as if you are trying to create a routing graph (and your mention of 'studying graph theory' suggests this, too). In that case, you might want to investigate the pgRouting extension to PostGIS. There's a fairly gentle introduction at https://workshop.pgrouting.org/2.0.2/en/index.html

]]>Please tell me how to solve 3 problems:

- 1: from the maps (for example, from the monaco.osm.pbf map), take only roads, without parks, squares, houses, in general, only what the car can move on.

- 2: All roads are automatically, by algorithm, divided into segments of a length of 1 kilometer (or less, for the last segment) without adjacent intersections.

For example, all roads should be divided into segments from the crossroads intersection, then all large segments should be divided into smaller ones with a distance of 1 kilometer or less.

-3: How to put all the segments in the database, for example, Postgress under different indices?

Is there a software product that can solve this problem of dividing roads into segments without studying graph theory and going into higher mathematics?

]]>