use of uk.me.jstott.jcoord.UTMRef in project eol-globi-data by jhpoelen.
the class StudyImporterForSimons method getOrCreateSampleLocation.
private Location getOrCreateSampleLocation(LabeledCSVParser csvParser, Map<String, String> columnToNormalizedTermMapper) throws StudyImporterException {
Double northing = parseAsDouble(csvParser, columnToNormalizedTermMapper.get(NORTHING));
Double easting = parseAsDouble(csvParser, columnToNormalizedTermMapper.get(EASTING));
Double latitude = null;
Double longitude = null;
if (easting != null && northing != null) {
UTMRef utmRef = new UTMRef(easting, northing, 'R', 16);
LatLng latLng = utmRef.toLatLng();
latitude = latLng.getLat();
longitude = latLng.getLng();
}
Double depth = parseAsDouble(csvParser, columnToNormalizedTermMapper.get(DEPTH));
Double altitude = depth == null ? null : -depth;
try {
return nodeFactory.getOrCreateLocation(new LocationImpl(latitude, longitude, altitude, null));
} catch (NodeFactoryException e) {
throw new StudyImporterException("failed to create location", e);
}
}
use of uk.me.jstott.jcoord.UTMRef in project eol-globi-data by jhpoelen.
the class StudyImporterForSimonsTest method convertLatLongIntoUMT.
@Test
public void convertLatLongIntoUMT() {
LatLng latLng = new LatLng(30.031055, -88.066406);
UTMRef utmRef = latLng.toUTMRef();
assertEquals(397176.66307791235, utmRef.getEasting());
assertEquals(3322705.434795696, utmRef.getNorthing());
assertEquals('R', utmRef.getLatZone());
assertEquals(16, utmRef.getLngZone());
}
Aggregations