DataSource.pm

Summary
DataSource.pm
BE4::DataSourceManage a data source, physical (image files) or virtual (WMS server) or both.
Constructors
newDataSource constructor.
_loadSorts parameters, relays to concerned constructors and stores results.
computeGlobalInfoReads the srs, manipulates extent and bounding box.
Getters - Setters
getSRS
getExtent
getList
getHarvesting
getImages
hasImages
hasHarvesting
getBottomID
getTopID
getBottomOrder
getTopOrder
setBottomOrder
setTopOrder
setTopID
Export methods
exportForDebugReturns all informations about the data source.

BE4::DataSource

Exporter
BE4::DataSource

Manage a data source, physical (image files) or virtual (WMS server) or both.

Using

use BE4::DataSource;

# DataSource object creation : 3 cases

# Real Data and no harvesting : native SRS and lossless compression
my $objDataSource = BE4::DataSource->new(
    "19",
    {
        srs => "IGNF:LAMB93",
        path_image => "/home/ign/DATA/BDORTHO"
    }
);

# No Data, just harvesting (here for a WMS vector)
my $objDataSource = BE4::DataSource->new(
    "19",
    {
        srs => IGNF:WGS84G,
        extent => /home/ign/SHAPE/WKTPolygon.txt,

        wms_layer   => "tp:TRONCON_ROUTE",
        wms_url => "http://geoportail/wms/",
        wms_version => "1.3.0",
        wms_request => "getMap",
        wms_format  => "image/png",
        wms_bgcolor => "0xFFFFFF",
        wms_transparent  => "FALSE",
        wms_style  => "line",
        min_size => 9560,
        max_width => 1024,
        max_height => 1024
    }
);

# No Data, just harvesting provided images
my $objDataSource = BE4::DataSource->new(
    "19",
    {
        srs => IGNF:WGS84G,
        list => /home/ign/listIJ.txt,

        wms_layer   => "tp:TRONCON_ROUTE",
        wms_url => "http://geoportail/wms/",
        wms_version => "1.3.0",
        wms_request => "getMap",
        wms_format  => "image/png",
        wms_bgcolor => "0xFFFFFF",
        wms_transparent  => "FALSE",
        wms_style  => "line",
        min_size => 9560,
        max_width => 1024,
        max_height => 1024
    }
);

# Real Data and harvesting : reprojection or lossy compression
my $objDataSource = BE4::DataSource->new(
    "19",
    {
        srs => "IGNF:LAMB93",
        path_image => "/home/ign/DATA/BDORTHO"
        wms_layer => "ORTHO_XXX",
        wms_url => "http://geoportail/wms/",
        wms_version => "1.3.0",
        wms_request => "getMap",
        wms_format => "image/tiff"
    }
);

Attributes

bottomIDstring - Level identifiant, from which data source is used (base level).
bottomOrderinteger - Level order, from which data source is used (base level).
topIDstring - Level identifiant, to which data source is used.  It is calculated in relation to other datasource.
topOrderinteger - Level order, to which data source is used.  It is calculated in relation to other datasource.
srsstring - SRS of the bottom extent (and ImageSource objects if exists).
extent<OGR::Geometry> - Precise extent, in the previous SRS (can be a bbox).  It is calculated from the ImageSource or supplied in configuration file.  ‘extent’ is mandatory (a bbox or a file which contains a WKT geometry) if there are no images.  We have to know area to harvest.  If images, extent is calculated thanks data.
liststring - File path, containing a list of image indices (I,J) to harvest.
bboxdouble array - Data source bounding box, in the previous SRS : [xmin,ymin,xmax,ymax].
imageSourceImageSource - Georeferenced images’ source.
harvestingHarvesting - WMS server.  If it is useless, it will be remove.

Limitations

Metadata managing not yet implemented.

Summary
Constructors
newDataSource constructor.
_loadSorts parameters, relays to concerned constructors and stores results.
computeGlobalInfoReads the srs, manipulates extent and bounding box.
Getters - Setters
getSRS
getExtent
getList
getHarvesting
getImages
hasImages
hasHarvesting
getBottomID
getTopID
getBottomOrder
getTopOrder
setBottomOrder
setTopOrder
setTopID
Export methods
exportForDebugReturns all informations about the data source.

Constructors

new

sub new

DataSource constructor.  Bless an instance.

Parameters (list)

levelstring - Base level (bottom) for this data source.
paramshash - Data source parameters (see _load for details).

See also

_load, computeGlobalInfo

_load

sub _load

Sorts parameters, relays to concerned constructors and stores results.

Parameters (list)

levelstring - Base level (bottom) for this data source.
paramshash - Data source parameters :
# common part
srs - string

# image source part
path_image          - string
path_metadata       - string
preprocess_command  - string
preprocess_opt_beg  - string
preprocess_opt_mid  - string
preprocess_opt_end  - string
preprocess_tmp_dir  - string

# harvesting part
wms_layer - string
wms_url - string
wms_version - string
wms_request - string
wms_format - string
wms_bgcolor - string
wms_transparent - string
wms_style - string
min_size - string
max_width - string
max_height - string

This hash is directly and entirely relayed to ImageSource::new (even though only common and harvesting parts will be used) and harvesting part is directly relayed to Harvesting::new (see parameters’ meaning).

computeGlobalInfo

sub computeGlobalInfo

Reads the srs, manipulates extent and bounding box.

If an extent is supplied (no image source), 2 cases are possible :

  • extent is a bbox, as xmin,ymin,xmax,ymax
  • extent is a file path, file contains a complex polygon, WKT format.

We generate an OGR Geometry from the supplied extent or the image source bounding box.

Getters - Setters

getSRS

sub getSRS

getExtent

sub getExtent

getList

sub getList

getHarvesting

sub getHarvesting

getImages

sub getImages

hasImages

sub hasImages

hasHarvesting

sub hasHarvesting

getBottomID

sub getBottomID

getTopID

sub getTopID

getBottomOrder

sub getBottomOrder

getTopOrder

sub getTopOrder

setBottomOrder

sub setBottomOrder

Parameters (list)

bottomOrderinteger - Bottom level order to set

setTopOrder

sub setTopOrder

Parameters (list)

topOrderinteger - Top level order to set

setTopID

sub setTopID

Parameters (list)

topIDstring - Top level identifiant to set

Export methods

exportForDebug

sub exportForDebug

Returns all informations about the data source.  Useful for debug.

Example

sub new
DataSource constructor.
sub _load
Sorts parameters, relays to concerned constructors and stores results.
sub computeGlobalInfo
Reads the srs, manipulates extent and bounding box.
sub getSRS
sub getExtent
sub getList
sub getHarvesting
sub getImages
sub hasImages
sub hasHarvesting
sub getBottomID
sub getTopID
sub getBottomOrder
sub getTopOrder
sub setBottomOrder
sub setTopOrder
sub setTopID
sub exportForDebug
Returns all informations about the data source.
Define a data source, with georeferenced image directory.
Stores parameters and builds WMS request.
sub new
ImageSource constructor.
sub new
Harvesting constructor.
Close