More

ArcGIS / .Net - Load pyramids in thread

ArcGIS / .Net - Load pyramids in thread


I need to display a large raster with ArcGIS. To do so, I'm using pyramids, and it is working, but they can be long to build. So I would like to build the pyramids in a separate thread. When doing so, the layer is added in the TOC, but not on the map.

Here is a sample code :

private class Worker { private delegate void RasterLoadedCallback(IRasterDataset rasterDataset); public void DoWork() { // Set the workspace and file names : string workspacePath = "C:PathToMyFolder"; string fileName = "filename.tif"; // Open a workspace : IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactory(); IRasterWorkspace rasterWorkspace = (IRasterWorkspace)workspaceFactory.OpenFromFile(workspacePath, 0); // Open a file in the workspace : IRasterDataset rasterDataset = rasterWorkspace.OpenRasterDataset(fileName); // Create the pyramids : IRasterPyramid rasterPyramids = (IRasterPyramid)rasterDataset; rasterPyramids.Create(); // Run on the main thread : RasterLoadedCallback callback = AddRasterToMap; Dispatcher.FromThread(mainThread).Invoke(callback, new object[] { rasterDataset }); } private static void AddRasterToMap(IRasterDataset rasterDataset) { // Create a raster layer from a raster dataset : IRasterLayer rasterLayer = new RasterLayer(); rasterLayer.CreateFromDataset(rasterDataset); // Add it to a map if the layer is valid. if (rasterLayer != null) { IMap map = MyAxMapControl.ActiveView.FocusMap; map.AddLayer((ILayer)rasterLayer); } } }

Does anyone know what could the problem be ?


I found a solution : re-open the raster in the main thread when the pyramids creation is done, instead of passing the dataset as a parameter.

So the my code is :

private class Worker { private delegate void RasterLoadedCallback(); public void DoWork() { // Set the workspace and file names : string workspacePath = "C:PathToMyFolder"; string fileName = "filename.tif"; // Open a workspace : IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactory(); IRasterWorkspace rasterWorkspace = (IRasterWorkspace)workspaceFactory.OpenFromFile(workspacePath, 0); // Open a file in the workspace : IRasterDataset rasterDataset = rasterWorkspace.OpenRasterDataset(fileName); // Create the pyramids : IRasterPyramid rasterPyramids = (IRasterPyramid)rasterDataset; rasterPyramids.Create(); // Run on the main thread : RasterLoadedCallback callback = AddRasterToMap; Dispatcher.FromThread(mainThread).Invoke(callback, new object[] { }); } private static void AddRasterToMap() { // Open a workspace : IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactory(); IRasterWorkspace rasterWorkspace = (IRasterWorkspace)workspaceFactory.OpenFromFile(workspacePath, 0); // Open a file in the workspace : IRasterDataset rasterDataset = rasterWorkspace.OpenRasterDataset(fileName); // Create a raster layer from a raster dataset : IRasterLayer rasterLayer = new RasterLayer(); rasterLayer.CreateFromDataset(rasterDataset); //rasterLayer.PyramidsPresent = true // Add it to a map if the layer is valid. if (rasterLayer != null) { IMap map = MyAxMapControl.ActiveView.FocusMap; map.AddLayer((ILayer)rasterLayer); } } }

Release notes for 100.1

This page provides details about enhancements in the 100.1 release of ArcGIS Runtime SDK for iOS. It also lists this release's known issues.

Version 100.1.1 adds support for iOS 11 and Xcode 9 by resolving a warning where some UIKit APIs were called on a background thread. Additionally, it contains some bug fixes to improve identifying map image layers and filtering data of feature layers using definition expressions.

3D support on mobile devices commercially available

In the previous release, developers could deploy 3D apps to mobile phones and tablets only as BETA 3D was commercially supported only on desktop platforms. Now at 100.1.0, 3D capabilities are fully supported on mobile phones and tablets.

Raster support on mobile devices commercially available

In the previous release, apps that used local raster data on mobile phones and tablets could only be deployed as BETA Raster was commercially supported only on desktop platforms. At 100.1.0, local raster capabilities are fully supported on mobile phones and tablets.

Web maps or specific areas of a web map from a portal can be downloaded and used in disconnected scenarios. The new OfflineMapTask provides a high-level API to download the map definition and its related data. When the map is taken offline, it is stored as a mobile map. If the map contains sync-enabled feature layers, those can be edited offline and the changes synced when network connectivity is later available.

Client-side labeling control

A new AGSLabelDefinition class is introduced that defines how labeling is applied to feature data for a given scale range. You can specify the following:

