builing path dynamically based on bounding box