GeoJSON is used to create Google Maps API v3 vectors (Marker, Polyline, Polygon) from GeoJSON objects (Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, Feature, GeometryCollection, FeatureCollection). Specifically, I'm translating some GeoJSON types to arrays of Google Maps vectors as there aren't really Google Maps equivalents of MultiPoint, MultiLineString, etc.
Constructor Parameters
@param {Object} geojson
A valid GeoJSON object. One of Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, Feature, GeometryCollection, FeatureCollection. See the official GeoJSON spec for more details. GeoJSON examples below.
@param? {Object} options - Optional
Options for the specific type of Google Maps vector (Marker, Polyline, Polygon). If none specified, boring black vectors and red markers will be created - Optional. Samples Below.
GeoJSON -> Google Maps equivalents
GeoJSON Type
Output
Point
google.maps.Point
LineString
google.maps.Polyline
Polygon
google.maps.Polygon
MultiPoint
Array of google.maps.Point
MultiLineString
Array of google.maps.Polyline
MultiPolygon
Array of google.maps.Polygon
Feature
google.maps.[Point,Polyline,Polygon] (depends on Feature geometry type)
FeatureCollection
Array of google.maps.[Point,Polyline,Polygon] (depends on Feature geometry type)
GeometryCollection
Array of google.maps.[Point,Polyline,Polygon] (depends on geometry type)
请发表评论