Making script more general so that it runs for datasets other than Natural Earth.
The script uses some metadata key values which are specific only to the Natural Earth dataset. This change enables checking of specific keys before usage to prevent crashes at runtime in case the SHP dataset is not from Natural Earth.