MaplyVectorDatabase
@interface MaplyVectorDatabase : NSObject
The Maply Vector Database holds reference to a group of features that you can query.
This object wraps more complex database-like objects that contain geometric features. Primarily, that’s just shapefiles.
You can set this up and then query the database for features you’d like back. There’s an option to make a SQL query or you can just fetch all the vectors at once.
The point of this object is to keep most features out of memory until needed. However, a better way of doing that is probably using the MaplyPagingLayer.
-
Construct from a shapefile in the bundle
Construct a MaplyVectorDatabase form a shapefile found in the app’s bundle. This will create a bounding box cache file and a sqlite database for the attributes to speed later lookups.
Declaration
Objective-C
+ (MaplyVectorDatabase *_Nonnull)vectorDatabaseWithShape: (NSString *_Nonnull)shapeName;
-
Construct from a shapefile in the bundle
Construct a MaplyVectorDatabase form a shapefile found in the app’s bundle. This will create a bounding box cache file and a sqlite database for the attributes to speed later lookups.
Declaration
Objective-C
- (nonnull instancetype)initWithShape:(NSString *_Nonnull)shapeName;
Swift
init(shape shapeName: String)
-
Construct from a shapfile in the apps documents
Construct a MaplyVectorDabase from a shapefile found in the app’s bundle. This will create a bounding box cache file and a sqlite database for the attributes to speed later lookups.
Declaration
Objective-C
- (nonnull instancetype)initWithShapefileInDocuments: (NSString *_Nonnull)shapeName;
Swift
init(shapefileInDocuments shapeName: String)
-
Return vectors that match the given SQL query
Run a SQL query on the data, looking for vectors that match. These will be returned in a single MaplyVectorObject, or nil if there are none.
Declaration
Objective-C
- (MaplyVectorObject *_Nullable)fetchMatchingVectors: (NSString *_Nonnull)sqlQuery;
Swift
func fetch(matchingVectors sqlQuery: String) -> MaplyVectorObject?
-
Search for all the areals that surround the given point (geographic)
First this method does a bounding box check to eliminate areal features that won’t overlap at all. Then it runs a point in poly test on each feature that might. Every areal feature that overlaps is returned in the MaplyVectorObject.
Declaration
Objective-C
- (MaplyVectorObject *_Nullable)fetchArealsForPoint:(MaplyCoordinate)coord;
Swift
func fetchAreals(forPoint coord: MaplyCoordinate) -> MaplyVectorObject?
-
Return all the vectors in the database.
This method reads all the vectors in the database sequentially and returns them all in a MaplyVectorObject. This is basically how you read a shapefile in WhirlyGlobe-Maply.
Declaration
Objective-C
- (MaplyVectorObject *_Nullable)fetchAllVectors;
Swift
func fetchAllVectors() -> MaplyVectorObject?