Solved! Go to Solution.
AGSSpatialReference *baseSR = [AGSSpatialReference spatialReferenceWithWKID:102100]; AGSGeometryEngine *geometryEngine = [AGSGeometryEngine defaultGeometryEngine]; AGSPoint *min = [[AGSPoint alloc] initWithX:heatArea.envelope.xmin y:heatArea.envelope.ymin spatialReference:heatArea.envelope.spatialReference]; AGSPoint *adjustedMin = (AGSPoint*) [geometryEngine projectGeometry:min toSpatialReference:baseSR]; AGSPoint *max = [[AGSPoint alloc] initWithX:heatArea.envelope.xmax y:heatArea.envelope.ymax spatialReference:heatArea.envelope.spatialReference]; AGSPoint *adjustedMax = (AGSPoint*) [geometryEngine projectGeometry:max toSpatialReference:baseSR]; densityFullEnvelope = [AGSEnvelope envelopeWithXmin:adjustedMin.x ymin:adjustedMin.y xmax:adjustedMax.x ymax:adjustedMax.y spatialReference:baseSR];
- (NSOperation<AGSDynamicLayerDrawingOperation>*)exportMapImage:(AGSExportImageParams*)params
{
DensityMapOperation *operation = [[DensityMapOperation alloc] initWithParams:params];
[self.exportDelegate dynamicLayer:self exportMapImageOperation:operation didFinishWithImage:self.mapImage];
return operation;
}
- (AGSUnits)units
{
return densityUnits;
}
- (AGSSpatialReference *)spatialReference
{
return densityFullEnvelope.spatialReference;
}
- (AGSEnvelope *)fullEnvelope
{
return densityFullEnvelope;
}
- (AGSEnvelope *)initialEnvelope
{
//Assuming our initial extent is the same as the full extent
return densityFullEnvelope;
}
- (AGSExportImageParams *)exportImageParams
{
return theParams;
}
[self.exportDelegate dynamicLayer:self exportMapImageOperation:operation didFinishWithImage:self.mapImage];
DensityMapLayer *densityMapLayer = [[DensityMapLayer alloc] initWithGeometry:heatArea]; densityMapLayer.mapImage = [heatServer.mapImage copy]; UIView *densityView = [self.mapView addMapLayer:densityMapLayer withName:@"Density Layer"];
heatArea = self.mapView.visibleArea;