  • Which features are covered by the definition (by applying the label definition's where-clause)
  • What text should be displayed, based on the individual feature's attributes and the label definition label-expression formula. Arcade expressions are supported in label definitions and visual variables but not in unique value renderers or class breaks renderers.
  • How the text should appear, using the definition's text symbol
  • Where the text should appear with respect to its feature, using the definition's label placement
  • How to move or avoid other labels or features that would overlap each label

At this release, you can only construct an AGSLabelDefinition instance from JSON but there is no explicit API for specifying labeling settings.

Support for additional layer types

This release adds support for the following data layer types.

  • OGC WMTS
  • Image Service
  • Dynamic sublayers of an ArcGIS Map Service
  • OpenStreetMap
  • Bing

This release provides APIs to display custom tiles. The AGSWebTiledLayer is an extensible layer that requests map tiles from a web service based on a URI template. It provides a simple way to integrate non-ArcGIS Services as a layer in a map. Also, custom tiled layers can be created by sub-classing AGSImageTiledLayer and its subclass, AGSServiceImageTiledLayer . These two abstract classes expose protected abstract methods to either fetch tile images or return the URL of the tile images. By extending these two classes and implementing the abstract methods, you can create custom tiled layers and add them to a map.

This release provides APIs for supporting related tables. With this, apps can handle workflows that involve reading, editing, and querying related data in both spatial and non-spatial tables. These related table workflows are supported in both online and offline maps.

A new AGSHeatmapRenderer class uses the points in a layer to calculate and display the relative density of points on a map. The density is displayed as a heat map by smoothly varying sets of colors ranging from cool (low density of points) to hot (high density of points). At this release, this class is constructed only from JSON when it's defined in a web map and no explicit API is provided for working with it.

Editing of public feature services available at the Lite license level

The ability to perform edits in a connected environment on a public feature services from ArcGIS Online or Enterprise at the Lite license level has been introduced this release. At version 100.0.0, all editing capabilities began at the Basic level. The editing of private feature services or editing in an offline environment remains at the Basic, Standard, and Advanced licensing levels.

Service area and closest facility analysis

Closest facility and service area tasks are now available for performing more network analysis in your ArcGIS Runtime applications.

A service area is a region that encompasses all streets that can be accessed within a given distance or travel time from one or more facilities. For example, a three-minute, drive-time polygon around a grocery store can determine which residents are able to reach the store within three minutes and are thus more likely to shop there.

The closest facility task generates routes between facilities and incidents. Routes may include a route shape and driving directions. The task may generate routes from facilities to incidents or from incidents to facilities and can find a user specified number of routes, for example finding the three closest fire stations for an address.

The AGSCoordinateFormatter class can be used to convert between points and formatted coordinates notation strings such as decimal degrees degrees, minutes, and seconds U.S. National Grid (USNG) and Military Grid Reference System (MGRS).

Camera controllers allow you to change the default camera behavior in a scene view. Two "orbit" camera controllers were added to lock the focus of a camera to a fixed point target or a possibly moving graphic.

Support for StreetMap Premium packages

StreetMap Premium for ArcGIS Runtime is a new data product, licensed as an extension to ArcGIS Runtime, that provides enriched street data, which powers a high-quality cartographic map and high-quality search, geocoding, and route analysis. Streetmap Premium for ArcGIS Runtime maps are consistent across all regions of the world and can be taken offline for disconnected use they can simultaneously fulfill the need for an address locator, street network dataset, and basemap in your app.

StreetMap Premium for ArcGIS Runtime delivers HERE data as a mobile map package (an .mmpk file) for your app to access locally. This MMPK format allows the data to be accessed offline and therefore doesn't consume data from your user's data plan. This is the same high-quality data used by ArcGIS Online services, including the World Geocoding Service, Routing Service, and Street Map Service.

AGSMapView and AGSSceneView have been enhanced to automatically display attribution for map and scene layers respectively. The attribution is dynamic and updates as layers are added/removed, toggled on/off, or change visibility as they go in and out of scale range.


Release notes for 100.1

This page provides details about what's new in the 100.1 release of ArcGIS Runtime SDK for Android. It also lists this release's deprecations, resolved issues, and known issues.

3D has been brought to the ArcGIS Runtime for native app development. Build 3D scenes with raster, tiled, and vector data sets including 3D specific symbology for great “better than flat” visualizations.

Raster support on mobile devices commercially available

In the previous release, apps that used local raster data on mobile phones and tablets could only be deployed as BETA Raster was commercially supported only on desktop platforms. At 100.1, local raster capabilities are fully supported on mobile phones and tablets.

Web maps or specific areas of a web map from a portal can be downloaded and used in disconnected scenarios. The new OfflineMapTask provides a high-level API to download the map definition and its related data. When the map is taken offline, it is stored as a mobile map. If the map contains sync-enabled feature layers, those can be edited offline and the changes synced when network connectivity is later available.

Client-side labeling control

A new LabelDefinition class is introduced that defines how labeling is applied to feature data for a given scale range. You can specify the following:

  • Which features are covered by the definition (by applying the label definition's where-clause)
  • What text should be displayed, based on the individual feature's attributes and the label definition label-expression formula. Arcade expressions are supported in label definitions and visual variables but not in unique value renderers or class breaks renderers.
  • How the text should appear, using the definition's text symbol
  • Where the text should appear with respect to its feature, using the definition's label placement
  • How to move or avoid other labels or features that would overlap each label

At this release, you can only construct a LabelDefinition instance from JSON but there is no explicit API for specifying labeling settings.

Support for additional layer types

This release adds support for the following data layer types.

  • OGC WMTS
  • Image Service
  • Dynamic sublayers of an ArcGIS Map Service
  • OpenStreetMap
  • Bing

This release provides APIs to display custom tiles. The WebTiledLayer is an extensible layer that requests map tiles from a web service based on a URI template. It provides a simple way to integrate non-ArcGIS Services as a layer in a map. Also, custom tiled layers can be created by sub-classing ImageTiledLayer and its subclass, ServiceImageTiledLayer. These two abstract classes expose protected abstract methods to either fetch tile images or return the URL of the tile images. By extending these two classes and implementing the abstract methods, you can create custom tiled layers and add them to a map.

This release provides APIs for supporting related tables. With this, apps can handle workflows that involve reading, editing, and querying related data in both spatial and non-spatial tables. These related table workflows are supported in both online and offline maps. For details, see Relate features and Search for related features.

A new HeatmapRenderer class uses the points in a layer to calculate and display the relative density of points on a map. The density is displayed as a heat map by smoothly varying sets of colors ranging from cool (low density of points) to hot (high density of points). At this release, this class is constructed only from JSON when it's defined in a web map and no explicit API is provided for working with it.

A 2D SketchEditor class enables sketching geometries on a map. It can be used to create new geometries and edit existing ones. This type of sketching is typically done through user interaction programmatic sketching is also supported. The SketchEditor class also support undo/redo of edits, custom styling of the editor, and a system of notifications for the developer to handle during the sketching process.

Editing of public feature services available at the Lite license level

The ability to perform edits in a connected environment on a public feature services from ArcGIS Online or Enterprise at the Lite license level has been introduced this release. At version 100.0, all editing capabilities began at the Basic level. The editing of private feature services or editing in an offline environment remains at the Basic, Standard, and Advanced licensing levels.

Service area and closest facility analysis

Closest facility and service area tasks are now available for performing more network analysis in your ArcGIS Runtime applications. A service area is a region that encompasses all streets that can be accessed within a given distance or travel time from one or more facilities. For example, a three-minute, drive-time polygon around a grocery store can determine which residents are able to reach the store within three minutes and are thus more likely to shop there. The closest facility task generates routes between facilities and incidents. Routes may include a route shape and driving directions. The task may generate routes from facilities to incidents or from incidents to facilities and can find a user specified number of routes, for example finding the three closest fire stations for an address.

The CoordinateFormatter class can be used to convert between points and formatted coordinates notation strings such as decimal degrees degrees, minutes, and seconds U.S. National Grid (USNG) and Military Grid Reference System (MGRS).

Camera controllers allow you to change the default camera behavior in a scene view. Two "orbit" camera controllers were added to lock the focus of a camera to a fixed point target or a possibly moving graphic.

Support for StreetMap Premium packages

StreetMap Premium for ArcGIS Runtime is a new data product, licensed as an extension to ArcGIS Runtime, that provides enriched street data, which powers a high-quality cartographic map and high-quality search, geocoding, and route analysis. Streetmap Premium for ArcGIS Runtime maps are consistent across all regions of the world and can be taken offline for disconnected use they can simultaneously fulfill the need for an address locator, street network dataset, and basemap in your app.

StreetMap Premium for ArcGIS Runtime delivers HERE data as a mobile map package (an .mmpk file) for your app to access locally. This MMPK format allows the data to be accessed offline and therefore doesn't consume data from your user's data plan. This is the same high-quality data used by ArcGIS Online services, including the World Geocoding Service, Routing Service, and Street Map Service.

MapView and SceneView have been enhanced to automatically display attribution for map and scene layers respectively. The attribution is dynamic and updates as layers are added/removed, toggled on/off, or change visibility as they go in and out of scale range.

  • Return type of MapView.getOnTouchListener() refactored from MapView.OnTouchListener() to View.OnTouchListener().

The following list shows the new classes which have been added to the API:

  • ArcGISScene
  • ArcGISScene.BasemapChangedEvent
  • ArcGISScene.BasemapChangedListener
  • ArcGISSceneLayer
  • ArcGISTiledElevationSource
  • AtmosphereEffect
  • DefaultSceneViewOnTouchListener
  • DistanceCompositeSceneSymbol
  • ElevationSource
  • LightingMode
  • LocationToScreenResult
  • LocationToScreenResult.SceneLocationVisibility
  • MarkerSceneSymbol
  • ModelSceneSymbol
  • RasterElevationSource
  • SceneSymbol
  • SceneView
  • SimpleMarkerSceneSymbol
  • Surface
  • ArcGISMapServiceSublayerInfo
  • ArcGISMapServiceSublayerInfo.ServiceType
  • BingMapsLayer
  • BingMapsLayer.Style
  • ImageServiceRaster
  • ImageTiledLayer.NoDataTileBehavior
  • MapSublayerSource
  • OpenStreetMapLayer
  • RasterSublayerSource
  • ServiceImageTiledLayer
  • SublayerSource
  • WebTiledLayer
  • WmtsLayer
  • WmtsLayerInfo
  • WmtsService
  • WmtsServiceInfo
  • WmtsTileMatrixSet
  • WmtsTileMatrixSet.TileMatrix
  • ClosestFacilityParameters
  • ClosestFacilityResult
  • ClosestFacilityRoute
  • ClosestFacilityTask
  • ClosestFacilityTaskInfo
  • Facility
  • Incident
  • ServiceAreaFacility
  • ServiceAreaOverlapGeometry
  • ServiceAreaParameters
  • ServiceAreaPolygon
  • ServiceAreaPolygonCutoffGeometry
  • ServiceAreaPolygonDetail
  • ServiceAreaPolyline
  • ServiceAreaResult
  • ServiceAreaTask
  • ServiceAreaTaskInfo
  • StartTimeUsage
  • TravelDirection
  • GenerateOfflineMapJob
  • GenerateOfflineMapParameters
  • GenerateOfflineMapResult
  • OfflineCapability
  • OfflineMapCapabilities
  • OfflineMapItemInfo
  • OfflineMapSyncJob
  • OfflineMapSyncLayerResult
  • OfflineMapSyncParameters
  • OfflineMapSyncResult
  • OfflineMapSyncTask
  • OfflineMapTask
  • RelatedFeatureQueryResult
  • RelatedQueryParameters
  • RelationshipCardinality
  • RelationshipConstraintViolation
  • RelationshipInfo
  • RelationshipRole
  • TableJoinSublayerSource
  • TableQuerySublayerSource
  • TableSublayerSource
  • SketchCreationMode
  • SketchEditor
  • SketchGeometryChangedEvent
  • SketchGeometryChangedListener
  • SketchStyle
  • AnimationCurve
  • ArcGISImageServiceInfo
  • AttributionTextChangedEvent
  • AttributionTextChangedListener
  • CameraController
  • CameraDistanceChangedEvent
  • CameraDistanceChangedListener
  • CameraHeadingOffsetChangedEvent
  • CameraHeadingOffsetChangedListener
  • CameraPitchOffsetChangedEvent
  • CameraPitchOffsetChangedListener
  • CoordinateFormatter
  • CoordinateFormatter.GarsConversionMode
  • CoordinateFormatter.LatitudeLongitudeFormat
  • CoordinateFormatter.MgrsConversionMode
  • CoordinateFormatter.UtmConversionMode
  • ExtendOptions
  • GeoprocessingParameterInfo
  • GeoprocessingTaskInfo
  • GlobeCameraController
  • HeatmapRenderer
  • OrbitGeoElementCameraController
  • OrbitLocationCameraController
  • PictureFillSymbol
  • PixelType
  • PopupRelatedFeaturesDefinition
  • PopupRelatedFeaturesSortOrder
  • RenderingRule
  • RenderingRuleInfo

The following list shows the deprecations in the API and where relevant the replacement API.


Watch the video: GIS Flood Analysis