Source:
private Metacard transformGeoEntryToMetacard(GeoEntry geoEntry) { if (!GeoCodingConstants.CITY_FEATURE_CODES.contains(geoEntry.getFeatureCode())) { return null; } Metacard metacard = new MetacardImpl(geoNamesMetacardType); String id = uuidGenerator.generateUuid(); metacard.setAttribute( new AttributeImpl( Core.TITLE, String.format(TITLE_FORMAT, geoEntry.getName(), geoEntry.getCountryCode()))); metacard.setAttribute(new AttributeImpl(Core.DESCRIPTION, geoEntry.getAlternateNames())); metacard.setAttribute(new AttributeImpl(Location.COUNTRY_CODE, geoEntry.getCountryCode())); metacard.setAttribute(new AttributeImpl(Core.ID, id)); metacard.setAttribute( new AttributeImpl( GeoEntryAttributes.FEATURE_CODE_ATTRIBUTE_NAME, geoEntry.getFeatureCode())); metacard.setAttribute( new AttributeImpl(GeoEntryAttributes.POPULATION_ATTRIBUTE_NAME, geoEntry.getPopulation())); if (StringUtils.isNotBlank(geoEntry.getImportLocation())) { metacard.setAttribute( new AttributeImpl(GeoEntryAttributes.IMPORT_LOCATION, geoEntry.getImportLocation())); } Double latitude = geoEntry.getLatitude(); Double longitude = geoEntry.getLongitude(); if (latitude != null && longitude != null) { Coordinate coordinate = new Coordinate(longitude, latitude); Geometry geometry = new GeometryFactory().createPoint(coordinate); String wkt = WKT_WRITER_THREAD_LOCAL.get().write(geometry); metacard.setAttribute(new AttributeImpl(Core.LOCATION, wkt)); } metacard.setAttribute( new AttributeImpl( Core.METACARD_TAGS, Arrays.asList(GAZETTEER_METACARD_TAG, GeoCodingConstants.GEONAMES_TAG))); return metacard; }

Target:
private Metacard transformGeoEntryToMetacard(GeoEntry geoEntry) { if (!GeoCodingConstants.CITY_FEATURE_CODES.contains(geoEntry.getFeatureCode())) { return null; } Metacard metacard = new MetacardImpl(geoNamesMetacardType); String id = uuidGenerator.generateUuid(); metacard.setAttribute( new AttributeImpl( Core.TITLE, String.format(TITLE_FORMAT, geoEntry.getName(), geoEntry.getCountryCode()))); metacard.setAttribute(new AttributeImpl(Core.DESCRIPTION, geoEntry.getAlternateNames())); metacard.setAttribute(new AttributeImpl(Location.COUNTRY_CODE, geoEntry.getCountryCode())); metacard.setAttribute(new AttributeImpl(Core.ID, id)); metacard.setAttribute( new AttributeImpl( GeoEntryAttributes.FEATURE_CODE_ATTRIBUTE_NAME, geoEntry.getFeatureCode())); Integer gazetteerSortValue = getGeoNameGazetterSortByFeatureClass(geoEntry); if (gazetteerSortValue != null) { metacard.setAttribute( new AttributeImpl( GeoEntryAttributes.GAZETTEER_SORT_VALUE, gazetteerSortValue.intValue())); } else { metacard.setAttribute( new AttributeImpl(GeoEntryAttributes.GAZETTEER_SORT_VALUE, geoEntry.getPopulation())); } metacard.setAttribute( new AttributeImpl(GeoEntryAttributes.POPULATION_ATTRIBUTE_NAME, geoEntry.getPopulation())); if (StringUtils.isNotBlank(geoEntry.getImportLocation())) { metacard.setAttribute( new AttributeImpl(GeoEntryAttributes.IMPORT_LOCATION, geoEntry.getImportLocation())); } Double latitude = geoEntry.getLatitude(); Double longitude = geoEntry.getLongitude(); if (latitude != null && longitude != null) { Coordinate coordinate = new Coordinate(longitude, latitude); Geometry geometry = new GeometryFactory().createPoint(coordinate); String wkt = WKT_WRITER_THREAD_LOCAL.get().write(geometry); metacard.setAttribute(new AttributeImpl(Core.LOCATION, wkt)); } metacard.setAttribute( new AttributeImpl( Core.METACARD_TAGS, Arrays.asList(GAZETTEER_METACARD_TAG, GeoCodingConstants.GEONAMES_TAG))); return metacard; }