bounding polygons?

Hi folks,

i’m looking for bounding polygons of
-regisn and cities of the whole planet

is there a way to get them here or elsewhere


Must that be very poly? How many points?

Wouldn’t a rectangle do like here for Bulgaria:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> Track Export segment 1

I do not know where you can get them. To get this one I first extracted the boundary of Bulgaria from osm data and then determined minlat,minlon and maxlat,maxlon. In fact you only have to know the coordinates of two points if you are interested in a boundig box around a country.

Thanks for your reply,

Rectangles are to inaccurate for my use cases.
need some approximate boundaries, i gonna process the planet file
and write the output in databases. from there i want to select data using bounding polygons,
so i need them. I’m looking for a download locatiion for these polygons or some way to
generate them automatically by processing osm data or other stuff

best regards

Have a look at:

You can extract the country boundaries very precise from osm data. First find out the Id of the which describes the boundary. Then download that relation and recursively download the relations, ways and nodes that it describes. Just extract the lat,lon from the nodes. You will get a lot af ways wich build the boundary. You will mostly have to do some sorting of ways and reversing of individual ways befor you have a nice closed loop frontier.

osm2pgsql do this allready. (But it lacks support for relations composed of relations)

thank you guys, thats exacly what i was looking for, are these relations the same polygons used by used for extracting regions, cities and countries. Need these boundaries to define a cost function for edges of a routing graph so it is important to have good boundaries of cities and small towns, does someone know if these boundaries are suitable for that use case?

best regards

The boundary files that you find at geofabrik are used by themselves too as far as i know. They are not always as precise as the borders described by osm. Of course you cannot use them for towns as they describe countries.