[1.6.x] Isolated map creation JS code

Backport of 3550b27a8 from master.
[1.6.x] Fixed #21003 -- Ensured geometry widget return value has SRID

Thanks Mathieu Leplatre for the report and initial patch.
Backport of dd656073ad from master.