Package com.drew.lang

Examples of com.drew.lang.GeoLocation


public class GeoPointExtractor {

    public static GeoPoint getGeoPoint(Metadata metadata) {
        GpsDirectory gpsDir = metadata.getDirectory(GpsDirectory.class);
        if (gpsDir != null) {
            GeoLocation geoLocation = gpsDir.getGeoLocation();
            if (geoLocation != null) {
                Double latitude = geoLocation.getLatitude();
                Double longitude = geoLocation.getLongitude();
                Double altitude = null;
                try {
                    altitude = gpsDir.getDouble(GpsDirectory.TAG_GPS_ALTITUDE);
                } catch (MetadataException e) {
                    //No code needed. Altitude is already null.
View Full Code Here


    static class GeotagHandler implements DirectoryHandler {
        public boolean supports(Class<? extends Directory> directoryType) {
            return directoryType == GpsDirectory.class;
        }
        public void handle(Directory directory, Metadata metadata) throws MetadataException {
            GeoLocation geoLocation = ((GpsDirectory) directory).getGeoLocation();
            if (geoLocation != null) {
                DecimalFormat geoDecimalFormat = new DecimalFormat(GEO_DECIMAL_FORMAT_STRING,
                        new DecimalFormatSymbols(Locale.ENGLISH));
                metadata.set(TikaCoreProperties.LATITUDE, geoDecimalFormat.format(new Double(geoLocation.getLatitude())));
                metadata.set(TikaCoreProperties.LONGITUDE, geoDecimalFormat.format(new Double(geoLocation.getLongitude())));
            }
        }
View Full Code Here

    }

    @Nullable
    public String getGpsLatitudeDescription()
    {
        GeoLocation location = _directory.getGeoLocation();

        if (location == null)
            return null;

        return GeoLocation.decimalToDegreesMinutesSecondsString(location.getLatitude());
    }
View Full Code Here

    }

    @Nullable
    public String getGpsLongitudeDescription()
    {
        GeoLocation location = _directory.getGeoLocation();

        if (location == null)
            return null;

        return GeoLocation.decimalToDegreesMinutesSecondsString(location.getLongitude());
    }
View Full Code Here

    }

    @Nullable
    public String getDegreesMinutesSecondsDescription()
    {
        GeoLocation location = _directory.getGeoLocation();

        if (location == null)
            return null;

        return location.toDMSString();
    }
View Full Code Here

        // This can return null, in cases where the conversion was not possible
        if (lat == null || lon == null)
            return null;

        return new GeoLocation(lat, lon);
    }
View Full Code Here

            // See whether it has GPS data
            GpsDirectory gpsDirectory = metadata.getDirectory(GpsDirectory.class);
            if (gpsDirectory == null)
                continue;
            // Try to read out the location, making sure it's non-zero
            GeoLocation geoLocation = gpsDirectory.getGeoLocation();
            if (geoLocation == null || geoLocation.isZero())
                continue;
            // Add to our collection for use below
            photoLocations.add(new PhotoLocation(geoLocation, file));
        }
View Full Code Here

        // This can return null, in cases where the conversion was not possible
        if (lat == null || lon == null)
            return null;

        return new GeoLocation(lat, lon);
    }
View Full Code Here

    }

    @Nullable
    public String getGpsLatitudeDescription()
    {
        GeoLocation location = _directory.getGeoLocation();
        return location == null ? null : GeoLocation.decimalToDegreesMinutesSecondsString(location.getLatitude());
    }
View Full Code Here

    }

    @Nullable
    public String getGpsLongitudeDescription()
    {
        GeoLocation location = _directory.getGeoLocation();
        return location == null ? null : GeoLocation.decimalToDegreesMinutesSecondsString(location.getLongitude());
    }
View Full Code Here

TOP

Related Classes of com.drew.lang.GeoLocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.