Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of variables in configuration script #24

Closed
eagletilmann opened this issue Jul 22, 2015 · 2 comments
Closed

Use of variables in configuration script #24

eagletilmann opened this issue Jul 22, 2015 · 2 comments

Comments

@eagletilmann
Copy link

When using a batch file to create a series of similar Mosaic datasets from the same configuration file (see extract below) I am not able to use variables in the batch and configuration files.

The variables seem to be ignored and the default value is always used. Also: how is a variable used when the variable name is non-unique in the configuration XML? (as is the case with <Name> which occurs twice at the top of the file). I am getting a
log-critical: Error: <Name> should be the first child-element in <MosaicDataset>
and then the MDCS script fails.

The help specifies the following syntax:
<defaultValue>;$<variableName>

which in my case for below configuration file looks as follows when I want the <MosaicDataset><Name>, <dataset_id> and <filter> variables to be dynamically specified:

c:\python27\ArcGIS10.3\python.exe C:\Image_Mgmt_Workflow\MDCS\scripts\mdcs.py -i:C:\Image_Mgmt_Workflow\MDCS\Parameter\Config\MPI_CreateMosaicDataset_GENERIC_AlbersEqualArea.xml -p:CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Ficticious$MosaicDataset/Name -p:CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year01$dataset_id -p:year=1$filter

