How to use "is_null()"?

Hi,

my flex-import using lua is getting better ad better :slight_smile:

using

a.geom = object.as_multipolygon()

somtimes leads to empty geometries, which is ok if the boundary is incomplete or damaged.

I need to filter this releations, but how?

the documentations says

as_multipolygon() 	Create (multi)polygon geometry from OSM way/relation object.

The as_* functions will return a NULL geometry (check with is_null())
if the geometry can not be created for some reason,
for instance a polygon can only be created from closed ways.
This can also happen if your input data is incomplete,
for instance when missing nodes referenced from a way.

but i don’t know how to use that. Tryed a lot but nothing works.

a.geom = object.as_multipolygon()
if a.geom.is_null() then
   a.is_closed = false
else
   a.is_closed = true
end
2022-09-23 15:13:31  [0] ERROR: Failed to execute Lua function 'osm2pgsql.process_relation': lua/global.lua:175: bad argument #1 to 'is_null' (osm2pgsql.Geometry expected, got no value)
stack traceback:
	[C]: in field 'is_null'
	lua/global.lua:175: in function 'process_relation'
	lua/global.lua:199: in function .

Any working example would be nice.

Regards
walter

3 posts - 2 participants

Read full topic


Ce sujet de discussion accompagne la publication sur https://community.openstreetmap.org/t/how-to-use-is-null/2970