What is Macro¶
Macro is an instrument for launching tasks from the entity context menu, on a graph or a map. Macro executes tasks and enriches your workspace and entities.
Creating a graph macro for your task¶
def get_graph_macros(self): return MacroCollection( Macro(name='Vendor lookup', mapping_flags=[GraphMappingFlags.Completely], schemas=[VendorsSchema]) )
Macroconstructor takes 3 required arguments:
nameis a name for context menu item
mapping_flagsis more of a Lampyre developer thing. You should always use GraphMappingFlags.Completely for graph macros.
schemasis a collection of schemas, that will be added to a graph, from which the macro was called.
Upload this task to Lampyre and create an empty graph by selecting File - New schema. Now navigate to the Instances tab, create an instance of MAC address on a graph and fill it’s attribute with some value. Now when you have an object with a required attribute, you can launch your macro:
The schema, described in this task, contains two objects: MAC address and Vendor. When the request is complete, this schema is deployed on your graph, merging its MAC address object with the existing one, and therefore connecting it to Vendor
GIS macros are much similar to the graph ones, except that they appear in context menus of objects on a map or on this map itself.
To make your task’s macro available for the map context menu, your task must have an enterparam, marked as geojson. If this requirement is fulfilled, you can select a point, figure or line on your map and launch your macro from it’s context menu.
If you want to launch your macro from objects on a map, setup value sources in your task’s parameters just like for the graph macro.
mapping_flags for such macros are listed in
GisMappingFlags.Instancesmeans that the macro will place objects onto a map after its completion
GisMappingFlags.Heatmapinstructs the macro to create a heatmap based on the count of the objects
GisMappingFlags.Pathallows creating an object’s path based on the combination of Datetime and Geopoint attributes
Icons for custom objects provided by Icons 8