def apply_field_map_if_exists(self, field_map_path, out_dataset_name): """ Check if there's a field map to go from the country specific data to global data :param field_map_path: path to the fieldmap, should be formatted: D:\path\to\field\map.ini\{ISO} :param out_dataset_name: name of the output; used to create a feature layer with a unique name :return: the source dataset to use when appending to the global layer """ # Check if there's a fieldmap to go from country to global layer if field_map_path: # Build the actual .ini path, replacing {ISO} with the country value ini_path = field_map_path.replace('{ISO}', self.add_country_value) field_map_dict = field_map.get_ini_dict(ini_path) out_dir = os.path.join(self.scratch_workspace, 'country_to_global_fms') # Apply field map, set country_src to this new FC country_src = field_map.ini_fieldmap_to_fc( self.esri_service_output, out_dataset_name, field_map_dict, out_dir) # If no field map, just use the output from the country layer that we just processed else: country_src = self.esri_service_output return country_src
def apply_field_map_if_exists(self, field_map_path, out_dataset_name): """ Check if there's a field map to go from the country specific data to global data :param field_map_path: path to the fieldmap, should be formatted: D:\path\to\field\map.ini\{ISO} :param out_dataset_name: name of the output; used to create a feature layer with a unique name :return: the source dataset to use when appending to the global layer """ # Check if there's a fieldmap to go from country to global layer if field_map_path: # Build the actual .ini path, replacing {ISO} with the country value ini_path = field_map_path.replace('{ISO}', self.add_country_value) field_map_dict = field_map.get_ini_dict(ini_path) out_dir = os.path.join(self.scratch_workspace, 'country_to_global_fms') # Apply field map, set country_src to this new FC country_src = field_map.ini_fieldmap_to_fc(self.esri_service_output, out_dataset_name, field_map_dict, out_dir) # If no field map, just use the output from the country layer that we just processed else: country_src = self.esri_service_output return country_src
def field_map(self, m): """ Validates a field map if it exists :param m: D:\path\to\fieldmap.ini\{keyname} :return: """ if m: # Insert this so that global_vector layers can pass validation checks # These layers may have fieldmaps associated, but they are really for the # input country vector datasets to use in meeting the schema of the global layers if self.layer_type == 'global_vector': m = None else: m = field_map.get_ini_dict(m) else: m = None self._field_map = m