SGLayer


Updates and retrieves records that are within a layer.

Conforms to: SGLocationServiceDelegate
Superclass: NSObject
Declared In: SGLayer.h

Discussion

A layer object has the ability to update and retrieve records that are already registered with the object. By adding the layer as a delegate to the SGLocationService , the layer will do its best to update the record once information is recieved about it. If the layer recieves a record that isn't already registered, it will call recordAnnotationFromGeoJSONObject: . If the record is already registered, then the layer object will attempt to call updateRecordWithGeoJSONObject: the object implements it.

The layer object does not handle errors generated by the SGLocationService. If an error is incurred, it is up to the other delegates to handle the error.



Methods

-addRecordAnnotation:

 Adds a SGRecordAnnotation to the layer.

-addRecordAnnotations:

Adds an array of SGRecordAnnotations to the SGLayer object.

-initWithLayerName:

Initialize a new SGLayer object with a layer name.

-recordAnnotationCount

 Get the amount of SGRecordAnnotations registered with the SGLayer object.

-recordAnnotationFromGeoJSONObject:

Creates a new record from the given dictionary.

-recordAnnotations
-removeAllRecordAnnotations

 Removes all SGRecordAnnotations registered with the SGLayer object.

-removeRecordAnnotation:

Remove a SGRecordAnnotation registed with the SGLayer object.

-removeRecordAnnotationAtIndex:

Remove a SGRecordAnnotation registed with the SGLayer object.

-removeRecordAnnotationAtIndex:

Remove a SGRecordAnnotation registed with the SGLayer object.

-removeRecordAnnotations:

Remove a SGRecordAnnotation registed with the SGLayer object.

-retrieveAllRecords

 Retrieves all records that are registered with the SGLayer object from SimpleGeo.

-retrieveRecordAnnotations:

 Retrieves all registered records within a range from this layer that are in SimpleGeo.

-retrieveRecordsForCoordinate:radius:types:limit:

Retrieves records within from an origin with a desired radius from SimpleGeo.

-retrieveRecordsForCoordinate:radius:types:limit:

Retrieves records within from an origin with a desired radius from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

-retrieveRecordsForCoordinate:radius:types:limit:start:end:

Retrieves records within from an origin with a desired radius from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

-retrieveRecordsForGeohash:types:limit:

Retrieves records within the given geohash from SimpleGeo.

-retrieveRecordsForGeohash:types:limit:

Retrieves records within the given geohash from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

-retrieveRecordsForGeohash:types:limit:start:end:

Retrieves records within the given geohash from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

-retrieveRecordsFromIndex:toIndex:

 Retrieves all registered records within a range from this layer that are in SimpleGeo.

-updateAllRecords

 Updates or adds all records registered with the SGLayer object to SimpleGeo.

-updateRecordAnnotations:

 Updates or adds all registered records within a range from this SGLayer object to SimpleGeo.

-updateRecordsFromIndex:toIndex:

 Updates or adds all registered records within a range from this SGLayer object to SimpleGeo.


addRecordAnnotation:


 Adds a SGRecordAnnotation to the layer.

- (void) addRecordAnnotation:(id<SGRecordAnnotation>)recordAnnotation; 
Parameters
recordAnnotation

The record annotation to add.

Discussion

When a record is added, the layer of the record is changed to reflect the layerId.


addRecordAnnotations:


Adds an array of SGRecordAnnotations to the SGLayer object.

- (void) addRecordAnnotations:(NSArray*)recordAnnotations; 
Parameters
recordAnnotations

The array of record annotations to add.

Discussion

See addRecord:


initWithLayerName:


Initialize a new SGLayer object with a layer name.

- (id) initWithLayerName:(NSString*)layerId; 
Parameters
layerId

The name of the layer.

Return Value

A initialized SGLayer object.

Discussion

See layerId


recordAnnotationCount


 Get the amount of SGRecordAnnotations registered with the SGLayer object.

- (NSInteger) recordAnnotationCount; 
Return Value

 The amount of records registerd with the SGLayer object.


recordAnnotationFromGeoJSONObject:


Creates a new record from the given dictionary.

- (id<SGRecordAnnotation>) recordAnnotationFromGeoJSONObject:(NSDictionary*)geoJSONObject; 
Parameters
geoJSONObject

The GeoJSON dictionary representation of the new record. 

Return Value

The SGRecordAnnotation of the GeoJSON dictionary.

Discussion

This method is called when the layer finds an unregistered record. The default implementation of this method creates a new instance of SGRecord and calls updateRecordWithGeoJSONObject:. If subclasses wish to do any manipulation to a record after it is retrieved from SimpleGeo, they are encouraged to override this method.


