A18.5 MMmacro commands - LUPMISManual

Go to content

Main menu:

Annexes 11-20 > A18. Programming

A18.5 MMmacro Commands

Level of expertise required for this Chapter: Expert / Programmer; general Map Maker training

Following commands are available in MMmacro, partly undocumented, and can be used in a macro / module approach in MS Access or other databases, including Open Source DBMS platforms.

Most command names are self-explanatory.

For examples to apply MMmacro in MS Access, see the previous chapter (Annex 18.4).

Don't forget, you must have Map Maker loaded, before you run MMmacro.

Command

Parameters

Explanation / Remarks


Layer:

command=add layer,

filename=C:\LUPMIS\Ghana\Ghana_roads,
name=roads

Add named layer

command=add layer,

filename=C:\LUPMIS\Ghana\Ghana_roads,
name=roads,
label=Display label

Add named layer with labels displayed (or 'Object ID' for ids to be displayed or ‘=No label’ to turn labels off) (*)

command=add layer,

filename=C:\LUPMIS\Ghana\Ghana_roads.shp,
name=roads

Add non-DRA files, many formats supported

command=add layer,

filename=C:\LUPMIS\Ghana\Ghana_roads,
name=roads,
database=C:\LUPMIS\Ghana\Ghana_roads.dbf,
link column=ID

Load with DBF file, similarly with MDB file (*)

command=add layer,

…(as above)…
data column=PP_STATUS

As above,
but with reference to specific data column in database (DBF), must be in capitals

command=add layer,

…(as above)…
style choice=data,
styles=C:\LUPMIS\Permits\Permits tl.stl

As above,
but with specified style (or style choice=internal)

command=add layer,

…(as above)…
on hit=database,
hit-able=yes

As above,
but with option to ‘hit’ data

command=move layer up,

name=roads

Move named layer up

command=move layer down,

name=roads

Move named layer down

command=hide layer,

name=roads

If layer already hidden, layer will be shown

command=remove layer

Remove all layers

command=remove layer

name=

Remove all layers (same as above)

command=remove layer

name=roads

Remove named layer (no path, no extension, only name)


Display:

command=goto,

x=645789,
y=789123

Center on given coordinates

command=zoom,

scale=5000

Zoom in/out to specified scale

command=zoom and goto,

x=645789,
y=789123,
scale=5000

Combine two commands (centering and zooming)

command=zoom relative,

factor=3.5

command=goto id,

layer=roads,
id=abc1234

Center on unit, specified by its id

command=goto id,

layer=roads,
id=abc1234,
autoscale=1.2

As above,
but ‘autoscale’ indicates multiple of max size of polygon or line. If =1, it will fill entire screen

command=goto id,

layer=roads,
id=abc1234,
marker=hello world

Goto id and place a marker


Live layer:

command=move layer to live layer,

name=roads

Move layer to live layer

command=load live layer,

filename=C:\LUPMIS\Ghana\Ghana_roads.dra

Load live layer

command=load live layer,

filename=C:\LUPMIS\Ghana\Ghana_roads.dra,
database=C:\LUPMIS\Ghana\Ghana_roads.mdb,
table=records,
link=ID

Load with MDB file (*)

command=load live layer,

filename=C:\LUPMIS\Ghana\Ghana_roads.dra,
database=C:\LUPMIS\Ghana\Ghana_roads.dbf,
link=ID

Load with DBF file (*)

command=save live layer,

filename=C:\LUPMIS\Ghana\Ghana_roads.dra,
database=C:\LUPMIS\Ghana\Ghana_roads.mdb,
table=roads

database= is optional,
table= can be blank or absent when DBF

command=clear live layer

(clears also markers)


Project:

command=load project,

filename=C:\LUPMIS\Kasoa\StructurePlan.geo

Loads entire project, which can be treated externally (ASCII file)

command=save project,

filename=C:\LUPMIS\Kasoa\StructurePlan.geo


Print:

command=print,

template=C:\LUPMIS\Template_parcel.ptp,
scale=10000,
show dialogue=yes

Print map with template, with dialogue box

command=print,

template=C:\LUPMIS\Template_parcel.ptp,
scale=10000,
show dialogue=no

Print map with template, without dialogue box

command=print,

filename=C:\LUPMIS\Temp_map.jpg,
template=C:\LUPMIS\Template_parcel.ptp

Print map to JPG or BMP or EMF file (*)

command=print,

filename=C:\LUPMIS\Temp_map.jpg,
template=C:\LUPMIS\Template_parcel.ptp,
width=2000

Same as above, but resolution defined

command=save screen,

filename=C:\LUPMIS\Temp_screen.jpg

Print screen to JPG or BMP file, without dialogue (*)

command=save screen,

filename=C:\LUPMIS\Temp_screen.jpg,
width=2000

Same as above, but resolution defined


Markers:

command=zoom and goto,

x=645789,
y=789123,
scale=5000,
marker=hello world

Create a marker

command=zoom and goto,