<?xml version="1.0" encoding="utf-8"?>
<Application>
  <Name>CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC</Name>
  <Command>CM+AR+AF+BB+ERF+SP+CC+CV+AI+DO+BO</Command>
  <Workspace>
    <WorkspacePath>md</WorkspacePath>
    <Geodatabase>CatchMapper_MPI_Demo_YearlyMosaics</Geodatabase>
    <MosaicDataset>
     <Name>CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC;$</Name>
      <MosaicDatasetType>Source</MosaicDatasetType>
      <SRS>PROJCS['NZ_Albers_Equal_Area',GEOGCS['GCS_WGS_1984',DATUM
['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM
['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Albers'],PARAMETER
['false_easting',0.0],PARAMETER['false_northing',0.0],PARAMETER
['central_meridian',175.0],PARAMETER['standard_parallel_1',-30.0],PARAMETER
['standard_parallel_2',-50.0],PARAMETER['latitude_of_origin',-40.0],UNIT['Meter',1.0]]</SRS>
      <num_bands>1</num_bands>
      <pixel_type>8_BIT_UNSIGNED</pixel_type>
      <AddRasters>
       <AddRaster>
         <dataset_id>MPI8bit_mosaics_Albers_Year05Grouped;$</dataset_id>
         <raster_type>Table @ C:\Image_Mgmt_Workflow\MDCS\MD\CatchMapper_MPI_Demo_YearlyMosaics.gdb\CatchMapper_MPI_AlbersEqualArea_MDCS_Demo\RasterType.OBJECTID=3</raster_type>
      <Sources>   <data_path>C:\Image_Mgmt_Workflow\MDCS\MD\CatchMapper_MPI_Demo.gdb\CatchMapper_MPI_AlbersEqualArea_MDCS_Demo</data_path>
      </Sources>
      <filter>year=1;$</filter>
      <duplicate_items_action>OVERWRITE_DUPLICATES</duplicate_items_action>
    </AddRaster>
    </AddRasters>

Thanks for any help on this.

@PBecker92373
Copy link

Please note the correct syntax for the variable usage:
;$$

It looks like there's a typo in the doc or the single '$' functionality in the MDCS source has been removed for clarity. Will update doc.

Here the in the MDCS parameter file has to to be replaced with a unique name of your choice. Do this for all the variables you have, each with its own unique name without any duplicates unless you want the same user defined value to replace at multiple locations in the parameter file.

e.g. CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC;$MDName$

Now at the command like you can enter the following to replace the default value for the MD i.e CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC with a value of your choice.

e.g. -p:My_New_MD_Name$MDName

Please correct your parameter file and try. If you still face any issues, let us know.

From: eagletilmann [mailto:notifications@github.com]
Sent: Wednesday, July 22, 2015 2:52 PM
To: Esri/mdcs-py
Subject: [mdcs-py] Use of variables in configuration script (#24)

When using a batch file to create a series of similar Mosaic datasets from the same configuration file (see extract below) I am not able to use variables in the batch and configuration files.

The variables seem to be ignored and the default value is always used. Also: how is a variable used when the variable name is non-unique in the configuration XML? (as is the case with which occurs twice at the top of the file). I am getting a
log-critical: Error: should be the first child-element in
and then the MDCS script fails.

The help specifies the following syntax:
;$

which in my case for below configuration file looks as follows when I want the, and variables to be dynamically specified:

c:\python27\ArcGIS10.3\python.exe C:\Image_Mgmt_Workflow\MDCS\scripts\mdcs.py -i:C:\Image_Mgmt_Workflow\MDCS\Parameter\Config\MPI_CreateMosaicDataset_GENERIC_AlbersEqualArea.xml -p:CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Ficticious$MosaicDataset/Name -p:CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year01$dataset_id -p:year=1$filter

CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC

CM+AR+AF+BB+ERF+SP+CC+CV+AI+DO+BO

<WorkspacePath>md</WorkspacePath>

<Geodatabase>CatchMapper_MPI_Demo_YearlyMosaics</Geodatabase>

<MosaicDataset>

 <Name>CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC;$</Name>

  <MosaicDatasetType>Source</MosaicDatasetType>

  <SRS>PROJCS['NZ_Albers_Equal_Area',GEOGCS['GCS_WGS_1984',DATUM

['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM

['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Albers'],PARAMETER

['false_easting',0.0],PARAMETER['false_northing',0.0],PARAMETER

['central_meridian',175.0],PARAMETER['standard_parallel_1',-30.0],PARAMETER

['standard_parallel_2',-50.0],PARAMETER['latitude_of_origin',-40.0],UNIT['Meter',1.0]]

  <num_bands>1</num_bands>

  <pixel_type>8_BIT_UNSIGNED</pixel_type>

  <AddRasters>

   <AddRaster>

     <dataset_id>MPI8bit_mosaics_Albers_Year05Grouped;$</dataset_id>

     <raster_type>Table @ C:\Image_Mgmt_Workflow\MDCS\MD\CatchMapper_MPI_Demo_YearlyMosaics.gdb\CatchMapper_MPI_AlbersEqualArea_MDCS_Demo\RasterType.OBJECTID=3</raster_type>

  <Sources>   <data_path>C:\Image_Mgmt_Workflow\MDCS\MD\CatchMapper_MPI_Demo.gdb\CatchMapper_MPI_AlbersEqualArea_MDCS_Demo</data_path>

  </Sources>

  <filter>year=1;$</filter>

  <duplicate_items_action>OVERWRITE_DUPLICATES</duplicate_items_action>

</AddRaster>

</AddRasters>

Thanks for any help on this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24.

@eagletilmann
Copy link
Author

Thanks Peter,

That works - Have updated my batch and config files.

Just need to mention how MDCS really is the missing link for me when working with Mosaic datasets: scripted configuration of MDS will be the norm for me now- I can hardly believe how much manual configuration that is going to save!

Would you consider writing a blog entry for the Esri blogs to promote this?

Thanks for the great work!

Tilmann

On 25/07/2015, at 8:34 am, Peter Becker <notifications@github.commailto:notifications@github.com> wrote:

Please note the correct syntax for the variable usage:
;$$

It looks like there's a typo in the doc or the single '$' functionality in the MDCS source has been removed for clarity. Will update doc.

Here the in the MDCS parameter file has to to be replaced with a unique name of your choice. Do this for all the variables you have, each with its own unique name without any duplicates unless you want the same user defined value to replace at multiple locations in the parameter file.

e.g. CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC;$MDName$

Now at the command like you can enter the following to replace the default value for the MD i.e CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC with a value of your choice.

e.g. -p:My_New_MD_Name$MDName

Please correct your parameter file and try. If you still face any issues, let us know.

From: eagletilmann [mailto:notifications@github.com]
Sent: Wednesday, July 22, 2015 2:52 PM
To: Esri/mdcs-py
Subject: [mdcs-py] Use of variables in configuration script (#24)

When using a batch file to create a series of similar Mosaic datasets from the same configuration file (see extract below) I am not able to use variables in the batch and configuration files.

The variables seem to be ignored and the default value is always used. Also: how is a variable used when the variable name is non-unique in the configuration XML? (as is the case with which occurs twice at the top of the file). I am getting a
log-critical: Error: should be the first child-element in
and then the MDCS script fails.

The help specifies the following syntax:
;$

which in my case for below configuration file looks as follows when I want the, and variables to be dynamically specified:

c:\python27\ArcGIS10.3\python.exe C:\Image_Mgmt_Workflow\MDCS\scripts\mdcs.py -i:C:\Image_Mgmt_Workflow\MDCS\Parameter\Config\MPI_CreateMosaicDataset_GENERIC_AlbersEqualArea.xml -p:CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Ficticious$MosaicDataset/Name -p:CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year01$dataset_id -p:year=1$filter

CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC

CM+AR+AF+BB+ERF+SP+CC+CV+AI+DO+BO

md

CatchMapper_MPI_Demo_YearlyMosaics

CatchMapper_MPI_AlbersEqualArea_MDCS_Demo_Year_GENERIC;$

Source

PROJCS['NZ_Albers_Equal_Area',GEOGCS['GCS_WGS_1984',DATUM

['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM

['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Albers'],PARAMETER

['false_easting',0.0],PARAMETER['false_northing',0.0],PARAMETER

['central_meridian',175.0],PARAMETER['standard_parallel_1',-30.0],PARAMETER

['standard_parallel_2',-50.0],PARAMETER['latitude_of_origin',-40.0],UNIT['Meter',1.0]]

<num_bands>1</num_bands>

<pixel_type>8_BIT_UNSIGNED</pixel_type>

<dataset_id>MPI8bit_mosaics_Albers_Year05Grouped;$</dataset_id>

<raster_type>Table @ C:\Image_Mgmt_Workflow\MDCS\MD\CatchMapper_MPI_Demo_YearlyMosaics.gdb\CatchMapper_MPI_AlbersEqualArea_MDCS_Demo\RasterType.OBJECTID=3</raster_type>

<data_path>C:\Image_Mgmt_Workflow\MDCS\MD\CatchMapper_MPI_Demo.gdb\CatchMapper_MPI_AlbersEqualArea_MDCS_Demo</data_path>

year=1;$

<duplicate_items_action>OVERWRITE_DUPLICATES</duplicate_items_action>

Thanks for any help on this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24.


Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-124713042.

www.eagle.co.nz

This email is confidential and may be legally privileged.
If received in error please destroy and immediately notify us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants