Package com.mapbox.geojson
Class MultiPoint
java.lang.Object
com.mapbox.geojson.MultiPoint
- All Implemented Interfaces:
CoordinateContainer<List<Point>>,GeoJson,Geometry,Serializable
A MultiPoint represents two or more geographic points that share a relationship and is one of the
seven geometries found in the GeoJson spec.
This adheres to the RFC 7946 internet standard when serialized into JSON. When deserialized, this class becomes an immutable object which should be initiated using its static factory methods. The list of points must be equal to or greater than 2.
A sample GeoJson MultiPoint's provided below (in it's serialized state).
{
"TYPE": "MultiPoint",
"coordinates": [
[100.0, 0.0],
[101.0, 1.0]
]
}
Look over the Point documentation to get more
information about formatting your list of point objects correctly.- Since:
- 1.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbbox()A Feature Collection might have a member namedbboxto include information on the coordinate range for it'sFeatures.provides the list ofPoints that make up the MultiPoint geometry.booleanstatic MultiPointCreate a new instance of this class by passing in a formatted valid JSON String.static MultiPointfromLngLats(List<Point> points) Create a new instance of this class by defining a list ofPoints which follow the correct specifications described in the Point documentation.static MultiPointfromLngLats(List<Point> points, BoundingBox bbox) Create a new instance of this class by defining a list ofPoints which follow the correct specifications described in the Point documentation.inthashCode()toJson()This takes the currently defined values found inside this instance and converts it to a GeoJson string.toString()type()This describes the TYPE of GeoJson this object is, thus this will always returnMultiPoint.static com.google.gson.TypeAdapter<MultiPoint>typeAdapter(com.google.gson.Gson gson) Gson TYPE adapter for parsing Gson to this class.
-
Method Details
-
fromJson
Create a new instance of this class by passing in a formatted valid JSON String. If you are creating a MultiPoint object from scratch it is better to use one of the other provided static factory methods such asfromLngLats(List). For a valid MultiPoint to exist, it must have at least 2 coordinate entries.- Parameters:
json- a formatted valid JSON string defining a GeoJson MultiPoint- Returns:
- a new instance of this class defined by the values passed inside this static factory method
- Since:
- 1.0.0
-
fromLngLats
Create a new instance of this class by defining a list ofPoints which follow the correct specifications described in the Point documentation. Note that there should not be any duplicate points inside the list.Note that if less than 2 points are passed in, a runtime exception will occur.
- Parameters:
points- a list ofPoints which make up the LineString geometry- Returns:
- a new instance of this class defined by the values passed inside this static factory method
- Since:
- 3.0.0
-
fromLngLats
Create a new instance of this class by defining a list ofPoints which follow the correct specifications described in the Point documentation. Note that there should not be any duplicate points inside the list.Note that if less than 2 points are passed in, a runtime exception will occur.
- Parameters:
points- a list ofPoints which make up the LineString geometrybbox- optionally include a bbox definition as a double array- Returns:
- a new instance of this class defined by the values passed inside this static factory method
- Since:
- 3.0.0
-
type
This describes the TYPE of GeoJson this object is, thus this will always returnMultiPoint. -
bbox
A Feature Collection might have a member namedbboxto include information on the coordinate range for it'sFeatures. The value of the bbox member MUST be a list of size 2*n where n is the number of dimensions represented in the contained feature geometries, with all axes of the most southwesterly point followed by all axes of the more northeasterly point. The axes order of a bbox follows the axes order of geometries. -
coordinates
provides the list ofPoints that make up the MultiPoint geometry.- Specified by:
coordinatesin interfaceCoordinateContainer<List<Point>>- Returns:
- a list of points
- Since:
- 3.0.0
-
toJson
This takes the currently defined values found inside this instance and converts it to a GeoJson string. -
typeAdapter
Gson TYPE adapter for parsing Gson to this class.- Parameters:
gson- the builtGsonobject- Returns:
- the TYPE adapter for this class
- Since:
- 3.0.0
-
toString
-
equals
-
hashCode
public int hashCode()
-