Skip to main content
Training

Use Case 3: Queries & Print Layout

POSTED: | UPDATED: | by Marina Lanxinger

This tutorial showcases all the steps needed to create the Desktop App shown above. After this tutorial you will be able to create your own queries, print layouts and stylesets.

1. Data & Legend

To start, incorporate the vector data from the provided New York datasets into M.App Enterprise. Access your Studio account, navigate to Content in the left menu, and select Vector Data. Click on New, choose an existing connection or establish a new one, and then proceed to add the required datasets.

For this example you will need the following datasets from the NewYork database.

  • Crime 2023
  • Boroughs

Have a look at the post below and download the needed data.

New York Test Data - Description and Use
This tutorial aims to offer test data obtained from freely available datasets from New York. Each dataset will be explained in detail for easy comprehension. Overwiew of Data Dataset name Type airports Point boroughs MulitPolygon boroughs_label Point buildings MultiPolygon crime_2023 MultiPolygon crime_history MultiPolygon incidents Point noise Point
Lesson 3: Import vector data in M.App Enterprise
This tutorial will outline the steps to import vector data in M.App Enterprise and shows the options you will have to stream your data. Preliminaries Make sure to have your spatial datasets in one of the following database management systems: PostGIS, Oracle, Microsoft SQL Server, Hana Spatial indexing is
Lesson 4: Create a legend
💡Each legend created is applicable across various application types without creating specific legends for a browser app, desktop app and so on. If you logged in as a Studio Administrator you can create new legends in Content → Legend → New. In this form you have different possibilities: Left hand side Datasets

Google Maps background

A Google Maps Geoservice will serve as background layer in this application. Create a new Geoservice, name it accordingly and use your obtained API key from the Google Maps platform. Choose Type: Roadmap and Language: English and click on Save.

Different Geoservices in M.App Enterprise
WMS, WMTS, WFS, HERE Maps, Google Maps, ECWP and TMS This tutorial offers assistance in integrating different Geoservices in your M.App Enterprise application. WMS/ WMTS/ WFS Content → Geoservices → New → WMS/WMTS/WFS Web Map Services (WMS), Web Map Tile Services (WMTS) and Web Feature Services (WFS) are added in

2. Styleset

Navigate to the content menu and choose Styleset. Then create a new one and name it "UseCase3".

Style Wizards
Style wizards support you to get automatically eye-pleasing styles based on attributes of the vector data. It is designated for the categorization of attributes and offers two options. Content → Stylesets → Generate To use a style wizard, navigate to stylesets in the content menu of M.App Studio and click on

Crime 2023 layer

Once in the Style Editor, open the wizard by clicking on Generate and Graduated. From there, select the Crime 2023 layer and Robbery as the input parameters. Select 5 classes for the data ranges and adapt the colors:

  1. #A6BDDB
  2. #D0D1E6
  3. #ECE2F0
  4. #FA9FB5
  5. #C51B8A

Finally, change the names of the classes to the ones in the image below.

Boroughs layer

Open the style editor and select Boroughs from the unstyled layers list. Apply a simple, conventional style to the Boroughs layer. Use a black stroke color (#010101) and a stroke width of 1 pixel. This will give the Boroughs layer a basic, standard appearance.

3. Query

A query will enable the app users to filter data directly in the desktop application.

Queries
Queries enable filtering of geographic objects based on specified attributive and spatial constraints. This post will explain the basics of queries in a step-by-step approach. 💡Basically, queries allow you to get specific information about one or more geometries out of the database. Results of the query can be observed in

Navigate to Desktop → Queries → New. Name your Query "Crime in NYC", choose the Crime 2023 dataset for both the query and the display dataset.
Copy the following SQL Query in the query field. Don't forget to test it, before you save it.


SELECT precinct as Precinct, robbery as Robberies, total_crime as "Total crime" from crime_2023 where precinct = {ENTITY.precinct} 
  

4.Print Layout

To enable the users to print the map from our Crime App, we have to create a print layout. A default layout is available, but let's create a new one ;-)

To design your own print layout, navigate to Tools and click onPrint Layout. The Print Layout Editor will open and you can start with the design.

The elements on the right handside can be dragged and dropped into your print layout.

  • Let's start with adding a Map. Simply enlarge the window so that it fills the entire page.
  • Now drag and drop the Northarrow element from the left to the print layout page. Place it in the right bottom corner and leave a margin of about half a centimeter to both sides. In the settings on the right side change the dropdown to Show border: No, Fill: Yes and Apply.
  • The next element to add is a Scalebar. Place it right next to the north arrow, set the border invisible as well, and the fill to "yes".
  • Add a Legend element and fit it to the left bottom corner with a small margin again to the sides. Adapt the size to have 3 Themes visible in the layout.
  • Finally, since we want to have a title for our map, add a Text field to the top of the layout. Again, set the border invisible.
    • Open an empty word document and write "Robbery incidents in New York City in 2023" in it.
    • Change the font to Segoe UI, the font size to 24 and change the color to white.
    • Copy the text and paste it into the text field under Text-Settings. Click on Apply to make the changes effective.

Having added and arranged all the elements, your print layout is now ready to use. Save the file on your local drive. Now go back to Studio and navigate to Desktop Print Layouts

Upload the previously created Print Layout file from your drive here and assign a name like "UseCase3 PrintLayout". Save it and proceed with the next step.

5. Desktop App

Now that the components for our App are completed, we can put the pieces of the puzzle together.

Choose the previously created Legend, Styleset and Print Layout, assign a Name and an EPSG code and click on save.

6. App User options

This paragraph serves to show the possibilities for users in the App.

Filtering

Due to the Query you have created previously, app users can now select certain precincts by their id.

In the desktop app, simply click inside the Quick Search field. A dropdown with your saved query will appear. To run the query, just double-click it. This brings up an input field where the user can enter any precinct ID.

By clicking OK, a table with the dataset and the attributes defined in the query will appear at the bottom of the screen.

Printing

To make use of the printing option just click on the printer icon in the toolbar on top of your desktop app.

The standard print settings window will open.

⚠️
Since we are using a landscape oriented print layout, make sure to change the orientation also in the print settings.

When you click OK, the print layout settings will open. The green area marks the area of the map view. You can adjust the map section by zooming in or out or moving the area. In our case, we move the map a little to the left and up so that the legend and title do not obscure the contents of the map.

Click on Legend to open a panel with all the legend entries. With a double-click on "Boroughs" and "HERE_Dark" you can set these layers invisible on the legend.

💡
The preview button allows you to test your settings and preview the print setup.

To print your map or create a PDF that matches the image below, select the Print option.