org.apache.lucene.geo

## Class Line

- java.lang.Object
- - org.apache.lucene.geo.LatLonGeometry
  - - org.apache.lucene.geo.Line

-     public class Line
      extends LatLonGeometry

  Represents a line on the earth's surface. You can construct the Line directly with `double[]` coordinates.

  NOTES:

  1. All latitude/longitude values must be in decimal degrees.
  2. For more advanced GeoSpatial indexing and query operations see the `spatial-extras` module

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `double` | `maxLat` maximum latitude of this line's bounding box
    `double` | `maxLon` maximum longitude of this line's bounding box
    `double` | `minLat` minimum latitude of this line's bounding box
    `double` | `minLon` minimum longitude of this line's bounding box

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Line(double[] lats, double[] lons)` Creates a new Line from the supplied latitude/longitude array.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `double` | `getLat(int vertex)` Returns latitude value at given index
    `double[]` | `getLats()` Returns a copy of the internal latitude array
    `double` | `getLon(int vertex)` Returns longitude value at given index
    `double[]` | `getLons()` Returns a copy of the internal longitude array
    `int` | `hashCode()`
    `int` | `numPoints()` returns the number of vertex points
    `protected Component2D` | `toComponent2D()` get a `Component2D` from this geometry
    `String` | `toGeoJSON()` prints lines as geojson
    `String` | `toString()`

    - ### Methods inherited from class org.apache.lucene.geo.LatLonGeometry

      `create`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### minLat

          public final double minLat

      minimum latitude of this line's bounding box

    - #### maxLat

          public final double maxLat

      maximum latitude of this line's bounding box

    - #### minLon

          public final double minLon

      minimum longitude of this line's bounding box

    - #### maxLon

          public final double maxLon

      maximum longitude of this line's bounding box

  - ### Constructor Detail

    - #### Line

          public Line(double[] lats,
                      double[] lons)

      Creates a new Line from the supplied latitude/longitude array.

  - ### Method Detail

    - #### numPoints

          public int numPoints()

      returns the number of vertex points

    - #### getLat

          public double getLat(int vertex)

      Returns latitude value at given index

    - #### getLon

          public double getLon(int vertex)

      Returns longitude value at given index

    - #### getLats

          public double[] getLats()

      Returns a copy of the internal latitude array

    - #### getLons

          public double[] getLons()

      Returns a copy of the internal longitude array

    - #### toComponent2D

          protected Component2D toComponent2D()

      Description copied from class: `LatLonGeometry`
      get a `Component2D` from this geometry
      Specified by:
        `toComponent2D` in class `LatLonGeometry`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toGeoJSON

          public String toGeoJSON()

      prints lines as geojson

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.