recordAnnotations


- (NSArray*) recordAnnotations; 
Return Value

All the SGRecordAnntations registered with the SGLayer object.


removeAllRecordAnnotations


 Removes all SGRecordAnnotations registered with the SGLayer object.

- (void) removeAllRecordAnnotations; 


removeRecordAnnotation:


Remove a SGRecordAnnotation registed with the SGLayer object.

See Also:

removeRecordAnnotationAtIndex:

- (void) removeRecordAnnotation:(id<SGRecordAnnotation>)recordAnnotation; 
Parameters
recordAnnotation

The record annotation to remove.


removeRecordAnnotationAtIndex:


Remove a SGRecordAnnotation registed with the SGLayer object.

See Also:

removeRecordAnnotation:

- (void) removeRecordAnnotation:(id<SGRecordAnnotation>)recordAnnotation; 
Parameters
recordAnnotation

The record annotation to remove.


removeRecordAnnotationAtIndex:


Remove a SGRecordAnnotation registed with the SGLayer object.

See Also:

removeRecordAnnotations:

- (void) removeRecordAnnotations:(NSArray*)recordAnnotations; 
Parameters
recordAnnotation

The array of record annotations to remove.


removeRecordAnnotations:


Remove a SGRecordAnnotation registed with the SGLayer object.

See Also:

removeRecordAnnotationAtIndex:

- (void) removeRecordAnnotations:(NSArray*)recordAnnotations; 
Parameters
recordAnnotation

The array of record annotations to remove.


retrieveAllRecords


 Retrieves all records that are registered with the SGLayer object from SimpleGeo.

- (NSString*) retrieveAllRecords; 
Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate

Discussion

See updateRecordsFromIndex:toIndex:


retrieveRecordAnnotations:


 Retrieves all registered records within a range from this layer that are in SimpleGeo.

See Also:

retrieveRecordsFromIndex:toIndex:

- (NSString*) retrieveRecordAnnotations:(NSArray*)recordAnnoations; 
Parameters
recordAnnotations

The annotations to retrieve.

Discussion

 Currently, there is no way to retrieve ALL records in a single GET request. Each record creates a HTTP request so if there are 300 records register with the SGLayer object, then it might be a minute in order to recieve a response back. As soon as a request returns, the record is immediately updated and the next request is sent. If at any time a request fails, all delegates registered with SGLocationService are notified with the response identifier.

Records are retrieved in order. If record retrieval fails at n + 1, then all records 0


retrieveRecordsForCoordinate:radius:types:limit:


Retrieves records within from an origin with a desired radius from SimpleGeo.

- (NSString*) retrieveRecordsForCoordinate:(CLLocationCoordinate2D)coord radius:(double)radius types:(NSArray*)types limit:(NSInteger)limit; 
Parameters
coord

The lat/lon coordinates that declare the origin of the search space.

radius

The radius of the circle.

types

The types of objects to retrieve. 

limit

The amount of objects to retrieve.

Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate


retrieveRecordsForCoordinate:radius:types:limit:


Retrieves records within from an origin with a desired radius from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

See Also:

retrieveRecordsForCoordinate:radius:types:limit:start:end:

- (NSString*) retrieveRecordsForCoordinate:(CLLocationCoordinate2D)coord radius:(double)radius types:(NSArray*)types limit:(NSInteger)limit start:(double)start end:(double)end; 
Parameters
coord

The lat/lon coordinates that declare the origin of the search space.

radius

The radius of the circle.

types

The types of objects to retrieve. 

limit

The amount of objects to retrieve.

start

An Epoch timestamp that is the beginning of the time interval in seconds.

end

An Epoch timestamp that is the end of the time interval in seconds.

Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate


retrieveRecordsForCoordinate:radius:types:limit:start:end:


Retrieves records within from an origin with a desired radius from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

See Also:

retrieveRecordsForCoordinate:radius:types:limit:

- (NSString*) retrieveRecordsForCoordinate:(CLLocationCoordinate2D)coord radius:(double)radius types:(NSArray*)types limit:(NSInteger)limit start:(double)start end:(double)end; 
Parameters
coord

The lat/lon coordinates that declare the origin of the search space.

radius

The radius of the circle.

types

The types of objects to retrieve. 

limit

The amount of objects to retrieve.

start

An Epoch timestamp that is the beginning of the time interval in seconds.

end

An Epoch timestamp that is the end of the time interval in seconds.


retrieveRecordsForGeohash:types:limit:


Retrieves records within the given geohash from SimpleGeo.

