Search in sources :

Example 1 with Gazetteer

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);
}
Also used : VNLocation(org.devgateway.ocvn.persistence.mongo.dao.VNLocation) Gazetteer(org.devgateway.ocds.persistence.mongo.Gazetteer) GeoJsonPoint(org.springframework.data.mongodb.core.geo.GeoJsonPoint)

Aggregations

Gazetteer (org.devgateway.ocds.persistence.mongo.Gazetteer)1 VNLocation (org.devgateway.ocvn.persistence.mongo.dao.VNLocation)1 GeoJsonPoint (org.springframework.data.mongodb.core.geo.GeoJsonPoint)1