GLMapVectorObject

Objective-C


@interface GLMapVectorObject : GLMapTagsContainer <NSCopying>

Swift

class GLMapVectorObject : GLMapTagsContainer, NSCopying

GLMapVectorObject is a bridge class to work with GLMap’s internal representation of a vector object.

Properties

  • Reference point of the object in internal map coordinates. For point objects, this is the point itself. For lines/polygons, this is a representative point used for labeling/search.

    Declaration

    Objective-C

    @property (readonly) GLMapPoint point;

    Swift

    var point: GLMapPoint { get }
  • Bounding box of the object (internal map coordinates).

    Declaration

    Objective-C

    @property (readonly) GLMapBBox bbox;

    Swift

    var bbox: GLMapBBox { get }
  • Resolved draw attributes after last update.

    Declaration

    Objective-C

    @property (strong) GLMapVectorStyle *_Nullable drawAttributes;

    Swift

    var drawAttributes: GLMapVectorStyle? { get set }

Static Methods

  • Creates an array of vector objects from GeoJSON data.

    Declaration

    Objective-C

    + (GLMapVectorObjectArray *_Nullable)
        createVectorObjectsFromGeoJSONData:(nonnull NSData *)geoJSONData
                                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func createVectorObjects(fromGeoJSONData geoJSONData: Data) throws -> GLMapVectorObjectArray

    Parameters

    geoJSONData

    GeoJSON data.

    error

    Output: error if parsing fails.

    Return Value

    Array of vector objects, or nil on error.

  • Creates an array of vector objects from a GeoJSON string.

    Declaration

    Objective-C

    + (GLMapVectorObjectArray *_Nullable)
        createVectorObjectsFromGeoJSON:(nonnull NSString *)geoJSON
                                 error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func createVectorObjects(fromGeoJSON geoJSON: String) throws -> GLMapVectorObjectArray

    Parameters

    geoJSON

    GeoJSON string.

    error

    Output: error if parsing fails.

    Return Value

    Array of vector objects, or nil on error.

  • Creates an array of vector objects from a GeoJSON file.

    Declaration

    Objective-C

    + (GLMapVectorObjectArray *_Nullable)
        createVectorObjectsFromFile:(nonnull NSString *)filePath
                              error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func createVectorObjects(fromFile filePath: String) throws -> GLMapVectorObjectArray

    Parameters

    filePath

    Path to a GeoJSON file.

    error

    Output: error if parsing fails.

    Return Value

    Array of vector objects, or nil on error.

  • Streamed parsing of a GeoJSON file.

    Declaration

    Objective-C

    + (BOOL)enumVectorObjectsFromFile:(nonnull NSString *)filePath
                          objectBlock:(nonnull GLMapVectorObjectBlock)objectBlock
                                error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func enumVectorObjects(fromFile filePath: String, objectBlock: @escaping GLMapVectorObjectBlock) throws

    Parameters

    filePath

    Path to a GeoJSON file.

    objectBlock

    Block called for each parsed object.

    error

    Output: error if parsing fails.

    Return Value

    YES if parsing succeeds, otherwise NO.

Methods

  • Finds the nearest point on the object to the given point.

    Declaration

    Objective-C

    - (BOOL)findNearestPoint:(nonnull GLMapPoint *)nearestPoint
                     toPoint:(GLMapPoint)point
                 maxDistance:(CGFloat)distance;

    Swift

    func findNearestPoint(_ nearestPoint: UnsafeMutablePointer<GLMapPoint>, to point: GLMapPoint, maxDistance distance: CGFloat) -> Bool

    Parameters

    nearestPoint

    Output: nearest point on the object (internal map coordinates).

    point

    Reference point (internal map coordinates).

    distance

    Maximum search distance in internal map units.

    Return Value

    YES if a point within distance is found, otherwise NO.

  • Compare with other object.

    Declaration

    Objective-C

    - (NSComparisonResult)compare:(nonnull id)object;

    Swift

    func compare(_ object: Any) -> ComparisonResult
  • Useful for debugging.

    Declaration

    Objective-C

    - (nonnull NSString *)debugDescription;

    Swift

    func debugDescription() -> String
  • GeoJSON representation of the vector object.

    Declaration

    Objective-C

    - (nonnull NSString *)asGeoJSON;

    Swift

    func asGeoJSON() -> String

GLSearch

  • Category of the object (filled by GLSearch / GLSearchCategories).

    Declaration

    Objective-C

    @property (strong) GLSearchCategory *_Nullable searchCategory;

    Swift

    var searchCategory: GLSearchCategory? { get set }
  • Result types, for example ["poi", "cafe"].

    Declaration

    Objective-C

    @property (strong, readonly, nullable) NSArray<GLMapValue *> *searchTypes;

    Swift

    var searchTypes: [GLMapValue]? { get }
  • Short address context displayed below the title.

    Declaration

    Objective-C

    @property (strong, readonly, nullable) GLMapValue *searchSecondaryText;

    Swift

    var searchSecondaryText: GLMapValue? { get }
  • Returns all address names associated with the object.

    Declaration

    Objective-C

    - (NSArray<GLMapValue *> *_Nullable)localizedAddressNames:
        (GLMapLocaleSettings *_Nonnull)localeSettings;

    Swift

    func localizedAddressNames(_ localeSettings: GLMapLocaleSettings) -> [GLMapValue]?

    Parameters

    localeSettings

    Locale settings used to find the name.

    Return Value

    Array of address names.

  • Returns the address for the vector object.

    Declaration

    Objective-C

    - (GLMapValue *_Nullable)addressWithStyle:(GLSearchAddressStyle)style
                               localeSettings:
                                   (GLMapLocaleSettings *_Nonnull)localeSettings;

    Swift

    func address(with style: GLSearchAddressStyle, localeSettings: GLMapLocaleSettings) -> GLMapValue?

    Parameters

    style

    Address information requested.

    localeSettings

    Locale settings to use.

    Return Value

    Returns a value with address data.

  • Search score of the vector object obtained from GLSearch. Can be used to sort results.

    Declaration

    Objective-C

    - (NSInteger)searchScore;

    Swift

    func searchScore() -> Int

    Return Value

    An internal score value (higher usually means more relevant).

  • Compares tags in vector objects and tag filters from the category and returns a dictionary of matched tags.

    Declaration

    Objective-C

    - (NSDictionary<NSNumber *, GLMapValue *> *_Nullable)matchedCategoryTags;

    Swift

    func matchedCategoryTags() -> [NSNumber : GLMapValue]?

    Return Value

    Dictionary of matched tags keyed by tag hash.