Building polygons from db