User Tools

Site Tools


api:dk11:delphi:gisisochronemap.tgis_isochronemap

TGIS_IsochroneMap class

DK11 for Delphi | GisIsochroneMap.TGIS_IsochroneMap | Classes | Constructors | Methods | Properties

Network analysis tool for creating isochrone maps - for a given point finds the network area reachable within a given maximum network traversing cost.

Available also on: .NET | Java | ActiveX.

Syntax

// Delphi
type
  TGIS_IsochroneMap = class( TGIS_BaseObjectDisposable )
  end;
// C++ Builder
class PASCALIMPLEMENTATION TGIS_IsochroneMap : public TGIS_BaseObjectDisposable
{
};

Inheritance

→ TObject → TGIS_BaseObjectDisposable

Constructors

Inherited Overrides Protected
Name Visibility Description
Create public Creates an instance.
Create(IGIS_Viewer) public Creates an instance.

Methods

Inherited Overrides Protected
Name Visibility Description
Generate public Finds the network area reachable within a given cost and outputs the result to the destination layer as shape(s).

Properties

Inherited Protected
Name Visibility Description
OutputCostFieldName public Specifies the name of the attribute field which will be added to the destination layer.

Remarks

For general information about isochrone maps see this article on Wikipedia.

TGIS_IsochroneMap uses topological network (TGIS_Network) for calculations (the same as TGIS_ShortestPath). If the network is not available for the analyzed layer then it will be created automatically. Depending on the size of the layer it may be a prolonged operation. Once created the network is saved into a set of files and can be reused.

The creation of an isochrone map can also be a time consuming operation for large and complicated networks and/or relatively big traversing cost.

Sample results from isochrone analyses:

Points Arcs Polygons Interpolation (splines)

Steps to achieve:

  • Points
    1. Use Generate() with TGIS_ShapePoint as the output type
    2. Colorize the layer by the cost field (GIS_COST by default)
  • Arcs
    1. Use Generate() with TGIS_ShapeArc as the output type
    2. Colorize the layer by the cost field (GIS_COST by default)
  • Polygons
    1. Use Generate() with TGIS_ShapePolygon as the output type
    2. Repeat above desired number of times decreasing the cost each time
    3. Colorize the layer by the cost field (GIS_COST by default)
  • Interpolation
    1. Use Generate() with TGIS_ShapePoint as an output type
    2. Use TGIS_InterpolationSplines to genearte interpolated grid layer
    3. Colorize the grid layer

Example

Delphi

// GIS is TGIS_ViewerWnd
 
// simple LinkCostEvent handler which uses shape length as the network cost
// used during network creation process
procedure TForm1.doLinkCostEvent(
      _sender  : TObject ;
      _shape   : TGIS_ShapeArc ;
  var _cost    : Double ;
  var _revcost : Double
) ;
begin
  if _shape.Layer.CS is TGIS_CSUnknownCoordinateSystem then
    _cost := _shape.Length
  else
    _cost := _shape.LengthCS ;
  _revcost := _cost ;
end ;
 
// coordinates of _pt parameter must be in a layer projection
procedure TForm1.MakeIsochroneMap(
  const _pt : TGIS_Point
) ;
var
  sp  : TGIS_ShortestPath ;
  im  : TGIS_IsochroneMap ;
  ls  : TGIS_LayerVector ;
  lr  : TGIS_LayerVector ;
  cst : Double ;
begin
  // get a layer for which an isochrone map will be created
  ls := TGIS_LayerVector( GIS.Get( 'Roads' ) ) ;
 
  // create a layer to store the isochrone map on
  lr := TGIS_LayerVector.Create ;
  lr.Name := 'Isochrone map for Roads' ;
  lr.CS := ls.CS ;
  lr.Open ;
 
  // maximum traversing cost for the isochrone map
  cst := 10.0 ;  
 
  im := TGIS_IsochroneMap.Create( GIS ) ;
  try
    sp := TGIS_ShortestPath.Create( GIS ) ;
    try
      sp.LinkCostEvent := doLinkCostEvent ;
      // generate the isochrone map
      im.Generate( ls, sp, lr, TGIS_ShapeType.Arc, _pt, cst, 0 ) ;
    finally
      FreeObject( sp ) ;
    end ;
  finally
    FreeObject( im ) ;
  end ;
 
  // add the layer with the isochrone map to the viewer
  GIS.Add( lr ) ;  
  // and update
  GIS.InvalidateWholeMap ;
end ;

References

2019/08/13 10:49