THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Polygons for reverse geocoding

Combine Additional Data Provider queries with Reverse Geocoding queries to obtain extra data about a specific entity Type like:

  • Country
  • CountrySubdivision
  • CountrySecondarySubdivision
  • CountryTertiarySubdivision
  • Municipality
  • MunicipalitySubdivision
  • Neighbourhood
  • PostalCodeArea

Sample use case: You want to display Country or Municipality boundaries.

Use the following code to try this in your app:

Create TTReverseGeocoderQuery with the entityType parameter and use Reverse Geocode search.

1let query = TTReverseGeocoderQueryBuilder.create(with: coordinate).withEntityType(entityType)
2 .build()
3reverseGeocoder.reverseGeocoder(with: query)
TTReverseGeocoderQuery *query = [[[TTReverseGeocoderQueryBuilder createWithCLLocationCoordinate2D:coordinate] withEntityType:self.entityType] build]
[self.reverseGeocoder reverseGeocoderWithQuery:query];

Get the TTGeometryDataSource object from the Response.

1guard let address = response.result.addresses.first else { return }
2guard let additionalDataSources = address.additionalDataSources else { return }
3guard let geometryDataSource = additionalDataSources.geometryDataSource else { return }
1- (TTGeometryDataSource *_Nullable)geometryDataSourceFromResponse:(TTReverseGeocoderResponse *)response {
2 if (response.result.addresses.firstObject != nil) {
3 TTReverseGeocoderFullAddress *addressValue = [TTReverseGeocoderFullAddress alloc];
4 addressValue = response.result.addresses.firstObject;
5 if (addressValue.additionalDataSources) {
6 TTAdditionalDataSources *additionalDataSources = [TTAdditionalDataSources alloc];
7 additionalDataSources = addressValue.additionalDataSources;
8 if (additionalDataSources.geometryDataSource) {
9 return additionalDataSources.geometryDataSource;
10 }
11 }
12 }
13 return nil;
14}

Use the TTAdditionalDataSearchQuery object for sending Requests with the ** TTGeometryDataSource** object supported by the Additional Data API.

1let query = TTAdditionalDataSearchQueryBuilder.create(with: geometryDataSource)
2 .withGeometriesZoom(geometriesZoom)
3 .build()

searchAdditionalData.additionalDataSearch(with: query)

1if ([self geometryDataSourceFromResponse:response] != nil) {
2 TTAdditionalDataSearchQuery *query = [[[TTAdditionalDataSearchQueryBuilder createWithDataSource:[self geometryDataSourceFromResponse:response]] withGeometriesZoom:geometriesZoom] build];
3 [_searchAdditionalData additionalDataSearchWithQuery:query];
4}

Sample views utilizing entities retrieved by combining both services:

image

Boundaries for a selected country

image

Boundaries for a selected municipality