+ 404 Not Found +
+ ++ This page is unavailable in this version of the API docs. +
+ ++ You can use the sidebar to search for your page, or try a different + Crystal version. +
+ +From 854fa86fc178a222914363c04d0862992bc60edd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 31 Mar 2024 15:46:10 +0000 Subject: [PATCH] Deploy to GitHub pages --- 404.html | 162 +++++ GeoJSON.html | 291 ++++++++ GeoJSON/Coordinates.html | 610 +++++++++++++++++ GeoJSON/Exception.html | 266 ++++++++ GeoJSON/Feature.html | 546 +++++++++++++++ GeoJSON/FeatureCollection.html | 493 ++++++++++++++ GeoJSON/GeometryCollection.html | 538 +++++++++++++++ GeoJSON/LineString.html | 602 +++++++++++++++++ GeoJSON/MultiLineString.html | 625 ++++++++++++++++++ GeoJSON/MultiPoint.html | 625 ++++++++++++++++++ GeoJSON/MultiPolygon.html | 625 ++++++++++++++++++ GeoJSON/Object.html | 442 +++++++++++++ GeoJSON/Object/Type.html | 233 +++++++ GeoJSON/Point.html | 770 ++++++++++++++++++++++ GeoJSON/Polygon.html | 550 ++++++++++++++++ css/style.css | 980 +++++++++++++++++++++++++++ index.html | 538 +++++++++++++++ index.json | 1 + js/doc.js | 1099 +++++++++++++++++++++++++++++++ search-index.js | 1 + 20 files changed, 9997 insertions(+) create mode 100644 404.html create mode 100644 GeoJSON.html create mode 100644 GeoJSON/Coordinates.html create mode 100644 GeoJSON/Exception.html create mode 100644 GeoJSON/Feature.html create mode 100644 GeoJSON/FeatureCollection.html create mode 100644 GeoJSON/GeometryCollection.html create mode 100644 GeoJSON/LineString.html create mode 100644 GeoJSON/MultiLineString.html create mode 100644 GeoJSON/MultiPoint.html create mode 100644 GeoJSON/MultiPolygon.html create mode 100644 GeoJSON/Object.html create mode 100644 GeoJSON/Object/Type.html create mode 100644 GeoJSON/Point.html create mode 100644 GeoJSON/Polygon.html create mode 100644 css/style.css create mode 100644 index.html create mode 100644 index.json create mode 100644 js/doc.js create mode 100644 search-index.js diff --git a/404.html b/404.html new file mode 100644 index 0000000..c99ed8a --- /dev/null +++ b/404.html @@ -0,0 +1,162 @@ + + +
+ + + + + + + + + + + + + ++ This page is unavailable in this version of the API docs. +
+ ++ You can use the sidebar to search for your page, or try a different + Crystal version. +
+ +{{ (`shards version /__w/geojson/geojson/src`).chomp.stringify }}
+ A Coordinates
is a position in longitude, latitude, and (optionally)
+altitude.
This class corresponds to the GeoJSON Position.
+ + + + + + + + + + + + + + +Creates a new Coordinates
with the given longitude, latitude and altitude.
Creates a new Coordinates
with the given coordinates array.
Deserializes a Coordinates
from the given JSON parser.
Returns true
if this reference is the same as other.
Gets this Coordinates' altitude.
See Object#hash(hasher)
Gets this Coordinates' latitude in decimal degrees according to WGS84.
Gets this Coordinates' longitude in decimal degrees according to WGS84.
Creates a new Coordinates
with the given longitude, latitude and altitude.
Creates a new Coordinates
with the given coordinates array.
Deserializes a Coordinates
from the given JSON parser.
Returns true
if this reference is the same as other. Invokes same?
.
Gets this Coordinates' altitude.
+Technically, this positional value is meant to be the height in meters +above the WGS84 ellipsoid.
+See Object#hash(hasher)
Gets this Coordinates' latitude in decimal degrees according to WGS84.
+Gets this Coordinates' longitude in decimal degrees according to WGS84.
+Raised when an attempt is made to create a GeoJSON object that is malformed.
+In most cases, this means that the given coordinates for a geometry object +don't fulfill the requirements for that geometry type.
+ + + + + + + + + + + + + + +A Feature
represents a GeoJSON Feature object
+with a geometry and properties.
A Feature
represents a GeoJSON Feature object with a geometry and properties.
Creates a new Feature
with the given geometry and optional properties, id, and bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this Feature's geometry.
Gets this Feature's id.
Gets this Feature's properties.
Gets this Feature's GeoJSON type ("Feature")
GeoJSON::Object
GeoJSON::Object
A Feature
represents a GeoJSON Feature object
+with a geometry and properties.
Creates a new Feature
with the given geometry and optional
+properties, id, and bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this Feature's geometry.
+Gets this Feature's properties.
+A FeatureCollection
represents a GeoJSON FeatureCollection object
+and contains one or more Feature
s.
A FeatureCollection
represents a GeoJSON FeatureCollection object and contains one or more Feature
s.
Creates a new FeatureCollection
with the given features.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this FeatureCollections
array of features.
Gets this FeatureCollection's GeoJSON type ("FeatureCollection")
GeoJSON::Object
GeoJSON::Object
A FeatureCollection
represents a GeoJSON FeatureCollection object
+and contains one or more Feature
s.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this FeatureCollections
array of features.
Gets this FeatureCollection's GeoJSON type ("FeatureCollection")
+A GeometryCollection
represents a collection of several geometries.
Its array of geometries can contain Point
, MultiPoint
, LineString
,
+MultiLineString
, Polygon
, and MultiPolygon
. Technically, you can nest
+GeometryCollection
s inside one another, but this is discouraged by the
+specification.
This class corresponds to the GeoJSON GeometryCollection.
+ + + + + + + + + + + + + + +Deserializes a GeometryCollection
from the given JSON parser.
Creates a new GeometryCollection
containing the given geometries and optional bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of the geometries in this GeometryCollection
Gets this GeometryCollection's GeoJSON type ("GeometryCollection")
GeoJSON::Object
GeoJSON::Object
Deserializes a GeometryCollection
from the given JSON parser.
Creates a new GeometryCollection
containing the given geometries and
+optional bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of the geometries in this GeometryCollection
Gets this GeometryCollection's GeoJSON type ("GeometryCollection")
+A LineString
is a Geometry
representing two or more points in geographic
+space connected consecutively by lines.
This class corresponds to the GeoJSON LineString.
+ + + + + + + + + + + + + + +A LineString
is a Geometry
representing two or more points in geographic space connected consecutively by lines.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Gets the LineString vertex at the given index.
Gets the LineString vertex at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this LineString's GeoJSON type ("LineString")
Gets this LineString's GeoJSON type ("LineString")
GeoJSON::Object
GeoJSON::Object
A LineString
is a Geometry
representing two or more points in geographic
+space connected consecutively by lines.
This class corresponds to the GeoJSON LineString.
+Create a new LineString
with the given coordinates and optional
+bounding box bbox.
Create a new LineString
with the given coordinates and optional
+bounding box bbox.
Create a new LineString
with the given coordinates and optional
+bounding box bbox.
Gets the LineString vertex at the given index.
+Gets the LineString vertex at the given index.
+Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this LineString's GeoJSON type ("LineString")
+Gets this LineString's GeoJSON type ("LineString")
+A MultiLineString
is a Geometry
representing several LineString
s.
This class corresponds to the GeoJSON MultiLineString.
+ + + + + + + + + + + + + + +A MultiLineString
is a Geometry
representing several LineString
s.
Create a new MultiLineString
with the given coordinates and optional bounding box bbox.
Create a new MultiLineString
with the given coordinates and optional bounding box bbox.
Adds the given line_string to this MultiLineString.
Adds the given coordinate to this MultiLineString.
Gets the LineString
at the given index.
Gets the LineString
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiLineString's coordinates.
Gets this MultiLineString's GeoJSON type ("MultiLineString")
GeoJSON::Object
GeoJSON::Object
A MultiLineString
is a Geometry
representing several LineString
s.
This class corresponds to the GeoJSON MultiLineString.
+Create a new MultiLineString
with the given coordinates and optional
+bounding box bbox.
Create a new MultiLineString
with the given coordinates and optional
+bounding box bbox.
Adds the given line_string to this MultiLineString.
+Adds the given coordinate to this MultiLineString.
+Gets the LineString
at the given index.
Gets the LineString
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiLineString's coordinates.
+Gets this MultiLineString's GeoJSON type ("MultiLineString")
+A MultiPoint
is a Geometry
representing several Point
s.
This class corresponds to the GeoJSON MultiPoint.
+ + + + + + + + + + + + + + +A MultiPoint
is a Geometry
representing several Point
s.
Create a new MultiPoint
with the given coordinates and optional bounding box bbox.
Create a new MultiPoint
with the given coordinates and optional bounding box bbox.
Adds the given point to this MultiPoint.
Adds the given coordinate to this MultiPoint.
Gets the Point
at the given index.
Gets the Point
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPoint's coordinates.
Gets this MultiPoint's GeoJSON type ("MultiPoint")
GeoJSON::Object
GeoJSON::Object
A MultiPoint
is a Geometry
representing several Point
s.
This class corresponds to the GeoJSON MultiPoint.
+Create a new MultiPoint
with the given coordinates and optional
+bounding box bbox.
Create a new MultiPoint
with the given coordinates and optional
+bounding box bbox.
Adds the given point to this MultiPoint.
+Adds the given coordinate to this MultiPoint.
+Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPoint's coordinates.
+Gets this MultiPoint's GeoJSON type ("MultiPoint")
+A MultiPolygon
is a Geometry
representing several Polygon
s.
This class corresponds to the GeoJSON MultiPolygon.
+ + + + + + + + + + + + + + +A MultiPolygon
is a Geometry
representing several Polygon
s.
Create a new MultiPolygon
with the given coordinates and optional bounding box bbox.
Create a new MultiPolygon
with the given coordinates and optional bounding box bbox.
Adds the given polygon to this MultiPolygon.
Adds the given coordinate to this MultiPolygon.
Gets the Polygon
at the given index.
Gets the Polygon
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPolygon's coordinates.
Gets this MultiPolygon's GeoJSON type ("MultiPolygon")
GeoJSON::Object
GeoJSON::Object
A MultiPolygon
is a Geometry
representing several Polygon
s.
This class corresponds to the GeoJSON MultiPolygon.
+Create a new MultiPolygon
with the given coordinates and optional
+bounding box bbox.
Create a new MultiPolygon
with the given coordinates and optional
+bounding box bbox.
Adds the given polygon to this MultiPolygon.
+Adds the given coordinate to this MultiPolygon.
+Gets the Polygon
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPolygon's coordinates.
+Gets this MultiPolygon's GeoJSON type ("MultiPolygon")
+GeoJSON Object
+A GeoJSON object represents a Geometry, Feature, or collection of Features.
+Point
, MultiPoint
, LineString
, MultiLineString
, Polygon
, MultiPolygon
,
+GeometryCollection
, Feature
, and FeatureCollection
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
All possible GeoJSON types.
+ + + +GeoJSON::Object
+
+
+
+
+
+
+
+
+
+
+
+
+ A Point
is a Geometry
representing a single Position
in geographic
+space.
This class corresponds to the GeoJSON Point.
+ + + + + + + + + + + + + + +Creates a new Point
at the given longitude, latitude, and optional altitude, and with optional bounding box bbox.
A Point
is a Geometry
representing a single Position
in geographic space.
Creates a new Point
with the given coordinates and optional bounding box bbox.
Creates a new Point
with the given coordinates and optional bounding box bbox.
Returns true
if this reference is the same as other.
Gets this Point's altitude.
Gets this Point's altitude.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this Point's coordinates.
See Object#hash(hasher)
Gets this Point's latitude in decimal degrees according to WGS84.
Gets this Point's latitude in decimal degrees according to WGS84.
Gets this Point's longitude in decimal degrees according to WGS84.
Gets this Point's longitude in decimal degrees according to WGS84.
Gets this Point's GeoJSON type ("Point")
GeoJSON::Object
GeoJSON::Object
Creates a new Point
at the given longitude, latitude, and optional
+altitude, and with optional bounding box bbox.
A Point
is a Geometry
representing a single Position
in geographic
+space.
This class corresponds to the GeoJSON Point.
+Creates a new Point
with the given coordinates and optional bounding
+box bbox.
Creates a new Point
with the given coordinates and optional bounding
+box bbox.
Returns true
if this reference is the same as other. Invokes same?
.
Gets this Point's altitude.
+Technically, this positional value is meant to be the height in meters +above the WGS84 ellipsoid.
+Gets this Point's altitude.
+Technically, this positional value is meant to be the height in meters +above the WGS84 ellipsoid.
+Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
See Object#hash(hasher)
Gets this Point's latitude in decimal degrees according to WGS84.
+Gets this Point's latitude in decimal degrees according to WGS84.
+Gets this Point's longitude in decimal degrees according to WGS84.
+Gets this Point's longitude in decimal degrees according to WGS84.
+A Polygon
is a Geometry
representing a closed geometric figure in
+geographic space with optional holes within it.
This class corresponds to the GeoJSON Polygon.
+ + + + + + + + + + + + + + +A Polygon
is a Geometry
representing a closed geometric figure in geographic space with optional holes within it.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this Polygon's linear ring coordinates.
Gets this Polygon's GeoJSON type ("Polygon")
GeoJSON::Object
GeoJSON::Object
A Polygon
is a Geometry
representing a closed geometric figure in
+geographic space with optional holes within it.
This class corresponds to the GeoJSON Polygon.
+Creates a new Polygon
with the given coordinates and optional bounding
+box bbox.
Creates a new Polygon
with the given coordinates and optional bounding
+box bbox.
Creates a new Polygon
with the given coordinates and optional bounding
+box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this Polygon's linear ring coordinates.
+Crystal library for reading and writing GeoJSON
+This library contains:
+Add the dependency to your shard.yml
:
dependencies:
+ geojson:
+ github: geocrystal/geojson
+and run shards install
require "geojson"
+A position is the fundamental geometry construct. The coordinates
member of a Geometry object is composed of either:
Point
geometryLineString
or MultiPoint
geometryLineString
or linear ring coordinates in the case of a Polygon
or MultiLineString
geometryPolygon
coordinates in the case of a MultiPolygon
geometryA position is an array of Float64
.
There must be two or more elements. The first two elements are longitude
and latitude
. Altitude
may be included as an optional third element.
postition = [-80.1347334, 25.7663562, 0.0]
+point = GeoJSON::Point.new(position)
+A GeoJSON point looks like this:
+{
+ "type": "Point",
+ "coordinates": [-80.1347334, 25.7663562]
+}
+It is important to note that coordinates is in the format [longitude, latitude]
.
+Longitude comes before latitude in GeoJSON.
For type Point
, the coordinates
member is a single position.
Serialize geometry type:
+point = GeoJSON::Point.new([-80.1347334, 25.7663562])
+json = point.to_json
+# => {"type":"Point","coordinates":[-80.1347334,25.7663562]}
+Deserialize geometry type:
+point = GeoJSON::Point.from_json(json)
+# => #<GeoJSON::Point:0x7f1444af9920>
+point.longitude
+# => -80.1347334
+point.latitude
+# => 25.7663562
+For type MultiPoint
, the coordinates
member is an array of positions.
point1 = GeoJSON::Point.new(longitude: 100.0, latitude: 0.0)
+point2 = GeoJSON::Point.new(longitude: 101.0, latitude: 1.0)
+
+multi_point = GeoJSON::MultiPoint.new([point1, point2])
+multi_point.to_json
+{
+ "type":"MultiPoint",
+ "coordinates":[[100.0, 0.0], [101.0, 1.0]]
+}
+For type LineString
, the coordinates
member is an array of two or more positions.
line_string = GeoJSON::LineString.new [[-124.2, 42.0], [-120.0, 42.0]]
+line_string.to_json
+{
+ "type": "LineString",
+ "coordinates": [[-124.2, 42.0], [-120.0, 42.0]]
+}
+For type MultiLineString
, the coordinates
member is an array of LineString
coordinate arrays.
line_string1 = GeoJSON::LineString.new([[100.0, 0.0], [101.0, 1.0]])
+line_string2 = GeoJSON::LineString.new([[102.0, 2.0], [103.0, 3.0]])
+
+multi_line_string = GeoJSON::MultiLineString.new([line_string1, line_string2])
+multi_line_string = GeoJSON::MultiLineString.new([
+ [[100.0, 0.0], [101.0, 1.0]],
+ [[102.0, 2.0], [103.0, 3.0]],
+])
+multi_line_string.to_json
+{
+ "type":"MultiLineString",
+ "coordinates":[
+ [
+ [100.0, 0.0],
+ [101.0, 1.0]
+ ],
+ [
+ [102.0, 2.0],
+ [103.0, 3.0]
+ ]
+ ]
+}
+GeoJSON polygons represent closed shapes on a map, like triangles, squares, dodecagons, or any shape with a fixed number of sides.
+To specify a constraint specific to Polygon
, it is useful to introduce the concept of a linear ring:
LineString
with four or more positions.The Polygon
geometry type definition as follows:
Polygon
, the coordinates
member must be an array of linear ring coordinate arrays.Polygon
with more than one of these rings, the first must be the exterior ring, and any others must be interior rings. The exterior ring bounds the surface, and the interior rings (if present) bound holes within the surface.polygon = GeoJSON::Polygon.new([
+ [[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0,-10.0]],
+ [[-1.0, -2.0], [3.0, -2.0], [3.0, 2.0], [-1.0,-2.0]]
+])
+polygon.to_json
+{
+ "type": "Polygon",
+ "coordinates": [
+ [
+ [-10.0, -10.0],
+ [10.0, -10.0],
+ [10.0,10.0],
+ [-10.0,-10.0]
+ ],
+ [
+ [-1.0, -2.0],
+ [3.0, -2.0],
+ [3.0, 2.0],
+ [-1.0,-2.0]
+ ]
+ ]
+}
+For type MultiPolygon
, the coordinates
member is an array of Polygon
coordinate arrays.
polygon1 = GeoJSON::Polygon.new(
+ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]]
+)
+polygon2 = GeoJSON::Polygon.new(
+ [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]
+)
+
+multi_polygon = GeoJSON::MultiPolygon.new([polygon1, polygon2])
+multi_polygon.to_json
+{
+ "type":"MultiPolygon",
+ "coordinates":[
+ [
+ [
+ [102.0,2.0],
+ [103.0,2.0],
+ [103.0,3.0],
+ [102.0,3.0],
+ [102.0,2.0]
+ ]
+ ],
+ [
+ [
+ [100.0,0.0],
+ [101.0,0.0],
+ [101.0,1.0],
+ [100.0,1.0],
+ [100.0,0.0]
+ ]
+ ]
+ ]
+}
+A GeoJSON object with type GeometryCollection
is a Geometry object.
A GeometryCollection
has a member with the name geometries
. The
+value of geometries
is an array. Each element of this array is a
+GeoJSON Geometry object.
point = GeoJSON::Point.new([100.0, 0.0])
+line_string = GeoJSON::LineString.new([
+ [101.0, 0.0],
+ [102.0, 1.0],
+])
+polygon = GeoJSON::Polygon.new([
+ [
+ [100.0, 0.0],
+ [101.0, 0.0],
+ [101.0, 1.0],
+ [100.0, 1.0],
+ [100.0, 0.0],
+ ],
+])
+
+geometry_collection = GeoJSON::GeometryCollection.new([point, line_string, polygon])
+geometry_collection.to_json
+{
+ "type":"GeometryCollection",
+ "geometries":[
+ {
+ "type":"Point",
+ "coordinates":[100.0,0.0]
+ },
+ {
+ "type":"LineString",
+ "coordinates":[
+ [101.0,0.0],
+ [102.0,1.0]
+ ]
+ },
+ {
+ "type":"Polygon",
+ "coordinates":[
+ [
+ [100.0,0.0],
+ [101.0,0.0],
+ [101.0,1.0],
+ [100.0,1.0],
+ [100.0,0.0]
+ ]
+ ]
+ }
+ ]
+}
+A Feature
object represents a spatially bounded thing. Every Feature
object is a GeoJSON object no matter where it occurs in a GeoJSON text.
Feature
object has a "type"
member with the value "Feature"
.Feature
object has a member with the name "geometry"
. The value of the geometry member shall be either a Geometry object as defined above or, in the case that the Feature
is unlocated, a JSON null
value.Feature
object has a member with the name "properties"
. The value of the properties member is an object (any JSON object or a JSON null
value).Feature
has a commonly used identifier, that identifier should be included as a member of the Feature
object with the name "id"
, and the value of this member is either a JSON string or number.point = GeoJSON::Point.new([-80.1347334, 25.7663562])
+properties = {"color" => "red"} of String => JSON::Any::Type
+feature = GeoJSON::Feature.new(point, properties, id: 1)
+feature.to_json
+{
+ "type":"Feature",
+ "geometry":{
+ "type":"Point",
+ "coordinates":[-80.1347334,25.7663562]
+ },
+ "properties":{
+ "color":"red"
+ },
+ "id":1
+}
+A GeoJSON object with the type "FeatureCollection"
is a FeatureCollection
object. A FeatureCollection
object has a member with the name "features"
. The value of "features"
is a JSON array. Each element of the array is a Feature
object. It is possible for this array to be empty.
feature1 = GeoJSON::Feature.new(
+ GeoJSON::Point.new([102.0, 0.5]),
+ id: "point"
+)
+
+feature2 = GeoJSON::Feature.new(
+ GeoJSON::Polygon.new([
+ [
+ [100.0, 0.0],
+ [101.0, 0.0],
+ [101.0, 1.0],
+ [100.0, 1.0],
+ [100.0, 0.0],
+ ],
+ ]),
+ type: "polygon"
+)
+
+feature_collection = GeoJSON::FeatureCollection.new([feature1, feature2])
+feature_collection.to_json
+{
+ "type":"FeatureCollection",
+ "features":[
+ {
+ "type":"Feature",
+ "geometry":{
+ "type":"Point",
+ "coordinates":[102.0,0.5]
+ },
+ "properties":null,
+ "id":"point"
+ },
+ {
+ "type":"Feature",
+ "geometry":{
+ "type":"Polygon",
+ "coordinates":[
+ [
+ [100.0,0.0],
+ [101.0,0.0],
+ [101.0,1.0],
+ [100.0,1.0],
+ [100.0,0.0]
+ ]
+ ]
+ },
+ "properties":null,
+ "id":"polygon"
+ }
+ ]
+}
+For example, in the Point
object shown below
{
+ "type": "Point",
+ "coordinates": [-80.1347334, 25.7663562],
+ "title": "Example Point"
+}
+the name/value pair of "title": "Example Point"
is a foreign member.
GeoJSON semantics do not apply to foreign members and their descendants, regardless of their names and values.
+If the GeoJSON type include foreign members, this properties in the JSON document will be stored in a Hash(String, JSON::Any)
.
+On serialization, any keys inside json_unmapped
will be serialized and appended to the current json object.
point = GeoJSON::Point.new([-80.1347334, 25.7663562])
+
+json_unmapped = Hash(String, JSON::Any).new
+json_unmapped["title"] = JSON::Any.new("Example Point")
+
+point.json_unmapped = json_unmapped
+git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Copyright: 2020-2022 Anton Maminov (anton.maminov@gmail.com)
+This library is distributed under the MIT license. Please see the LICENSE file.
+A Coordinates
is a position in longitude, latitude, and (optionally) altitude.
Creates a new Coordinates
with the given longitude, latitude and altitude.
Creates a new Coordinates
with the given coordinates array.
Deserializes a Coordinates
from the given JSON parser.
Returns true
if this reference is the same as other.
Gets this Coordinates' altitude.
","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":46,"url":null},"def":{"name":"altitude","visibility":"Public","body":"coordinates[2]?"}},{"html_id":"coordinates:Array(Float64)-instance-method","name":"coordinates","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":7,"url":null},"def":{"name":"coordinates","return_type":"Array(Float64)","visibility":"Public","body":"@coordinates"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
Gets this Coordinates' latitude in decimal degrees according to WGS84.
","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":38,"url":null},"def":{"name":"latitude","visibility":"Public","body":"coordinates[1]"}},{"html_id":"longitude-instance-method","name":"longitude","doc":"Gets this Coordinates' longitude in decimal degrees according to WGS84.","summary":"Gets this Coordinates' longitude in decimal degrees according to WGS84.
","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":33,"url":null},"def":{"name":"longitude","visibility":"Public","body":"coordinates[0]"}},{"html_id":"to_json(*args,**options)-instance-method","name":"to_json","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/coordinates.cr","line_number":56,"url":null},"def":{"name":"to_json","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.to_json(*args, **options)"}},{"html_id":"to_json(*args,**options,&)-instance-method","name":"to_json","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/coordinates.cr","line_number":56,"url":null},"def":{"name":"to_json","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.to_json(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"html_id":"geojson/GeoJSON/Exception","path":"GeoJSON/Exception.html","kind":"class","full_name":"GeoJSON::Exception","name":"Exception","abstract":false,"superclass":{"html_id":"geojson/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"geojson/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/exception.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"Raised when an attempt is made to create a GeoJSON object that is malformed.\n\nIn most cases, this means that the given coordinates for a geometry object\ndon't fulfill the requirements for that geometry type.","summary":"Raised when an attempt is made to create a GeoJSON object that is malformed.
"},{"html_id":"geojson/GeoJSON/Feature","path":"GeoJSON/Feature.html","kind":"class","full_name":"GeoJSON::Feature","name":"Feature","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/feature.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `Feature` represents a [GeoJSON Feature object](https://tools.ietf.org/html/rfc7946#section-3.2)\nwith a geometry and properties.","summary":"A Feature
represents a GeoJSON Feature object with a geometry and properties.
A Feature
represents a GeoJSON Feature object with a geometry and properties.
Creates a new Feature
with the given geometry and optional properties, id, and bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this Feature's geometry.
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":12,"url":null},"def":{"name":"geometry","return_type":"GeoJSON::Object::Type | ::Nil","visibility":"Public","body":"@geometry"}},{"html_id":"id:String|Int32|Nil-instance-method","name":"id","doc":"Gets this Feature's id.","summary":"Gets this Feature's id.
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":19,"url":null},"def":{"name":"id","return_type":"String | Int32 | Nil","visibility":"Public","body":"@id"}},{"html_id":"properties:Hash(String,JSON::Any::Type)|Nil-instance-method","name":"properties","doc":"Gets this Feature's properties.","summary":"Gets this Feature's properties.
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":16,"url":null},"def":{"name":"properties","return_type":"Hash(String, JSON::Any::Type) | ::Nil","visibility":"Public","body":"@properties"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this Feature's GeoJSON type (\"Feature\")","summary":"Gets this Feature's GeoJSON type ("Feature")
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/FeatureCollection","path":"GeoJSON/FeatureCollection.html","kind":"class","full_name":"GeoJSON::FeatureCollection","name":"FeatureCollection","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/feature_collection.cr","line_number":4,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `FeatureCollection` represents a [GeoJSON FeatureCollection object](https://tools.ietf.org/html/rfc7946#section-3.3)\nand contains one or more `Feature`s.","summary":"A FeatureCollection
represents a GeoJSON FeatureCollection object and contains one or more Feature
s.
A FeatureCollection
represents a GeoJSON FeatureCollection object and contains one or more Feature
s.
Creates a new FeatureCollection
with the given features.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this FeatureCollections
array of features.
Gets this FeatureCollection's GeoJSON type ("FeatureCollection")
","abstract":false,"location":{"filename":"src/geojson/feature_collection.cr","line_number":6,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/GeometryCollection","path":"GeoJSON/GeometryCollection.html","kind":"class","full_name":"GeoJSON::GeometryCollection","name":"GeometryCollection","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/geometry_collection.cr","line_number":10,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `GeometryCollection` represents a collection of several geometries.\n\nIts array of geometries can contain `Point`, `MultiPoint`, `LineString`,\n`MultiLineString`, `Polygon`, and `MultiPolygon`. Technically, you can nest\n`GeometryCollection`s inside one another, but this is discouraged by the\nspecification.\n\nThis class corresponds to the [GeoJSON GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8).","summary":"A GeometryCollection
represents a collection of several geometries.
Deserializes a GeometryCollection
from the given JSON parser.
Creates a new GeometryCollection
containing the given geometries and optional bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of the geometries in this GeometryCollection
Gets this GeometryCollection's GeoJSON type ("GeometryCollection")
","abstract":false,"location":{"filename":"src/geojson/geometry_collection.cr","line_number":12,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/LineString","path":"GeoJSON/LineString.html","kind":"class","full_name":"GeoJSON::LineString","name":"LineString","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/line_string.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `LineString` is a `Geometry` representing two or more points in geographic\nspace connected consecutively by lines.\n\nThis class corresponds to the [GeoJSON LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4).","summary":"A LineString
is a Geometry
representing two or more points in geographic space connected consecutively by lines.
A LineString
is a Geometry
representing two or more points in geographic space connected consecutively by lines.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Gets the LineString vertex at the given index.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/line_string.cr","line_number":14,"url":null},"def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","doc":"Gets the LineString vertex at the given index.","summary":"Gets the LineString vertex at the given index.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/line_string.cr","line_number":14,"url":null},"def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"bbox-instance-method","name":"bbox","doc":"Calculates the bounding box for any GeoJSON object, including `FeatureCollection`.","summary":"Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this LineString's GeoJSON type ("LineString")
","abstract":false,"location":{"filename":"src/geojson/line_string.cr","line_number":11,"url":null},"def":{"name":"coordinates","return_type":"Array(Coordinates)","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this LineString's GeoJSON type (\"LineString\")","summary":"Gets this LineString's GeoJSON type ("LineString")
","abstract":false,"location":{"filename":"src/geojson/line_string.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/MultiLineString","path":"GeoJSON/MultiLineString.html","kind":"class","full_name":"GeoJSON::MultiLineString","name":"MultiLineString","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/multi_line_string.cr","line_number":5,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `MultiLineString` is a `Geometry` representing several `LineString`s.\n\nThis class corresponds to the [GeoJSON MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5).","summary":"A MultiLineString
is a Geometry
representing several LineString
s.
A MultiLineString
is a Geometry
representing several LineString
s.
Create a new MultiLineString
with the given coordinates and optional bounding box bbox.
Create a new MultiLineString
with the given coordinates and optional bounding box bbox.
Adds the given line_string to this MultiLineString.
","abstract":false,"args":[{"name":"line_string","external_name":"line_string","restriction":"Array(LineString)"}],"args_string":"(line_string : Array(LineString))","args_html":"(line_string : Array(LineString))","location":{"filename":"src/geojson/multi_line_string.cr","line_number":29,"url":null},"def":{"name":"<<","args":[{"name":"line_string","external_name":"line_string","restriction":"Array(LineString)"}],"visibility":"Public","body":"@coordinates << line_string"}},{"html_id":"<<(coordinate:Array(Array(Float64)))-instance-method","name":"<<","doc":"Adds the given *coordinate* to this MultiLineString.","summary":"Adds the given coordinate to this MultiLineString.
","abstract":false,"args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Float64))"}],"args_string":"(coordinate : Array(Array(Float64)))","args_html":"(coordinate : Array(Array(Float64)))","location":{"filename":"src/geojson/multi_line_string.cr","line_number":34,"url":null},"def":{"name":"<<","args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Float64))"}],"visibility":"Public","body":"@coordinates << (LineString.new(coordinate)).coordinates"}},{"html_id":"[](*args,**options)-instance-method","name":"[]","doc":"Gets the `LineString` at the given index.","summary":"Gets the LineString
at the given index.
Gets the LineString
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiLineString's coordinates.
","abstract":false,"location":{"filename":"src/geojson/multi_line_string.cr","line_number":10,"url":null},"def":{"name":"coordinates","return_type":"Array(Array(GeoJSON::Coordinates))","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this MultiLineString's GeoJSON type (\"MultiLineString\")","summary":"Gets this MultiLineString's GeoJSON type ("MultiLineString")
","abstract":false,"location":{"filename":"src/geojson/multi_line_string.cr","line_number":7,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/MultiPoint","path":"GeoJSON/MultiPoint.html","kind":"class","full_name":"GeoJSON::MultiPoint","name":"MultiPoint","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/multi_point.cr","line_number":5,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `MultiPoint` is a `Geometry` representing several `Point`s.\n\nThis class corresponds to the [GeoJSON MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3).","summary":"A MultiPoint
is a Geometry
representing several Point
s.
A MultiPoint
is a Geometry
representing several Point
s.
Create a new MultiPoint
with the given coordinates and optional bounding box bbox.
Create a new MultiPoint
with the given coordinates and optional bounding box bbox.
Adds the given point to this MultiPoint.
","abstract":false,"args":[{"name":"point","external_name":"point","restriction":"Array(Point)"}],"args_string":"(point : Array(Point))","args_html":"(point : Array(Point))","location":{"filename":"src/geojson/multi_point.cr","line_number":29,"url":null},"def":{"name":"<<","args":[{"name":"point","external_name":"point","restriction":"Array(Point)"}],"visibility":"Public","body":"@coordinates << point.coordinates"}},{"html_id":"<<(coordinate:Array(Float64))-instance-method","name":"<<","doc":"Adds the given *coordinate* to this MultiPoint.","summary":"Adds the given coordinate to this MultiPoint.
","abstract":false,"args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Float64)"}],"args_string":"(coordinate : Array(Float64))","args_html":"(coordinate : Array(Float64))","location":{"filename":"src/geojson/multi_point.cr","line_number":34,"url":null},"def":{"name":"<<","args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Float64)"}],"visibility":"Public","body":"@coordinates << (Point.new(coordinate)).coordinates"}},{"html_id":"[](*args,**options)-instance-method","name":"[]","doc":"Gets the `Point` at the given index.","summary":"Gets the Point
at the given index.
Gets the Point
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPoint's coordinates.
","abstract":false,"location":{"filename":"src/geojson/multi_point.cr","line_number":10,"url":null},"def":{"name":"coordinates","return_type":"Array(Coordinates)","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this MultiPoint's GeoJSON type (\"MultiPoint\")","summary":"Gets this MultiPoint's GeoJSON type ("MultiPoint")
","abstract":false,"location":{"filename":"src/geojson/multi_point.cr","line_number":7,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/MultiPolygon","path":"GeoJSON/MultiPolygon.html","kind":"class","full_name":"GeoJSON::MultiPolygon","name":"MultiPolygon","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/multi_polygon.cr","line_number":5,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `MultiPolygon` is a `Geometry` representing several `Polygon`s.\n\nThis class corresponds to the [GeoJSON MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7).","summary":"A MultiPolygon
is a Geometry
representing several Polygon
s.
A MultiPolygon
is a Geometry
representing several Polygon
s.
Create a new MultiPolygon
with the given coordinates and optional bounding box bbox.
Create a new MultiPolygon
with the given coordinates and optional bounding box bbox.
Adds the given polygon to this MultiPolygon.
","abstract":false,"args":[{"name":"polygon","external_name":"polygon","restriction":"Array(Polygon)"}],"args_string":"(polygon : Array(Polygon))","args_html":"(polygon : Array(Polygon))","location":{"filename":"src/geojson/multi_polygon.cr","line_number":29,"url":null},"def":{"name":"<<","args":[{"name":"polygon","external_name":"polygon","restriction":"Array(Polygon)"}],"visibility":"Public","body":"@coordinates << polygon.coordinates"}},{"html_id":"<<(coordinate:Array(Array(Array(Float64))))-instance-method","name":"<<","doc":"Adds the given *coordinate* to this MultiPolygon.","summary":"Adds the given coordinate to this MultiPolygon.
","abstract":false,"args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Array(Float64)))"}],"args_string":"(coordinate : Array(Array(Array(Float64))))","args_html":"(coordinate : Array(Array(Array(Float64))))","location":{"filename":"src/geojson/multi_polygon.cr","line_number":34,"url":null},"def":{"name":"<<","args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Array(Float64)))"}],"visibility":"Public","body":"@coordinates << (Polygon.new(coordinate)).coordinates"}},{"html_id":"[](*args,**options)-instance-method","name":"[]","doc":"Gets the `Polygon` at the given index.","summary":"Gets the Polygon
at the given index.
Gets the Polygon
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPolygon's coordinates.
","abstract":false,"location":{"filename":"src/geojson/multi_polygon.cr","line_number":10,"url":null},"def":{"name":"coordinates","return_type":"Array(Array(Array(GeoJSON::Coordinates)))","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this MultiPolygon's GeoJSON type (\"MultiPolygon\")","summary":"Gets this MultiPolygon's GeoJSON type ("MultiPolygon")
","abstract":false,"location":{"filename":"src/geojson/multi_polygon.cr","line_number":7,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/Object","path":"GeoJSON/Object.html","kind":"class","full_name":"GeoJSON::Object","name":"Object","abstract":true,"superclass":{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/object.cr","line_number":14,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"}],"subclasses":[{"html_id":"geojson/GeoJSON/Feature","kind":"class","full_name":"GeoJSON::Feature","name":"Feature"},{"html_id":"geojson/GeoJSON/FeatureCollection","kind":"class","full_name":"GeoJSON::FeatureCollection","name":"FeatureCollection"},{"html_id":"geojson/GeoJSON/GeometryCollection","kind":"class","full_name":"GeoJSON::GeometryCollection","name":"GeometryCollection"},{"html_id":"geojson/GeoJSON/LineString","kind":"class","full_name":"GeoJSON::LineString","name":"LineString"},{"html_id":"geojson/GeoJSON/MultiLineString","kind":"class","full_name":"GeoJSON::MultiLineString","name":"MultiLineString"},{"html_id":"geojson/GeoJSON/MultiPoint","kind":"class","full_name":"GeoJSON::MultiPoint","name":"MultiPoint"},{"html_id":"geojson/GeoJSON/MultiPolygon","kind":"class","full_name":"GeoJSON::MultiPolygon","name":"MultiPolygon"},{"html_id":"geojson/GeoJSON/Point","kind":"class","full_name":"GeoJSON::Point","name":"Point"},{"html_id":"geojson/GeoJSON/Polygon","kind":"class","full_name":"GeoJSON::Polygon","name":"Polygon"}],"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"GeoJSON Object\n\nA GeoJSON object represents a Geometry, Feature, or collection of Features.\n\n* A GeoJSON object is a JSON object.\n* A GeoJSON object has a member with the name \"type\". The value of\n the member MUST be one of the GeoJSON types.\n `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`,\n `GeometryCollection`, `Feature`, and `FeatureCollection`\n* A GeoJSON object MAY have a \"bbox\" member, the value of which MUST\n be a bounding box array\n* A GeoJSON object MAY have other members","summary":"GeoJSON Object
","constructors":[{"html_id":"new(pull:JSON::PullParser)-class-method","name":"new","abstract":false,"args":[{"name":"pull","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","args_html":"(pull : JSON::PullParser)","location":{"filename":"src/geojson/object.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"pull","external_name":"pull","restriction":"::JSON::PullParser"}],"visibility":"Public","body":"location = pull.location\ndiscriminator_value = nil\njson = String.build do |io|\n JSON.build(io) do |builder|\n builder.start_object\n pull.read_object do |key|\n if key == \"type\"\n value_kind = pull.kind\n case value_kind\n when .string?\n discriminator_value = pull.string_value\n when .int?\n discriminator_value = pull.int_value\n when .bool?\n discriminator_value = pull.bool_value\n else\n raise(::JSON::SerializableError.new(\"JSON discriminator field 'type' has an invalid value type of #{value_kind.to_s}\", to_s, nil, *location, nil))\n end\n builder.field(key, discriminator_value)\n pull.read_next\n else\n builder.field(key) do\n pull.read_raw(builder)\n end\n end\n end\n builder.end_object\n end\nend\nif discriminator_value\nelse\n raise(::JSON::SerializableError.new(\"Missing JSON discriminator field 'type'\", to_s, nil, *location, nil))\nend\ncase discriminator_value\nwhen \"Point\"\n Point.from_json(json)\nwhen \"MultiPoint\"\n MultiPoint.from_json(json)\nwhen \"LineString\"\n LineString.from_json(json)\nwhen \"MultiLineString\"\n MultiLineString.from_json(json)\nwhen \"Polygon\"\n Polygon.from_json(json)\nwhen \"MultiPolygon\"\n MultiPolygon.from_json(json)\nelse\n raise(::JSON::SerializableError.new(\"Unknown 'type' discriminator value: #{discriminator_value.inspect}\", to_s, nil, *location, nil))\nend\n"}}],"instance_methods":[{"html_id":"bbox-instance-method","name":"bbox","doc":"Calculates the bounding box for any GeoJSON object, including `FeatureCollection`.","summary":"Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
All possible GeoJSON types.
"}]},{"html_id":"geojson/GeoJSON/Point","path":"GeoJSON/Point.html","kind":"class","full_name":"GeoJSON::Point","name":"Point","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/point.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `Point` is a `Geometry` representing a single `Position` in geographic\nspace.\n\nThis class corresponds to the [GeoJSON Point](https://tools.ietf.org/html/rfc7946#section-3.1.2).","summary":"A Point
is a Geometry
representing a single Position
in geographic space.
Creates a new Point
at the given longitude, latitude, and optional altitude, and with optional bounding box bbox.
A Point
is a Geometry
representing a single Position
in geographic space.
Creates a new Point
with the given coordinates and optional bounding box bbox.
Creates a new Point
with the given coordinates and optional bounding box bbox.
Returns true
if this reference is the same as other.
Gets this Point's altitude.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/point.cr","line_number":43,"url":null},"def":{"name":"altitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.altitude(*args, **options)"}},{"html_id":"altitude(*args,**options,&)-instance-method","name":"altitude","doc":"Gets this Point's altitude.\n\nTechnically, this positional value is meant to be the height in meters\nabove the WGS84 ellipsoid.","summary":"Gets this Point's altitude.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/point.cr","line_number":43,"url":null},"def":{"name":"altitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.altitude(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"bbox-instance-method","name":"bbox","doc":"Calculates the bounding box for any GeoJSON object, including `FeatureCollection`.","summary":"Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this Point's coordinates.
","abstract":false,"location":{"filename":"src/geojson/point.cr","line_number":11,"url":null},"def":{"name":"coordinates","return_type":"Coordinates","visibility":"Public","body":"@coordinates"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
Gets this Point's latitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/point.cr","line_number":38,"url":null},"def":{"name":"latitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.latitude(*args, **options)"}},{"html_id":"latitude(*args,**options,&)-instance-method","name":"latitude","doc":"Gets this Point's latitude in decimal degrees according to WGS84.","summary":"Gets this Point's latitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/point.cr","line_number":38,"url":null},"def":{"name":"latitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.latitude(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"longitude(*args,**options)-instance-method","name":"longitude","doc":"Gets this Point's longitude in decimal degrees according to WGS84.","summary":"Gets this Point's longitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/point.cr","line_number":36,"url":null},"def":{"name":"longitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.longitude(*args, **options)"}},{"html_id":"longitude(*args,**options,&)-instance-method","name":"longitude","doc":"Gets this Point's longitude in decimal degrees according to WGS84.","summary":"Gets this Point's longitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/point.cr","line_number":36,"url":null},"def":{"name":"longitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.longitude(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this Point's GeoJSON type (\"Point\")","summary":"Gets this Point's GeoJSON type ("Point")
","abstract":false,"location":{"filename":"src/geojson/point.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/Polygon","path":"GeoJSON/Polygon.html","kind":"class","full_name":"GeoJSON::Polygon","name":"Polygon","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/polygon.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `Polygon` is a `Geometry` representing a closed geometric figure in\ngeographic space with optional holes within it.\n\nThis class corresponds to the [GeoJSON Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6).","summary":"A Polygon
is a Geometry
representing a closed geometric figure in geographic space with optional holes within it.
A Polygon
is a Geometry
representing a closed geometric figure in geographic space with optional holes within it.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this Polygon's linear ring coordinates.
","abstract":false,"location":{"filename":"src/geojson/polygon.cr","line_number":11,"url":null},"def":{"name":"coordinates","return_type":"Array(Array(Coordinates))","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this Polygon's GeoJSON type (\"Polygon\")","summary":"Gets this Polygon's GeoJSON type ("Polygon")
","abstract":false,"location":{"filename":"src/geojson/polygon.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]}]}]}} \ No newline at end of file diff --git a/js/doc.js b/js/doc.js new file mode 100644 index 0000000..45d38b9 --- /dev/null +++ b/js/doc.js @@ -0,0 +1,1099 @@ +window.CrystalDocs = (window.CrystalDocs || {}); + +CrystalDocs.base_path = (CrystalDocs.base_path || ""); + +CrystalDocs.searchIndex = (CrystalDocs.searchIndex || false); +CrystalDocs.MAX_RESULTS_DISPLAY = 140; + +CrystalDocs.runQuery = function(query) { + function searchType(type, query, results) { + var matches = []; + var matchedFields = []; + var name = type.full_name; + var i = name.lastIndexOf("::"); + if (i > 0) { + name = name.substring(i + 2); + } + var nameMatches = query.matches(name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + var namespaceMatches = query.matchesNamespace(type.full_name); + if(namespaceMatches){ + matches = matches.concat(namespaceMatches); + matchedFields.push("name"); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + results.push({ + id: type.html_id, + result_type: "type", + kind: type.kind, + name: name, + full_name: type.full_name, + href: type.path, + summary: type.summary, + matched_fields: matchedFields, + matched_terms: matches + }); + } + + if (type.instance_methods) { + type.instance_methods.forEach(function(method) { + searchMethod(method, type, "instance_method", query, results); + }) + } + if (type.class_methods) { + type.class_methods.forEach(function(method) { + searchMethod(method, type, "class_method", query, results); + }) + } + if (type.constructors) { + type.constructors.forEach(function(constructor) { + searchMethod(constructor, type, "constructor", query, results); + }) + } + if (type.macros) { + type.macros.forEach(function(macro) { + searchMethod(macro, type, "macro", query, results); + }) + } + if (type.constants) { + type.constants.forEach(function(constant){ + searchConstant(constant, type, query, results); + }); + } + if (type.types) { + type.types.forEach(function(subtype){ + searchType(subtype, query, results); + }); + } + }; + + function searchMethod(method, type, kind, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matchesMethod(method.name, kind, type); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + if (method.args) { + method.args.forEach(function(arg){ + var argMatches = query.matches(arg.external_name); + if (argMatches) { + matches = matches.concat(argMatches); + matchedFields.push("args"); + } + }); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: method.html_id, + type: type.full_name, + result_type: kind, + name: method.name, + full_name: type.full_name + "#" + method.name, + args_string: method.args_string, + summary: method.summary, + href: type.path + "#" + method.html_id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + function searchConstant(constant, type, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matches(constant.name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + var docMatches = query.matches(constant.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: constant.id, + type: type.full_name, + result_type: "constant", + name: constant.name, + full_name: type.full_name + "#" + constant.name, + value: constant.value, + summary: constant.summary, + href: type.path + "#" + constant.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + var results = []; + searchType(CrystalDocs.searchIndex.program, query, results); + return results; +}; + +CrystalDocs.rankResults = function(results, query) { + function uniqueArray(ar) { + var j = {}; + + ar.forEach(function(v) { + j[v + "::" + typeof v] = v; + }); + + return Object.keys(j).map(function(v) { + return j[v]; + }); + } + + results = results.sort(function(a, b) { + var matchedTermsDiff = uniqueArray(b.matched_terms).length - uniqueArray(a.matched_terms).length; + var aHasDocs = b.matched_fields.includes("doc"); + var bHasDocs = b.matched_fields.includes("doc"); + + var aOnlyDocs = aHasDocs && a.matched_fields.length == 1; + var bOnlyDocs = bHasDocs && b.matched_fields.length == 1; + + if (a.result_type == "type" && b.result_type != "type" && !aOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("a is type b not"); } + return -1; + } else if (b.result_type == "type" && a.result_type != "type" && !bOnlyDocs) { + if(CrystalDocs.DEBUG) { console.log("b is type, a not"); } + return 1; + } + if (a.matched_fields.includes("name")) { + if (b.matched_fields.includes("name")) { + var a_name = (CrystalDocs.prefixForType(a.result_type) || "") + ((a.result_type == "type") ? a.full_name : a.name); + var b_name = (CrystalDocs.prefixForType(b.result_type) || "") + ((b.result_type == "type") ? b.full_name : b.name); + a_name = a_name.toLowerCase(); + b_name = b_name.toLowerCase(); + for(var i = 0; i < query.normalizedTerms.length; i++) { + var term = query.terms[i].replace(/^::?|::?$/, ""); + var a_orig_index = a_name.indexOf(term); + var b_orig_index = b_name.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("term: " + term + " a: " + a_name + " b: " + b_name); } + if(CrystalDocs.DEBUG) { console.log(a_orig_index, b_orig_index, a_orig_index - b_orig_index); } + if (a_orig_index >= 0) { + if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("both have exact match", a_orig_index > b_orig_index ? -1 : 1); } + if(a_orig_index != b_orig_index) { + if(CrystalDocs.DEBUG) { console.log("both have exact match at different positions", a_orig_index > b_orig_index ? 1 : -1); } + return a_orig_index > b_orig_index ? 1 : -1; + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has exact match, b not"); } + return -1; + } + } else if (b_orig_index >= 0) { + if(CrystalDocs.DEBUG) { console.log("b has exact match, a not"); } + return 1; + } + } + } else { + if(CrystalDocs.DEBUG) { console.log("a has match in name, b not"); } + return -1; + } + } else if ( + !a.matched_fields.includes("name") && + b.matched_fields.includes("name") + ) { + return 1; + } + + if (matchedTermsDiff != 0 || (aHasDocs != bHasDocs)) { + if(CrystalDocs.DEBUG) { console.log("matchedTermsDiff: " + matchedTermsDiff, aHasDocs, bHasDocs); } + return matchedTermsDiff; + } + + var matchedFieldsDiff = b.matched_fields.length - a.matched_fields.length; + if (matchedFieldsDiff != 0) { + if(CrystalDocs.DEBUG) { console.log("matched to different number of fields: " + matchedFieldsDiff); } + return matchedFieldsDiff > 0 ? 1 : -1; + } + + var nameCompare = a.name.localeCompare(b.name); + if(nameCompare != 0){ + if(CrystalDocs.DEBUG) { console.log("nameCompare resulted in: " + a.name + "<=>" + b.name + ": " + nameCompare); } + return nameCompare > 0 ? 1 : -1; + } + + if(a.matched_fields.includes("args") && b.matched_fields.includes("args")) { + for(var i = 0; i < query.terms.length; i++) { + var term = query.terms[i]; + var aIndex = a.args_string.indexOf(term); + var bIndex = b.args_string.indexOf(term); + if(CrystalDocs.DEBUG) { console.log("index of " + term + " in args_string: " + aIndex + " - " + bIndex); } + if(aIndex >= 0){ + if(bIndex >= 0){ + if(aIndex != bIndex){ + return aIndex > bIndex ? 1 : -1; + } + }else{ + return -1; + } + }else if(bIndex >= 0) { + return 1; + } + } + } + + return 0; + }); + + if (results.length > 1) { + // if we have more than two search terms, only include results with the most matches + var bestMatchedTerms = uniqueArray(results[0].matched_terms).length; + + results = results.filter(function(result) { + return uniqueArray(result.matched_terms).length + 1 >= bestMatchedTerms; + }); + } + return results; +}; + +CrystalDocs.prefixForType = function(type) { + switch (type) { + case "instance_method": + return "#"; + + case "class_method": + case "macro": + case "constructor": + return "."; + + default: + return false; + } +}; + +CrystalDocs.displaySearchResults = function(results, query) { + function sanitize(html){ + return html.replace(/<(?!\/?code)[^>]+>/g, ""); + } + + // limit results + if (results.length > CrystalDocs.MAX_RESULTS_DISPLAY) { + results = results.slice(0, CrystalDocs.MAX_RESULTS_DISPLAY); + } + + var $frag = document.createDocumentFragment(); + var $resultsElem = document.querySelector(".search-list"); + $resultsElem.innerHTML = ""; + + results.forEach(function(result, i) { + var url = CrystalDocs.base_path + result.href; + var type = false; + + var title = query.highlight(result.result_type == "type" ? result.full_name : result.name); + + var prefix = CrystalDocs.prefixForType(result.result_type); + if (prefix) { + title = "" + prefix + "" + title; + } + + title = "" + title + ""; + + if (result.args_string) { + title += + "" + query.highlight(result.args_string) + ""; + } + + $elem = document.createElement("li"); + $elem.className = "search-result search-result--" + result.result_type; + $elem.dataset.href = url; + $elem.setAttribute("title", result.full_name + " docs page"); + + var $title = document.createElement("div"); + $title.setAttribute("class", "search-result__title"); + var $titleLink = document.createElement("a"); + $titleLink.setAttribute("href", url); + + $titleLink.innerHTML = title; + $title.appendChild($titleLink); + $elem.appendChild($title); + $elem.addEventListener("click", function() { + $titleLink.click(); + }); + + if (result.result_type !== "type") { + var $type = document.createElement("div"); + $type.setAttribute("class", "search-result__type"); + $type.innerHTML = query.highlight(result.type); + $elem.appendChild($type); + } + + if(result.summary){ + var $doc = document.createElement("div"); + $doc.setAttribute("class", "search-result__doc"); + $doc.innerHTML = query.highlight(sanitize(result.summary)); + $elem.appendChild($doc); + } + + $elem.appendChild(document.createComment(JSON.stringify(result))); + $frag.appendChild($elem); + }); + + $resultsElem.appendChild($frag); + + CrystalDocs.toggleResultsList(true); +}; + +CrystalDocs.toggleResultsList = function(visible) { + if (visible) { + document.querySelector(".types-list").classList.add("hidden"); + document.querySelector(".search-results").classList.remove("hidden"); + } else { + document.querySelector(".types-list").classList.remove("hidden"); + document.querySelector(".search-results").classList.add("hidden"); + } +}; + +CrystalDocs.Query = function(string) { + this.original = string; + this.terms = string.split(/\s+/).filter(function(word) { + return CrystalDocs.Query.stripModifiers(word).length > 0; + }); + + var normalized = this.terms.map(CrystalDocs.Query.normalizeTerm); + this.normalizedTerms = normalized; + + function runMatcher(field, matcher) { + if (!field) { + return false; + } + var normalizedValue = CrystalDocs.Query.normalizeTerm(field); + + var matches = []; + normalized.forEach(function(term) { + if (matcher(normalizedValue, term)) { + matches.push(term); + } + }); + return matches.length > 0 ? matches : false; + } + + this.matches = function(field) { + return runMatcher(field, function(normalized, term) { + if (term[0] == "#" || term[0] == ".") { + return false; + } + return normalized.indexOf(term) >= 0; + }); + }; + + function namespaceMatcher(normalized, term){ + var i = term.indexOf(":"); + if(i >= 0){ + term = term.replace(/^::?|::?$/, ""); + var index = normalized.indexOf(term); + if((index == 0) || (index > 0 && normalized[index-1] == ":")){ + return true; + } + } + return false; + } + this.matchesMethod = function(name, kind, type) { + return runMatcher(name, function(normalized, term) { + var i = term.indexOf("#"); + if(i >= 0){ + if (kind != "instance_method") { + return false; + } + }else{ + i = term.indexOf("."); + if(i >= 0){ + if (kind != "class_method" && kind != "macro" && kind != "constructor") { + return false; + } + }else{ + //neither # nor . + if(term.indexOf(":") && namespaceMatcher(normalized, term)){ + return true; + } + } + } + + var methodName = term; + if(i >= 0){ + var termType = term.substring(0, i); + methodName = term.substring(i+1); + + if(termType != "") { + if(CrystalDocs.Query.normalizeTerm(type.full_name).indexOf(termType) < 0){ + return false; + } + } + } + return normalized.indexOf(methodName) >= 0; + }); + }; + + this.matchesNamespace = function(namespace){ + return runMatcher(namespace, namespaceMatcher); + }; + + this.highlight = function(string) { + if (typeof string == "undefined") { + return ""; + } + function escapeRegExp(s) { + return s.replace(/[.*+?\^${}()|\[\]\\]/g, "\\$&").replace(/^[#\.:]+/, ""); + } + return string.replace( + new RegExp("(" + this.normalizedTerms.map(escapeRegExp).join("|") + ")", "gi"), + "$1" + ); + }; +}; +CrystalDocs.Query.normalizeTerm = function(term) { + return term.toLowerCase(); +}; +CrystalDocs.Query.stripModifiers = function(term) { + switch (term[0]) { + case "#": + case ".": + case ":": + return term.substr(1); + + default: + return term; + } +} + +CrystalDocs.search = function(string) { + if(!CrystalDocs.searchIndex) { + console.log("CrystalDocs search index not initialized, delaying search"); + + document.addEventListener("CrystalDocs:loaded", function listener(){ + document.removeEventListener("CrystalDocs:loaded", listener); + CrystalDocs.search(string); + }); + return; + } + + document.dispatchEvent(new Event("CrystalDocs:searchStarted")); + + var query = new CrystalDocs.Query(string); + var results = CrystalDocs.runQuery(query); + results = CrystalDocs.rankResults(results, query); + CrystalDocs.displaySearchResults(results, query); + + document.dispatchEvent(new Event("CrystalDocs:searchPerformed")); +}; + +CrystalDocs.initializeIndex = function(data) { + CrystalDocs.searchIndex = data; + + document.dispatchEvent(new Event("CrystalDocs:loaded")); +}; + +CrystalDocs.loadIndex = function() { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function loadScript(file) { + script = document.createElement("script"); + script.src = file; + document.body.appendChild(script); + } + + function parseJSON(json) { + CrystalDocs.initializeIndex(JSON.parse(json)); + } + + for(var i = 0; i < document.scripts.length; i++){ + var script = document.scripts[i]; + if (script.src && script.src.indexOf("js/doc.js") >= 0) { + if (script.src.indexOf("file://") == 0) { + // We need to support JSONP files for the search to work on local file system. + var jsonPath = script.src.replace("js/doc.js", "search-index.js"); + loadScript(jsonPath); + return; + } else { + var jsonPath = script.src.replace("js/doc.js", "index.json"); + loadJSON(jsonPath, parseJSON); + return; + } + } + } + console.error("Could not find location of js/doc.js"); +}; + +// Callback for jsonp +function crystal_doc_search_index_callback(data) { + CrystalDocs.initializeIndex(data); +} + +Navigator = function(sidebar, searchInput, list, leaveSearchScope){ + this.list = list; + var self = this; + + var performingSearch = false; + + document.addEventListener('CrystalDocs:searchStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchDebounceStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDocs:searchPerformed', function(){ + performingSearch = false; + }); + document.addEventListener('CrystalDocs:searchDebounceStopped', function(event){ + performingSearch = false; + }); + + function delayWhileSearching(callback) { + if(performingSearch){ + document.addEventListener('CrystalDocs:searchPerformed', function listener(){ + document.removeEventListener('CrystalDocs:searchPerformed', listener); + + // add some delay to let search results display kick in + setTimeout(callback, 100); + }); + }else{ + callback(); + } + } + + function clearMoveTimeout() { + clearTimeout(self.moveTimeout); + self.moveTimeout = null; + } + + function startMoveTimeout(upwards){ + /*if(self.moveTimeout) { + clearMoveTimeout(); + } + + var go = function() { + if (!self.moveTimeout) return; + self.move(upwards); + self.moveTimeout = setTimeout(go, 600); + }; + self.moveTimeout = setTimeout(go, 800);*/ + } + + function scrollCenter(element) { + var rect = element.getBoundingClientRect(); + var middle = sidebar.clientHeight / 2; + sidebar.scrollTop += rect.top + rect.height / 2 - middle; + } + + var move = this.move = function(upwards){ + if(!this.current){ + this.highlightFirst(); + return true; + } + var next = upwards ? this.current.previousElementSibling : this.current.nextElementSibling; + if(next && next.classList) { + this.highlight(next); + scrollCenter(next); + return true; + } + return false; + }; + + this.moveRight = function(){ + }; + this.moveLeft = function(){ + }; + + this.highlight = function(elem) { + if(!elem){ + return; + } + this.removeHighlight(); + + this.current = elem; + this.current.classList.add("current"); + }; + + this.highlightFirst = function(){ + this.highlight(this.list.querySelector('li:first-child')); + }; + + this.removeHighlight = function() { + if(this.current){ + this.current.classList.remove("current"); + } + this.current = null; + } + + this.openSelectedResult = function() { + if(this.current) { + this.current.click(); + } + } + + this.focus = function() { + searchInput.focus(); + searchInput.select(); + this.highlightFirst(); + } + + function handleKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + case "i": + case "j": + case "k": + case "l": + case "c": + case "h": + case "t": + case "n": + event.stopPropagation(); + clearMoveTimeout(); + } + } + + function handleKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + self.openSelectedResult(); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + break; + case "j": + case "c": + case "ArrowUp": + if(event.ctrlKey || event.key == "ArrowUp") { + event.stopPropagation(); + self.move(true); + startMoveTimeout(true); + } + break; + case "k": + case "h": + case "ArrowDown": + if(event.ctrlKey || event.key == "ArrowDown") { + event.stopPropagation(); + self.move(false); + startMoveTimeout(false); + } + break; + case "k": + case "t": + case "ArrowLeft": + if(event.ctrlKey || event.key == "ArrowLeft") { + event.stopPropagation(); + self.moveLeft(); + } + break; + case "l": + case "n": + case "ArrowRight": + if(event.ctrlKey || event.key == "ArrowRight") { + event.stopPropagation(); + self.moveRight(); + } + break; + } + } + + function handleInputKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + clearMoveTimeout(); + } + } + + function handleInputKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + delayWhileSearching(function(){ + self.openSelectedResult(); + leaveSearchScope(); + }); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + // remove focus from search input + leaveSearchScope(); + sidebar.focus(); + break; + case "ArrowUp": + event.stopPropagation(); + event.preventDefault(); + self.move(true); + startMoveTimeout(true); + break; + + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + self.move(false); + startMoveTimeout(false); + break; + } + } + + sidebar.tabIndex = 100; // set tabIndex to enable keylistener + sidebar.addEventListener('keyup', function(event) { + handleKeyUp(event); + }); + sidebar.addEventListener('keydown', function(event) { + handleKeyDown(event); + }); + searchInput.addEventListener('keydown', function(event) { + handleInputKeyDown(event); + }); + searchInput.addEventListener('keyup', function(event) { + handleInputKeyUp(event); + }); + this.move(); +}; + +CrystalDocs.initializeVersions = function () { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function parseJSON(json) { + CrystalDocs.loadConfig(JSON.parse(json)); + } + + $elem = document.querySelector("html > head > meta[name=\"crystal_docs.json_config_url\"]") + if ($elem == undefined) { + return + } + jsonURL = $elem.getAttribute("content") + if (jsonURL && jsonURL != "") { + loadJSON(jsonURL, parseJSON); + } +} + +CrystalDocs.loadConfig = function (config) { + var projectVersions = config["versions"] + var currentVersion = document.querySelector("html > head > meta[name=\"crystal_docs.project_version\"]").getAttribute("content") + + var currentVersionInList = projectVersions.find(function (element) { + return element.name == currentVersion + }) + + if (!currentVersionInList) { + projectVersions.unshift({ name: currentVersion, url: '#' }) + } + + $version = document.querySelector(".project-summary > .project-version") + $version.innerHTML = "" + + $select = document.createElement("select") + $select.classList.add("project-versions-nav") + $select.addEventListener("change", function () { + window.location.href = this.value + }) + projectVersions.forEach(function (version) { + $item = document.createElement("option") + $item.setAttribute("value", version.url) + $item.append(document.createTextNode(version.name)) + + if (version.name == currentVersion) { + $item.setAttribute("selected", true) + $item.setAttribute("disabled", true) + } + $select.append($item) + }); + $form = document.createElement("form") + $form.setAttribute("autocomplete", "off") + $form.append($select) + $version.append($form) +} + +document.addEventListener("DOMContentLoaded", function () { + CrystalDocs.initializeVersions() +}) + +var UsageModal = function(title, content) { + var $body = document.body; + var self = this; + var $modalBackground = document.createElement("div"); + $modalBackground.classList.add("modal-background"); + var $usageModal = document.createElement("div"); + $usageModal.classList.add("usage-modal"); + $modalBackground.appendChild($usageModal); + var $title = document.createElement("h3"); + $title.classList.add("modal-title"); + $title.innerHTML = title + $usageModal.appendChild($title); + var $closeButton = document.createElement("span"); + $closeButton.classList.add("close-button"); + $closeButton.setAttribute("title", "Close modal"); + $closeButton.innerText = '×'; + $usageModal.appendChild($closeButton); + $usageModal.insertAdjacentHTML("beforeend", content); + + $modalBackground.addEventListener('click', function(event) { + var element = event.target || event.srcElement; + + if(element == $modalBackground) { + self.hide(); + } + }); + $closeButton.addEventListener('click', function(event) { + self.hide(); + }); + + $body.insertAdjacentElement('beforeend', $modalBackground); + + this.show = function(){ + $body.classList.add("js-modal-visible"); + }; + this.hide = function(){ + $body.classList.remove("js-modal-visible"); + }; + this.isVisible = function(){ + return $body.classList.contains("js-modal-visible"); + } +} + + +document.addEventListener('DOMContentLoaded', function() { + var sessionStorage; + try { + sessionStorage = window.sessionStorage; + } catch (e) { } + if(!sessionStorage) { + sessionStorage = { + setItem: function() {}, + getItem: function() {}, + removeItem: function() {} + }; + } + + var repositoryName = document.querySelector('[name=repository-name]').getAttribute('content'); + var typesList = document.querySelector('.types-list'); + var searchInput = document.querySelector('.search-input'); + var parents = document.querySelectorAll('.types-list li.parent'); + + var scrollSidebarToOpenType = function(){ + var openTypes = typesList.querySelectorAll('.current'); + if (openTypes.length > 0) { + var lastOpenType = openTypes[openTypes.length - 1]; + lastOpenType.scrollIntoView(!(window.matchMedia('only screen and (max-width: 635px)')).matches); + } + } + + scrollSidebarToOpenType(); + + var setPersistentSearchQuery = function(value){ + sessionStorage.setItem(repositoryName + '::search-input:value', value); + } + + for(var i = 0; i < parents.length; i++) { + var _parent = parents[i]; + _parent.addEventListener('click', function(e) { + e.stopPropagation(); + + if(e.target.tagName.toLowerCase() == 'li') { + if(e.target.className.match(/open/)) { + sessionStorage.removeItem(e.target.getAttribute('data-id')); + e.target.className = e.target.className.replace(/ +open/g, ''); + } else { + sessionStorage.setItem(e.target.getAttribute('data-id'), '1'); + if(e.target.className.indexOf('open') == -1) { + e.target.className += ' open'; + } + } + } + }); + + if(sessionStorage.getItem(_parent.getAttribute('data-id')) == '1') { + _parent.className += ' open'; + } + } + + var leaveSearchScope = function(){ + CrystalDocs.toggleResultsList(false); + window.focus(); + } + + var navigator = new Navigator(document.querySelector('.types-list'), searchInput, document.querySelector(".search-results"), leaveSearchScope); + + CrystalDocs.loadIndex(); + var searchTimeout; + var lastSearchText = false; + var performSearch = function() { + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStarted")); + + clearTimeout(searchTimeout); + searchTimeout = setTimeout(function() { + var text = searchInput.value; + + if(text == "") { + CrystalDocs.toggleResultsList(false); + }else if(text == lastSearchText){ + document.dispatchEvent(new Event("CrystalDocs:searchDebounceStopped")); + }else{ + CrystalDocs.search(text); + navigator.highlightFirst(); + searchInput.focus(); + } + lastSearchText = text; + setPersistentSearchQuery(text); + }, 200); + }; + + if(location.hash.length > 3 && location.hash.substring(0,3) == "#q="){ + // allows directly linking a search query which is then executed on the client + // this comes handy for establishing a custom browser search engine with https://crystal-lang.org/api/#q=%s as a search URL + // TODO: Add OpenSearch description + var searchQuery = location.hash.substring(3); + history.pushState({searchQuery: searchQuery}, "Search for " + searchQuery, location.href.replace(/#q=.*/, "")); + searchInput.value = searchQuery; + document.addEventListener('CrystalDocs:loaded', performSearch); + } + + if (searchInput.value.length == 0) { + var searchText = sessionStorage.getItem(repositoryName + '::search-input:value'); + if(searchText){ + searchInput.value = searchText; + } + } + searchInput.addEventListener('keyup', performSearch); + searchInput.addEventListener('input', performSearch); + + var usageModal = new UsageModal('Keyboard Shortcuts', '' + + 'A Coordinates
is a position in longitude, latitude, and (optionally) altitude.
Creates a new Coordinates
with the given longitude, latitude and altitude.
Creates a new Coordinates
with the given coordinates array.
Deserializes a Coordinates
from the given JSON parser.
Returns true
if this reference is the same as other.
Gets this Coordinates' altitude.
","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":46,"url":null},"def":{"name":"altitude","visibility":"Public","body":"coordinates[2]?"}},{"html_id":"coordinates:Array(Float64)-instance-method","name":"coordinates","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":7,"url":null},"def":{"name":"coordinates","return_type":"Array(Float64)","visibility":"Public","body":"@coordinates"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
Gets this Coordinates' latitude in decimal degrees according to WGS84.
","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":38,"url":null},"def":{"name":"latitude","visibility":"Public","body":"coordinates[1]"}},{"html_id":"longitude-instance-method","name":"longitude","doc":"Gets this Coordinates' longitude in decimal degrees according to WGS84.","summary":"Gets this Coordinates' longitude in decimal degrees according to WGS84.
","abstract":false,"location":{"filename":"src/geojson/coordinates.cr","line_number":33,"url":null},"def":{"name":"longitude","visibility":"Public","body":"coordinates[0]"}},{"html_id":"to_json(*args,**options)-instance-method","name":"to_json","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/coordinates.cr","line_number":56,"url":null},"def":{"name":"to_json","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.to_json(*args, **options)"}},{"html_id":"to_json(*args,**options,&)-instance-method","name":"to_json","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/coordinates.cr","line_number":56,"url":null},"def":{"name":"to_json","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.to_json(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"html_id":"geojson/GeoJSON/Exception","path":"GeoJSON/Exception.html","kind":"class","full_name":"GeoJSON::Exception","name":"Exception","abstract":false,"superclass":{"html_id":"geojson/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"geojson/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/exception.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"Raised when an attempt is made to create a GeoJSON object that is malformed.\n\nIn most cases, this means that the given coordinates for a geometry object\ndon't fulfill the requirements for that geometry type.","summary":"Raised when an attempt is made to create a GeoJSON object that is malformed.
"},{"html_id":"geojson/GeoJSON/Feature","path":"GeoJSON/Feature.html","kind":"class","full_name":"GeoJSON::Feature","name":"Feature","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/feature.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `Feature` represents a [GeoJSON Feature object](https://tools.ietf.org/html/rfc7946#section-3.2)\nwith a geometry and properties.","summary":"A Feature
represents a GeoJSON Feature object with a geometry and properties.
A Feature
represents a GeoJSON Feature object with a geometry and properties.
Creates a new Feature
with the given geometry and optional properties, id, and bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this Feature's geometry.
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":12,"url":null},"def":{"name":"geometry","return_type":"GeoJSON::Object::Type | ::Nil","visibility":"Public","body":"@geometry"}},{"html_id":"id:String|Int32|Nil-instance-method","name":"id","doc":"Gets this Feature's id.","summary":"Gets this Feature's id.
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":19,"url":null},"def":{"name":"id","return_type":"String | Int32 | Nil","visibility":"Public","body":"@id"}},{"html_id":"properties:Hash(String,JSON::Any::Type)|Nil-instance-method","name":"properties","doc":"Gets this Feature's properties.","summary":"Gets this Feature's properties.
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":16,"url":null},"def":{"name":"properties","return_type":"Hash(String, JSON::Any::Type) | ::Nil","visibility":"Public","body":"@properties"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this Feature's GeoJSON type (\"Feature\")","summary":"Gets this Feature's GeoJSON type ("Feature")
","abstract":false,"location":{"filename":"src/geojson/feature.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/FeatureCollection","path":"GeoJSON/FeatureCollection.html","kind":"class","full_name":"GeoJSON::FeatureCollection","name":"FeatureCollection","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/feature_collection.cr","line_number":4,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `FeatureCollection` represents a [GeoJSON FeatureCollection object](https://tools.ietf.org/html/rfc7946#section-3.3)\nand contains one or more `Feature`s.","summary":"A FeatureCollection
represents a GeoJSON FeatureCollection object and contains one or more Feature
s.
A FeatureCollection
represents a GeoJSON FeatureCollection object and contains one or more Feature
s.
Creates a new FeatureCollection
with the given features.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this FeatureCollections
array of features.
Gets this FeatureCollection's GeoJSON type ("FeatureCollection")
","abstract":false,"location":{"filename":"src/geojson/feature_collection.cr","line_number":6,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/GeometryCollection","path":"GeoJSON/GeometryCollection.html","kind":"class","full_name":"GeoJSON::GeometryCollection","name":"GeometryCollection","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/geometry_collection.cr","line_number":10,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `GeometryCollection` represents a collection of several geometries.\n\nIts array of geometries can contain `Point`, `MultiPoint`, `LineString`,\n`MultiLineString`, `Polygon`, and `MultiPolygon`. Technically, you can nest\n`GeometryCollection`s inside one another, but this is discouraged by the\nspecification.\n\nThis class corresponds to the [GeoJSON GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8).","summary":"A GeometryCollection
represents a collection of several geometries.
Deserializes a GeometryCollection
from the given JSON parser.
Creates a new GeometryCollection
containing the given geometries and optional bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of the geometries in this GeometryCollection
Gets this GeometryCollection's GeoJSON type ("GeometryCollection")
","abstract":false,"location":{"filename":"src/geojson/geometry_collection.cr","line_number":12,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/LineString","path":"GeoJSON/LineString.html","kind":"class","full_name":"GeoJSON::LineString","name":"LineString","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/line_string.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `LineString` is a `Geometry` representing two or more points in geographic\nspace connected consecutively by lines.\n\nThis class corresponds to the [GeoJSON LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4).","summary":"A LineString
is a Geometry
representing two or more points in geographic space connected consecutively by lines.
A LineString
is a Geometry
representing two or more points in geographic space connected consecutively by lines.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Create a new LineString
with the given coordinates and optional bounding box bbox.
Gets the LineString vertex at the given index.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/line_string.cr","line_number":14,"url":null},"def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates[*args, **options]"}},{"html_id":"[](*args,**options,&)-instance-method","name":"[]","doc":"Gets the LineString vertex at the given index.","summary":"Gets the LineString vertex at the given index.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/line_string.cr","line_number":14,"url":null},"def":{"name":"[]","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.[](*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"bbox-instance-method","name":"bbox","doc":"Calculates the bounding box for any GeoJSON object, including `FeatureCollection`.","summary":"Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Gets this LineString's GeoJSON type ("LineString")
","abstract":false,"location":{"filename":"src/geojson/line_string.cr","line_number":11,"url":null},"def":{"name":"coordinates","return_type":"Array(Coordinates)","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this LineString's GeoJSON type (\"LineString\")","summary":"Gets this LineString's GeoJSON type ("LineString")
","abstract":false,"location":{"filename":"src/geojson/line_string.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/MultiLineString","path":"GeoJSON/MultiLineString.html","kind":"class","full_name":"GeoJSON::MultiLineString","name":"MultiLineString","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/multi_line_string.cr","line_number":5,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `MultiLineString` is a `Geometry` representing several `LineString`s.\n\nThis class corresponds to the [GeoJSON MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5).","summary":"A MultiLineString
is a Geometry
representing several LineString
s.
A MultiLineString
is a Geometry
representing several LineString
s.
Create a new MultiLineString
with the given coordinates and optional bounding box bbox.
Create a new MultiLineString
with the given coordinates and optional bounding box bbox.
Adds the given line_string to this MultiLineString.
","abstract":false,"args":[{"name":"line_string","external_name":"line_string","restriction":"Array(LineString)"}],"args_string":"(line_string : Array(LineString))","args_html":"(line_string : Array(LineString))","location":{"filename":"src/geojson/multi_line_string.cr","line_number":29,"url":null},"def":{"name":"<<","args":[{"name":"line_string","external_name":"line_string","restriction":"Array(LineString)"}],"visibility":"Public","body":"@coordinates << line_string"}},{"html_id":"<<(coordinate:Array(Array(Float64)))-instance-method","name":"<<","doc":"Adds the given *coordinate* to this MultiLineString.","summary":"Adds the given coordinate to this MultiLineString.
","abstract":false,"args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Float64))"}],"args_string":"(coordinate : Array(Array(Float64)))","args_html":"(coordinate : Array(Array(Float64)))","location":{"filename":"src/geojson/multi_line_string.cr","line_number":34,"url":null},"def":{"name":"<<","args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Float64))"}],"visibility":"Public","body":"@coordinates << (LineString.new(coordinate)).coordinates"}},{"html_id":"[](*args,**options)-instance-method","name":"[]","doc":"Gets the `LineString` at the given index.","summary":"Gets the LineString
at the given index.
Gets the LineString
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiLineString's coordinates.
","abstract":false,"location":{"filename":"src/geojson/multi_line_string.cr","line_number":10,"url":null},"def":{"name":"coordinates","return_type":"Array(Array(GeoJSON::Coordinates))","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this MultiLineString's GeoJSON type (\"MultiLineString\")","summary":"Gets this MultiLineString's GeoJSON type ("MultiLineString")
","abstract":false,"location":{"filename":"src/geojson/multi_line_string.cr","line_number":7,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/MultiPoint","path":"GeoJSON/MultiPoint.html","kind":"class","full_name":"GeoJSON::MultiPoint","name":"MultiPoint","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/multi_point.cr","line_number":5,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `MultiPoint` is a `Geometry` representing several `Point`s.\n\nThis class corresponds to the [GeoJSON MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3).","summary":"A MultiPoint
is a Geometry
representing several Point
s.
A MultiPoint
is a Geometry
representing several Point
s.
Create a new MultiPoint
with the given coordinates and optional bounding box bbox.
Create a new MultiPoint
with the given coordinates and optional bounding box bbox.
Adds the given point to this MultiPoint.
","abstract":false,"args":[{"name":"point","external_name":"point","restriction":"Array(Point)"}],"args_string":"(point : Array(Point))","args_html":"(point : Array(Point))","location":{"filename":"src/geojson/multi_point.cr","line_number":29,"url":null},"def":{"name":"<<","args":[{"name":"point","external_name":"point","restriction":"Array(Point)"}],"visibility":"Public","body":"@coordinates << point.coordinates"}},{"html_id":"<<(coordinate:Array(Float64))-instance-method","name":"<<","doc":"Adds the given *coordinate* to this MultiPoint.","summary":"Adds the given coordinate to this MultiPoint.
","abstract":false,"args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Float64)"}],"args_string":"(coordinate : Array(Float64))","args_html":"(coordinate : Array(Float64))","location":{"filename":"src/geojson/multi_point.cr","line_number":34,"url":null},"def":{"name":"<<","args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Float64)"}],"visibility":"Public","body":"@coordinates << (Point.new(coordinate)).coordinates"}},{"html_id":"[](*args,**options)-instance-method","name":"[]","doc":"Gets the `Point` at the given index.","summary":"Gets the Point
at the given index.
Gets the Point
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPoint's coordinates.
","abstract":false,"location":{"filename":"src/geojson/multi_point.cr","line_number":10,"url":null},"def":{"name":"coordinates","return_type":"Array(Coordinates)","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this MultiPoint's GeoJSON type (\"MultiPoint\")","summary":"Gets this MultiPoint's GeoJSON type ("MultiPoint")
","abstract":false,"location":{"filename":"src/geojson/multi_point.cr","line_number":7,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/MultiPolygon","path":"GeoJSON/MultiPolygon.html","kind":"class","full_name":"GeoJSON::MultiPolygon","name":"MultiPolygon","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/multi_polygon.cr","line_number":5,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `MultiPolygon` is a `Geometry` representing several `Polygon`s.\n\nThis class corresponds to the [GeoJSON MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7).","summary":"A MultiPolygon
is a Geometry
representing several Polygon
s.
A MultiPolygon
is a Geometry
representing several Polygon
s.
Create a new MultiPolygon
with the given coordinates and optional bounding box bbox.
Create a new MultiPolygon
with the given coordinates and optional bounding box bbox.
Adds the given polygon to this MultiPolygon.
","abstract":false,"args":[{"name":"polygon","external_name":"polygon","restriction":"Array(Polygon)"}],"args_string":"(polygon : Array(Polygon))","args_html":"(polygon : Array(Polygon))","location":{"filename":"src/geojson/multi_polygon.cr","line_number":29,"url":null},"def":{"name":"<<","args":[{"name":"polygon","external_name":"polygon","restriction":"Array(Polygon)"}],"visibility":"Public","body":"@coordinates << polygon.coordinates"}},{"html_id":"<<(coordinate:Array(Array(Array(Float64))))-instance-method","name":"<<","doc":"Adds the given *coordinate* to this MultiPolygon.","summary":"Adds the given coordinate to this MultiPolygon.
","abstract":false,"args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Array(Float64)))"}],"args_string":"(coordinate : Array(Array(Array(Float64))))","args_html":"(coordinate : Array(Array(Array(Float64))))","location":{"filename":"src/geojson/multi_polygon.cr","line_number":34,"url":null},"def":{"name":"<<","args":[{"name":"coordinate","external_name":"coordinate","restriction":"Array(Array(Array(Float64)))"}],"visibility":"Public","body":"@coordinates << (Polygon.new(coordinate)).coordinates"}},{"html_id":"[](*args,**options)-instance-method","name":"[]","doc":"Gets the `Polygon` at the given index.","summary":"Gets the Polygon
at the given index.
Gets the Polygon
at the given index.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns an array of this MultiPolygon's coordinates.
","abstract":false,"location":{"filename":"src/geojson/multi_polygon.cr","line_number":10,"url":null},"def":{"name":"coordinates","return_type":"Array(Array(Array(GeoJSON::Coordinates)))","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this MultiPolygon's GeoJSON type (\"MultiPolygon\")","summary":"Gets this MultiPolygon's GeoJSON type ("MultiPolygon")
","abstract":false,"location":{"filename":"src/geojson/multi_polygon.cr","line_number":7,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/Object","path":"GeoJSON/Object.html","kind":"class","full_name":"GeoJSON::Object","name":"Object","abstract":true,"superclass":{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/object.cr","line_number":14,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"}],"subclasses":[{"html_id":"geojson/GeoJSON/Feature","kind":"class","full_name":"GeoJSON::Feature","name":"Feature"},{"html_id":"geojson/GeoJSON/FeatureCollection","kind":"class","full_name":"GeoJSON::FeatureCollection","name":"FeatureCollection"},{"html_id":"geojson/GeoJSON/GeometryCollection","kind":"class","full_name":"GeoJSON::GeometryCollection","name":"GeometryCollection"},{"html_id":"geojson/GeoJSON/LineString","kind":"class","full_name":"GeoJSON::LineString","name":"LineString"},{"html_id":"geojson/GeoJSON/MultiLineString","kind":"class","full_name":"GeoJSON::MultiLineString","name":"MultiLineString"},{"html_id":"geojson/GeoJSON/MultiPoint","kind":"class","full_name":"GeoJSON::MultiPoint","name":"MultiPoint"},{"html_id":"geojson/GeoJSON/MultiPolygon","kind":"class","full_name":"GeoJSON::MultiPolygon","name":"MultiPolygon"},{"html_id":"geojson/GeoJSON/Point","kind":"class","full_name":"GeoJSON::Point","name":"Point"},{"html_id":"geojson/GeoJSON/Polygon","kind":"class","full_name":"GeoJSON::Polygon","name":"Polygon"}],"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"GeoJSON Object\n\nA GeoJSON object represents a Geometry, Feature, or collection of Features.\n\n* A GeoJSON object is a JSON object.\n* A GeoJSON object has a member with the name \"type\". The value of\n the member MUST be one of the GeoJSON types.\n `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`,\n `GeometryCollection`, `Feature`, and `FeatureCollection`\n* A GeoJSON object MAY have a \"bbox\" member, the value of which MUST\n be a bounding box array\n* A GeoJSON object MAY have other members","summary":"GeoJSON Object
","constructors":[{"html_id":"new(pull:JSON::PullParser)-class-method","name":"new","abstract":false,"args":[{"name":"pull","external_name":"pull","restriction":"::JSON::PullParser"}],"args_string":"(pull : JSON::PullParser)","args_html":"(pull : JSON::PullParser)","location":{"filename":"src/geojson/object.cr","line_number":28,"url":null},"def":{"name":"new","args":[{"name":"pull","external_name":"pull","restriction":"::JSON::PullParser"}],"visibility":"Public","body":"location = pull.location\ndiscriminator_value = nil\njson = String.build do |io|\n JSON.build(io) do |builder|\n builder.start_object\n pull.read_object do |key|\n if key == \"type\"\n value_kind = pull.kind\n case value_kind\n when .string?\n discriminator_value = pull.string_value\n when .int?\n discriminator_value = pull.int_value\n when .bool?\n discriminator_value = pull.bool_value\n else\n raise(::JSON::SerializableError.new(\"JSON discriminator field 'type' has an invalid value type of #{value_kind.to_s}\", to_s, nil, *location, nil))\n end\n builder.field(key, discriminator_value)\n pull.read_next\n else\n builder.field(key) do\n pull.read_raw(builder)\n end\n end\n end\n builder.end_object\n end\nend\nif discriminator_value\nelse\n raise(::JSON::SerializableError.new(\"Missing JSON discriminator field 'type'\", to_s, nil, *location, nil))\nend\ncase discriminator_value\nwhen \"Point\"\n Point.from_json(json)\nwhen \"MultiPoint\"\n MultiPoint.from_json(json)\nwhen \"LineString\"\n LineString.from_json(json)\nwhen \"MultiLineString\"\n MultiLineString.from_json(json)\nwhen \"Polygon\"\n Polygon.from_json(json)\nwhen \"MultiPolygon\"\n MultiPolygon.from_json(json)\nelse\n raise(::JSON::SerializableError.new(\"Unknown 'type' discriminator value: #{discriminator_value.inspect}\", to_s, nil, *location, nil))\nend\n"}}],"instance_methods":[{"html_id":"bbox-instance-method","name":"bbox","doc":"Calculates the bounding box for any GeoJSON object, including `FeatureCollection`.","summary":"Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
All possible GeoJSON types.
"}]},{"html_id":"geojson/GeoJSON/Point","path":"GeoJSON/Point.html","kind":"class","full_name":"GeoJSON::Point","name":"Point","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/point.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `Point` is a `Geometry` representing a single `Position` in geographic\nspace.\n\nThis class corresponds to the [GeoJSON Point](https://tools.ietf.org/html/rfc7946#section-3.1.2).","summary":"A Point
is a Geometry
representing a single Position
in geographic space.
Creates a new Point
at the given longitude, latitude, and optional altitude, and with optional bounding box bbox.
A Point
is a Geometry
representing a single Position
in geographic space.
Creates a new Point
with the given coordinates and optional bounding box bbox.
Creates a new Point
with the given coordinates and optional bounding box bbox.
Returns true
if this reference is the same as other.
Gets this Point's altitude.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/point.cr","line_number":43,"url":null},"def":{"name":"altitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.altitude(*args, **options)"}},{"html_id":"altitude(*args,**options,&)-instance-method","name":"altitude","doc":"Gets this Point's altitude.\n\nTechnically, this positional value is meant to be the height in meters\nabove the WGS84 ellipsoid.","summary":"Gets this Point's altitude.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/point.cr","line_number":43,"url":null},"def":{"name":"altitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.altitude(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"bbox-instance-method","name":"bbox","doc":"Calculates the bounding box for any GeoJSON object, including `FeatureCollection`.","summary":"Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this Point's coordinates.
","abstract":false,"location":{"filename":"src/geojson/point.cr","line_number":11,"url":null},"def":{"name":"coordinates","return_type":"Coordinates","visibility":"Public","body":"@coordinates"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"See Object#hash(hasher)
Gets this Point's latitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/point.cr","line_number":38,"url":null},"def":{"name":"latitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.latitude(*args, **options)"}},{"html_id":"latitude(*args,**options,&)-instance-method","name":"latitude","doc":"Gets this Point's latitude in decimal degrees according to WGS84.","summary":"Gets this Point's latitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/point.cr","line_number":38,"url":null},"def":{"name":"latitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.latitude(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"longitude(*args,**options)-instance-method","name":"longitude","doc":"Gets this Point's longitude in decimal degrees according to WGS84.","summary":"Gets this Point's longitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/geojson/point.cr","line_number":36,"url":null},"def":{"name":"longitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"coordinates.longitude(*args, **options)"}},{"html_id":"longitude(*args,**options,&)-instance-method","name":"longitude","doc":"Gets this Point's longitude in decimal degrees according to WGS84.","summary":"Gets this Point's longitude in decimal degrees according to WGS84.
","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/geojson/point.cr","line_number":36,"url":null},"def":{"name":"longitude","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"coordinates.longitude(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this Point's GeoJSON type (\"Point\")","summary":"Gets this Point's GeoJSON type ("Point")
","abstract":false,"location":{"filename":"src/geojson/point.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]},{"html_id":"geojson/GeoJSON/Polygon","path":"GeoJSON/Polygon.html","kind":"class","full_name":"GeoJSON::Polygon","name":"Polygon","abstract":false,"superclass":{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},"ancestors":[{"html_id":"geojson/GeoJSON/Object","kind":"class","full_name":"GeoJSON::Object","name":"Object"},{"html_id":"geojson/JSON/Serializable/Unmapped","kind":"module","full_name":"JSON::Serializable::Unmapped","name":"Unmapped"},{"html_id":"geojson/JSON/Serializable","kind":"module","full_name":"JSON::Serializable","name":"Serializable"},{"html_id":"geojson/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"geojson/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/geojson/polygon.cr","line_number":6,"url":null}],"repository_name":"geojson","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"geojson/GeoJSON","kind":"module","full_name":"GeoJSON","name":"GeoJSON"},"doc":"A `Polygon` is a `Geometry` representing a closed geometric figure in\ngeographic space with optional holes within it.\n\nThis class corresponds to the [GeoJSON Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6).","summary":"A Polygon
is a Geometry
representing a closed geometric figure in geographic space with optional holes within it.
A Polygon
is a Geometry
representing a closed geometric figure in geographic space with optional holes within it.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Creates a new Polygon
with the given coordinates and optional bounding box bbox.
Calculates the bounding box for any GeoJSON object, including FeatureCollection
.
Returns this Polygon's linear ring coordinates.
","abstract":false,"location":{"filename":"src/geojson/polygon.cr","line_number":11,"url":null},"def":{"name":"coordinates","return_type":"Array(Array(Coordinates))","visibility":"Public","body":"@coordinates"}},{"html_id":"type:String-instance-method","name":"type","doc":"Gets this Polygon's GeoJSON type (\"Polygon\")","summary":"Gets this Polygon's GeoJSON type ("Polygon")
","abstract":false,"location":{"filename":"src/geojson/polygon.cr","line_number":8,"url":null},"def":{"name":"type","return_type":"String","visibility":"Public","body":"@type"}}]}]}]}}) \ No newline at end of file