x=645789,
y=789123,
scale=5000,
marker=’hello world, I come’

Create a marker with comma (*)

command=save markers,

filename=C:\LUPMIS\Temp\Markers.dra

command=clear markers


File conversion and export:

command=convert file,

source=C:\LUPMIS\road_source.shp,
target=C:\LUPMIS\road_target.dra

Import from SHP format to DRA file

command=convert file,

source=C:\LUPMIS\road_source.dra,
target=C:\LUPMIS\road_target.shp

Export DRA file to SHP format

command=convert file,

source=C:\LUPMIS\road_source.dra,
target=C:\LUPMIS\road_target.mme

Export DRA file to MME format (MME format comprehensive and includes labels, but long)

command=convert file,

source=C:\LUPMIS\road_source.mme,
target=C:\LUPMIS\road_target.dra

Import from MME format to DRA file

command=convert file,

source=C:\LUPMIS\road_source.dra,
target=C:\LUPMIS\road_target.loc

Export DRA file to LOC format (LOC format short, but does not include labels)

command=convert file,

source=C:\LUPMIS\road_source.loc,
target=C:\LUPMIS\road_target.dra

Import from LOC format to DRA file (requires thorough testing, works reliably only if derived from earlier export from DRA file)

command=convert file,

source=C:\LUPMIS\road_source.xy,
target=C:\LUPMIS\road_target.dra

Import from XY format to DRA file (see Annex 16)

command=convert file,

source=C:\LUPMIS\road_source.dbf,
target=C:\LUPMIS\road_target.csv

Convert DBF file to CSV format (for easy import into databases)

command=convert file,

source=C:\LUPMIS\road_source.dra,
target=C:\LUPMIS\road_target.csv,
options=CAPTION;AREA;HECTARES;
LENGTH;SEED;STYLE

Export data from DRA file to CSV (or DBF) file, (CAPTION stands for label), for metadata of features

command=convert file,

In addition to above:
options=STYLENAME(C:\LUPMIS\mystyle.stl)

Same as above, but style names are included in the target database file (like classification lookup table)

command=convert file,

In addition to lines above:
options=species(id,road_data.mdb,table1,
Mm_id,tree species)

Same as above, but attributes are included:
- species: Name of column in road_data
- id: Attribute of DRA file, or ‘caption’ or ‘style’
- table1: Name of table in road_data (If DBF: blank, but present)
- mm_id: Name of column in road_data used to link to ID (or caption or style)
tree species: Name of column in road_data that contains the data to include

command=save legend,

filename=C:\LUPMIS\legend.emf

Saves legend as EMF file

command=get calibration,

source=C:\LUPMIS\road_source.jpg,
target=C:\Temp\Info.txt

Creates info (txt) file with calibration data of raster image file


Internal processing (no need for live layer):

command=ids to labels,

source=C:\LUPMIS\LocalPlan1.dra

Sets ids equal to display labels

command=ids to labels,

source=C:\LUPMIS\LocalPlan1.dra,
target= C:\LUPMIS\LocalPlan2.dra

Sets ids equal to display labels in different DRA file

command=labels to ids,

source=C:\LUPMIS\LocalPlan1.dra

Sets display labels equal to ids

command=labels to ids,

source=C:\LUPMIS\LocalPlan1.dra,
target= C:\LUPMIS\LocalPlan2.dra

Sets display labels equal to ids in different DRA file

command=remove duplicate objects,

source=C:\LUPMIS\LocalPlan1.dra

command=inherit attributes,

source=C:\LUPMIS\StructurePlan.dra,
target=C:\LUPMIS\LocalPlan.dra,
inherit style=yes,
inherit labels=no,
target in source=no

Inherits data attributes (here: styles only) from one DRA file to another (short form)

command=inherit attributes,

source=C:\LUPMIS\StructurePlan.dra,
source database=C:\LUPMIS\StructurePlan.dbf,
source link column=ID,
target=C:\LUPMIS\LocalPlan.dra,
target database=C:\LUPMIS\LocalPlan.dbf,
target link column=MM_id,
inherit style=yes,
inherit labels=no,
columns=landuse,
target in source=yes

Inherits data attributes from one DRA file to another (full syntax)

If transfer to/from MDB, add:
Source table=…
Target table=…

Inheritance (label) point is in target polygon

command=inherit attributes,

-- same as above --, but last line:
target in source=no

Inheritance (label) point is in source polygon


Batch processing:

C:\LUPMIS\batch.txt

Batch, with complete command lines in ASCII batch file


(*) There is a limit of the command line length, when calling from MS Access (approximately 270 characters), but not from many other sources, databases, platforms or batch processes.

- - - - -

For all above listed commands, Map Maker has to run in the background. The next Annex will explain, how to integrate these commands into your programmed application.


Note: Requirement: Map Maker version of 12 November 10 or later, and MMmacro.exe of 11 June 09 or later. See also official  lt Technical Paper 8 of Map Maker.

  





 
Back to content | Back to main menu