use of org.devgateway.ocds.persistence.mongo.Gazetteer in project ocvn by devgateway.
the class LocationRowImporter method importRow.
@Override
public void importRow(final String[] row) throws ParseException {
VNLocation location = repository.findByDescription(getRowCell(row, 0));
if (location != null) {
throw new RuntimeException("Duplicate location name " + getRowCell(row, 0));
}
location = new VNLocation();
location.setId(getRowCell(row, 3));
location.setDescription(getRowCell(row, 0));
GeoJsonPoint coordinates = new GeoJsonPoint(getDouble(getRowCell(row, 2)), getDouble(getRowCell(row, 1)));
location.setGeometry(coordinates);
Gazetteer gazetteer = new Gazetteer();
gazetteer.getIdentifiers().add(getRowCell(row, 3));
location.setGazetteer(gazetteer);
location.setUri(location.getGazetteerPrefix() + getRowCell(row, 3));
repository.insert(location);
}
Aggregations