Hexagon Geospatial
MENU

M.App Enterprise Tutorials

Not sure on how to get started or looking for a workflow to get M.App Enterprise up and running. Tutorials provide step by instruction on some of the most common configurations and workflows to get M.App Enterprise configured up and running quickly.
Showing results for 
Search instead for 
Do you mean 

Build a Browser App to run a spatial Recipe

by sturcato a week ago (23 Views)

Table of Contents:

 

This tutorial describes how to build a Browser Application with 2 panels:

  1. the first one to run a Spatial model using a Recipe Panel 
  2. the second one to see the result on a Map Panel

This implementation requires the new M.App Enterprise 2018 (16.5) release. The new release comes with an additional setup for the geoprocessing engine that must be installed on a dedicated server.

  

Geoprocessing server installation

The Geoprocessing engine must be installed on a Web Server that can communicate with the M.App Enterprise server. In particular we have two types of interactions:

  1. on the client side Applications must be able to call the Geoprocessing server to get the list of available Recipes, the list of operators, to store new Recipes and to run models. Thus, the client must be able to browse (over http/https) the Geoprocessing server.
  2. on the server side the Geoprocessing server must be able to reach the Warehouse folder to get and store inputs and outputs for the Recipes. Thus, the warehouse folder must be configured in M.App Enterprise as UNC path and the Geoprocessing server must be configured using a dedicated account who is able to browse that path.

 There are some software prerequisites that must be installed before proceeding with the setup:

  1. Java Runtime Environment: it is recommended the installation of the latest Java 8 64 bit release from Oracle download website.
  2. Windows Roles and Features (confirm any prerequisite needed for the following features):
    1. Role: Web Server
    2. Features: 
      1. selected by default
      2. Performance -> Dynamic Content Compression 
      3. Application Development -> .NET Extensibility 4.5, ASP.NET 4.5

When you have installed the prerequisite you can run the Geoprocessing 2018 setup what will list the packages you are going to install:

geoprocessing1.PNG

 

At the end of the installation you will be asked to run the configuration wizard in which you can keep the default settings (or refer to the installation document for more details and possibility of changes). The only step where to change the default settings is summarized below:

geoprocessing5.PNGgeoprocessing5b.PNG

 

NOTE: At the end of the installation and configuration you MUST RESTART the server, even if the setup does not notify it..

 

For additional references and more detailed descriptions refer to the documents provided in the Release Information section.

 

 

Use case description

 The use case we are going to implement is an App to identify changes over time. We will use a model that takes 2 images (multispectral, 3 bands) as input from the 2 different periods of time. The Recipe will analyze the inputs and will create a new image as output that will then be displayed on the map for user inspection. The output is indeed a thematic raster with a specific color associated to the probability of change in the corresponding area (high probability of change is associated to a RED based range of colors).

As you can see from the preview below we have an area with construction sites, where the model is able to associate, with a good confidence, there have been changes over time.

 

20072008changeoutput

 

Application preparation

In this section we will only mention the steps related to this specific type of Apps. If you need additional details on how to configure an App please refer to the main documentation or to more generic tutorials.

For this specific use case you will have to prepare a Legend with a couple of images ("before" and "after" Image; it is not mandatory to add them to the legend, we will use them just to compare the output of the process with those inputs) and OSM and a Map View with the following properties:

  • Legend: what you have already configured
  • EPSG: 3857
  • BBOX: overlaps the area of the 2 input images

The first step is to create a Browser App with 2 panels. The left panel will contain a Recipe template, the right one a Map panel (for the map you will also need a Legend and a MapView). The App configuration will look like this (drag&drop the panel templates to the corresponding sections):

Capture.PNG

 

For the Map panel you can click and select the existing MapView that contains the needed layers.

Clicking on the Recipe panel you will have the possibility to select an existing recipe or to create a new one (if it is the first time you use this panel template in your tenant you will have only the possibility of creating a new one).

 

select recipe.PNG

 

Click on "Create new" and you will get redirected to the Spatial Workshop user interface. 

 

Recipe definition

A Spatial Recipe is a model of interconnected operators that perform geospatial processing. 

The definition of the Recipe to analyze inputs and create information as output is done through the Spatial Workshop application. If you are familiar with ERDAS Imagine or GeoMedia, this is the transposition to the web of the Spatial Model Editor user interface. Spatial Workshop is an editing environment for creating algorithms by dragging and dropping spatial operators from the Operators list.

To get additional information about this application you can click on the Help button on the top right corner of the App.

 

In this particular case you can simply click on the Import button on the top bar and load the model definition attached to this article. You should get a result like the following:

 

spatial workshop.PNG

 

You can change the name or keep the existing one and then save it. The Recipe will be saved in your Tenant configuration and will then be available to be selected for any Application defined with Studio (in particular using the Recipe Panel template).

Looking at the model definition we can see 4 ports:

  • Input Before Image
  • Input After Image
  • Color Scheme (this is an optional parameter that can be used to transform the color scheme of the output raster)
  • Output Image

We will need the name Output Image in the app configuration to automate the display of the output raster on the map.

 

Finalizing the App

Going back to the App configuration we can click again on the Recipe Panel and now we are able to select the newly created Recipe and clicking Next on the top right corner we can define the details for the Recipe configuration.

 

select existing recipe recipe details

 

For each input you can already specify values (existing images, the color scheme and the folder for the output). If you check the Bound setting the user will not be able to change the port value (the port will be hidden running the App), otherwise, even if you preselect the values, the user will get the possibility of changing them.

 

NOTE: input and output files for Recipes will be contained in the M.App Enterprise Warehouse folder on the server side. They will be segregated by Tenant, so a Recipe in the Tenant 'A' will be able to use only files from the Tenant 'A' Warehouse. 

 

You can click on OK and you will get redirected on the main App configuration. Now we have to click on Customization (third tab of the left menu). The goal is to automatically add the output of the Spatial Recipe to the legend of the Map panel. To do this we have to add some Javascript code to both the Recipe Panel and the Map Panel.

Click on JS button for the Recipe Panel and in the left menu click on Code Examples, scroll down, find the Recipe Panel customization and drag&drop it in the central text area (JS of the Recipe). In the code itself you have to modify the OUTPUT_PORT_NAME text with the actual name of the port for the output image (in our case Output Image).

 recipe customization

 

For the Map Panel you have to drag&drop the Add WMS layer to the legend sample in the JS source code (no changes to the source code are required).

 

map customization.PNG

 

The App configuration is over.

 

Testing the App

In order to test the App you have to open the My Apps page for the tenant you have used so far and run the App. You can set as input parameters the 2 images that you have uploaded already to your M.App Enterprise Warehouse folder (for this specific tenant) and the same folder or a subfolder to store the output together with a desired name (the extension can be selected from the dropdown). You should get something similar to the following:

 

Change Detection App

 

You can now execute the model 

 

Model execution

 

end at the end you should get the output image added automatically to the legend and the map zoomed to its bbox:

 

Application Results

 

You can play with the resulting image in the legend switching it on/off to compare it with the original images (if you have added them to the legend in Studio) or changing the transparency. 

Overview
Contributors