- (NSString*) retrieveRecordsForGeohash:(SGGeohash)region 
        types:(NSArray*)types limit:(NSInteger)limit; 
Parameters
geohash

The geohash to search in.

types

The types of objects to retrieve. 

limit

The amount of objects to retrieve.

Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate


retrieveRecordsForGeohash:types:limit:


Retrieves records within the given geohash from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

See Also:

retrieveRecordsForGeohash:types:limit:start:end:

- (NSString*) retrieveRecordsForGeohash:(SGGeohash)region types:(NSArray*)types limit:(NSInteger)limit start:(double)start end:(double)end; 
Parameters
geohash

The geohash to search in.

types

The types of objects to retrieve. 

limit

The amount of objects to retrieve.

start

An Epoch timestamp that is the beginning of the time interval in seconds.

end

An Epoch timestamp that is the end of the time interval in seconds.

Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate


retrieveRecordsForGeohash:types:limit:start:end:


Retrieves records within the given geohash from SimpleGeo and within a given interval. To make use of our time based index, the difference between start and end must not be greater than 60 minutes.

See Also:

retrieveRecordsForGeohash:types:limit:

- (NSString*) retrieveRecordsForGeohash:(SGGeohash)region types:(NSArray*)types limit:(NSInteger)limit start:(double)start end:(double)end; 
Parameters
geohash

The geohash to search in.

types

The types of objects to retrieve. 

limit

The amount of objects to retrieve.

start

An Epoch timestamp that is the beginning of the time interval in seconds.

end

An Epoch timestamp that is the end of the time interval in seconds.


retrieveRecordsFromIndex:toIndex:


 Retrieves all registered records within a range from this layer that are in SimpleGeo.

See Also:

retrieveRecordAnnotations:

- (NSString*) retrieveRecordAnnotations:(NSArray*)recordAnnoations; 
Parameters
recordAnnotations

The annotations to retrieve.

Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate

Discussion

 Currently, there is no way to retrieve ALL records in a single GET request. Each record creates a HTTP request so if there are 300 records register with the SGLayer object, then it might be a minute in order to recieve a response back. As soon as a request returns, the record is immediately updated and the next request is sent. If at any time a request fails, all delegates registered with SGLocationService are notified with the response identifier.

Records are retrieved in order. If record retrieval fails at n + 1, then all records 0


updateAllRecords


 Updates or adds all records registered with the SGLayer object to SimpleGeo.

- (NSString*) updateAllRecords; 
Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate

Discussion

See updateRecordsFromIndex:toIndex:


updateRecordAnnotations:


 Updates or adds all registered records within a range from this SGLayer object to SimpleGeo.

See Also:

updateRecordsFromIndex:toIndex:

- (NSString*) updateRecordAnnotations:(NSArray*)recordAnnotations; 
Parameters
recordAnnotations

The annotations to update.

Discussion

 Currently, there is no way to update ALL records in a single PUT request. Each record creates a HTTP request so if there are 300 records registered with the SGLayer object, then it might be a minute in order to recieve a response back saying all records have been updated. As soon as a request returns, the next request is loaded. If at any time a request fails, all delegates registered with SGLocationService are notified with the initial request identifier and the proper NSError.

Records are updated in order. If a record update fails at n + 1, then all records 0


updateRecordsFromIndex:toIndex:


 Updates or adds all registered records within a range from this SGLayer object to SimpleGeo.

See Also:

updateRecordAnnotations:

- (NSString*) updateRecordAnnotations:(NSArray*)recordAnnotations; 
Parameters
recordAnnotations

The annotations to update.

Return Value

 A request identifier that can be used to analyze the response object returned to the SGLocationServiceDelegate

Discussion

 Currently, there is no way to update ALL records in a single PUT request. Each record creates a HTTP request so if there are 300 records registered with the SGLayer object, then it might be a minute in order to recieve a response back saying all records have been updated. As soon as a request returns, the next request is loaded. If at any time a request fails, all delegates registered with SGLocationService are notified with the initial request identifier and the proper NSError.

Records are updated in order. If a record update fails at n + 1, then all records 0

Properties

layerId

The layerId is the name of the layer used in SimpleGeo. A common convention used in naming a layer is a reverse URL. (e.g. "com.simplegeo.spatula").


layerId


The layerId is the name of the layer used in SimpleGeo. A common convention used in naming a layer is a reverse URL. (e.g. "com.simplegeo.spatula").

@property (
    nonatomic,
    readonly) NSString* layerId; 
Discussion

name of the layer.

© SimpleGeo Last Updated: 03/31/2010