Holger's Java API

## com.antelmann.math
Class GeoPoint

    java.lang.Object
      com.antelmann.math.GeoPoint

All Implemented Interfaces:
  XMLSerializable, Addable<GeoPoint>, GeoEncoded, Serializable

    public class GeoPoint

extends Object
implements Serializable, Addable<GeoPoint>, GeoEncoded, XMLSerializable

an immutable representation of a location on earth.

Since:
  27.03.2009, 17:03:49
Author:
  Holger Antelmann
See Also:
  Serialized Form

Constructor Summary
`GeoPoint(BigDecimal latitude, BigDecimal longitude)`
`GeoPoint(BigDecimal latitude, BigDecimal longitude, BigDecimal altitude)`
`GeoPoint(double latitude, double longitude)`
`GeoPoint(double latitude, double longitude, double altitude)`
`GeoPoint(Number latitude, Number longitude)`
`GeoPoint(Number latitude, Number longitude, Number altitude)`
`GeoPoint(String latitudeAndLongitude)`
`GeoPoint(String latitude, String longitude)`
`GeoPoint(String latitude, String longitude, String altitude)`

Method Summary
`GeoPoint` `add(GeoPoint other)` 'shifts' this point relative to the other given point by all 3 dimensions
`GeoPoint` `difference(GeoPoint other)` adding the return value to to the given other point would result in an instance equal to this
`static double` `distance(GeoPoint gp1, GeoPoint gp2)` returns the flat distance in kilometers - disregarding the altitude.
`double` `distanceTo(GeoPoint gp)`
`boolean` `equals(Object obj)`
`void` `exportXML(OutputStream out)` exports the entire object as XML and writes it to the given Writer, so that the object can be reconstructed with `importXML(InputSource)`.
`BigDecimal` `getAltitude()`
`GeoPoint` `getGeoPoint()`
`BigDecimal` `getLatitude()`
`BigDecimal` `getLongitude()`
`URL` `googleURL()`
`int` `hashCode()`
`void` `importXML(InputStream source)` The object is fully reinitialized with the XML data contained in the given ImputSource, so that the object has the same state as it had during export.
`URL` `openStreetMapURL()`
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### GeoPoint

    public GeoPoint(String latitudeAndLongitude)
             throws FormatException

Throws:
  `FormatException`

### GeoPoint

    public GeoPoint(String latitude,
                    String longitude)
             throws FormatException

Throws:
  `FormatException`

### GeoPoint

    public GeoPoint(String latitude,
                    String longitude,
                    String altitude)
             throws FormatException

Throws:
  `FormatException`

### GeoPoint

    public GeoPoint(Number latitude,
                    Number longitude)

### GeoPoint

    public GeoPoint(Number latitude,
                    Number longitude,
                    Number altitude)

### GeoPoint

    public GeoPoint(double latitude,
                    double longitude)

### GeoPoint

    public GeoPoint(double latitude,
                    double longitude,
                    double altitude)

### GeoPoint

    public GeoPoint(BigDecimal latitude,
                    BigDecimal longitude)

### GeoPoint

    @ConstructorProperties(value={"latitude","longitude","altitude"})
    public GeoPoint(BigDecimal latitude,
                                               BigDecimal longitude,
                                               BigDecimal altitude)

Method Detail

### getGeoPoint

    public GeoPoint getGeoPoint()

  Specified by:
    `getGeoPoint` in interface `GeoEncoded`

### getLatitude

    public final BigDecimal getLatitude()

### getLongitude

    public final BigDecimal getLongitude()

### getAltitude

    public final BigDecimal getAltitude()

### exportXML

    public void exportXML(OutputStream out)
                   throws IOException

  Description copied from interface: `XMLSerializable`
  exports the entire object as XML and writes it to the given Writer, so that the object can be reconstructed with `importXML(InputSource)`. The given stream is neither flushed nor closed, so that other data may be effectively written to the InputSource after the method returned.

  Specified by:
    `exportXML` in interface `XMLSerializable`
  Throws:
    `IOException`
  See Also:
    `XMLSerializable.importXML(InputStream)`

### importXML

    @Warning(value="calling this method breaks the contract of this class being immutable")
    public void importXML(InputStream source)
                   throws SAXException,
                          IOException

  Description copied from interface: `XMLSerializable`
  The object is fully reinitialized with the XML data contained in the given ImputSource, so that the object has the same state as it had during export.

  Specified by:
    `importXML` in interface `XMLSerializable`
  Throws:
    `SAXException`
    `IOException`
  See Also:
    `XMLSerializable.exportXML(OutputStream)`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### add

    public GeoPoint add(GeoPoint other)

  'shifts' this point relative to the other given point by all 3 dimensions

  Specified by:
    `add` in interface `Addable<GeoPoint>`
  See Also:
    `difference(GeoPoint)`

### difference

    public GeoPoint difference(GeoPoint other)

  adding the return value to to the given other point would result in an instance equal to this

  See Also:
    `add(GeoPoint)`

### distanceTo

    public double distanceTo(GeoPoint gp)

  See Also:
    `distance(GeoPoint, GeoPoint)`

### distance

    public static double distance(GeoPoint gp1,
                                  GeoPoint gp2)

  returns the flat distance in kilometers - disregarding the altitude. This code is based on public domain samples from www.zipcodeworld.com.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### openStreetMapURL

    public URL openStreetMapURL()

### googleURL

    public URL googleURL()

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads