Create bbox with lua

Hi,

is there a way to create the bbox of an object (mostly relations) in lua?

regards

walter

Note that the same question was asked on talk mailing list.

If you multipost, please mention that (may apply less if done in two entirely different places but definitely applies if done nearly at the same time in two communication channels in single project).

Have you asked - and maybe got answer already - also somewhere else?

Also, as I asked on talk:

Which part is hard for you?

Installing lua?
Downloading osm data?
Parsing OSM data?
Getting location of elements of relation?
Finding bbox from lat lon list?
Something else?

1 Like

The object is an osm-xml file?

waited for one day and discovered the usage is very low on this (old) talk-list.

don’t see any answer on osm-talk.

to create the bbox of an object (mostly relations) from it’s geometry (geom) using osm2pgsql

just asking silly questions and not giving any hint won’t help anybody.
i would have asked other question for any other subject in you “answer” :frowning:

  • wambacher -

Indirectly. I have been using LUA successfully in osm2pgsql for more than 2 years.

And now i “suddenly” need the bbox.

My current solution is a postgresql trigger on a table but i would prefer a more direct and transparent solution.

Regards
walter

I have a need for something similar, and do it by munging the data using osmium based tools prior to loading it.

Not an answer to the question but may be a workaround.

For osm2pgsql flex use the get_bbox() function. It has been working for all OSM types including relations since version 1.7. The only exception are nested relations. See the Processing Callbacks section in the manual for more information. Or have a look at the bbox example.

2 Likes

Thanks.

Have been reading the doc twice, but missed that chapter :frowning:

Regards
walter

1 Like