Skip to main content

Digitizing floor plans for use in Qlik GeoAnalytics (QGA)

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Patric_Nordstrom
Employee
Employee

Digitizing floor plans for use in Qlik GeoAnalytics (QGA)

Last Update:

Apr 2, 2021 4:18:51 AM

Updated By:

Patric_Nordstrom

Created date:

Aug 1, 2018 8:06:23 AM

Attachments

Update, the example app now have the drawing as a background.

Floor plans and cad drawings can be useful, for instance in production dashboards, to visualize status and flows in a factory. However cad drawings are in many cases a mess to work with.

 

Here's a simple, pragmatic approach to digitize rather than import the actual drawing. The major issue with most CAD drawings is lack of structure, details without meaning and the objects on the right level are missing. It’s not the format or alignment that is the problem. In many cases it's better to use the drawing as a input to produce the polygons and information needed.

 

In this tutorial I use QGIS for digitizing and out put to a format that is easy to import to QGA. In this example the drawing is digitized in a local reference system, ie no alignment is made with the rest of the world.

Step-by-step guide

  1. Install QGA basic, Plus not needed if Dropbox et al is used.
  2. Install QGIS (https://www.qgis.org)
  3. Get a picture of the floor plan in an image format like PNG or JPG.
  4. Drag and drop the image to the layers panel of QGIS. Choose a meter based Coordinate Reference System, for instance EPSG:3857 is a good choice.

    step4.png

  5. Layer→ Create Layer→ New Shapefile Layer... Choose Polygon, same CRS, 3857. Add "Name" text field for convenience.

    step5.png

  6. Save layer in a folder. Preferable in dropbox folder.

    step6.png

  7. Right click on the new polygon layer and "Toggle editing" to start editing.

    step7.png
  8. Start adding features (Ctrl +)
    step8.png

  9. Click on the edges of the desired polygon, set id and name. Use node tool if fine tuning of edges is necessary.

    step9.png
  10. When done "Toggle editing"to save.

    step10.png
  11. Zip the shapefile to an archive and get the dropbox url. (replace www with dl to get direct link)
    step11.png

  12. Create a new Sense app and use the drop url in the Load operator of QGA connector. CRS: EPSG:3857. Note change url from 'www' to 'dl' for direct file access in dropbox.
    step12.png

Example app

The example app features sites and a drawing visible when one site is selected.app.png

 

If you want to add and image background, here's how to scale and translate the image, in my example:

image.png

 

 

 

 

 

Tip 1: get a white background use ='[[ [-180, -80], [-180,  80], [ 180,  80], [ 180, -80], [-180, -80] ]]' for location, set color to white and make the layer non selectable and not part of autozoom.

 

Tip 2, Use a bubble layer with coordinates for different sites, when one site is selected turn on drawing and the white background.

Tags (1)
Labels (2)
Comments
Radu
Contributor II
Contributor II

Thanks for the tip Patric,

In the meanwhile I found this useful tutorial on youtube:

https://www.youtube.com/watch?v=hml7wX4O7Lw

And also there is a community post (with and example qvf attached):

https://community.qlik.com/t5/Qlik-Sense-Enterprise-Documents/Adding-a-background-layer-in-Qlik-Sens...

I also found out that for the moment there is no direct loading of local images, one has to set up an IIS locally to access them via URLs...it might be useful for the dev road-map to have also this functionality available (local files loading from file-system not URL). The thing that currently really beats my mind is how to set the bubble size according to the dimension / measure value.

Thanks

Radu

0 Likes
Patric_Nordstrom
Employee
Employee

One way would be to use a Base64 data URI as the URL string.

https://www.base64-image.de/

Or to upload the image to the QS media library and then find out the URL to the image with  JS dev tools F12.

Radu
Contributor II
Contributor II

Thanks, for those in need here is a tried and verified setup:

1) The folder to load images from could be any custom XXX folder under:

...AppData\Local\Programs\Qlik\Sense\Client\img\...

2) The URL should look like:

='http://localhost:4848/resources/img/XXX/YYY.png'

@Patric_Nordstrom : I am still struggling with the topleft and rightbottom values according to the height/width value from the custom image in order not to have the image shrink inside the object canvas...

I thought that according to the above mentioned tutorial I need a loading script that should have this section:

bounds:
load * inline [
bid,by,bx
topleft,461,0
bottomright,0,909
];

where first parameter after topleft = image height (in pixels)

and second parameter after bottomright = image width (in pixels)

After that in the Background layer the Top (latitude) = image height (in pixels)

and Right (longitude) = image width (in pixels)

But still the image is not centered and shrinked inside the object canvas. Do you have any hints why?

 

Thanks

 

Patric_Nordstrom
Employee
Employee

Please check settings in the app from the post.

In that example the image is 1182x1915px.

img_bg.png

Btw, serving images from localhost won't work in a network. Better to use the full URL.

0 Likes
pwagner
Partner - Creator III
Partner - Creator III

Hello,

@jfdierckx  and @paulriedel have you already found an solution to bring in the background image into the GeoAnalytics map?

I can create the shapefile in QGIS and I manage to load to shapefile into Qlik Sense with the GeoAnalytics operations 'Load'. Furthermore the polygons are on the GeoAnalytics map.

But how can I add the background image to the GeoAnalytics map@Patric_Nordstrom  or @ChristofSchwarz  do you have an advice for me/us? Or should we use the 'standard' Qlik Sense map instead of the GeoAnalytics map for custom maps?

0 Likes
Rolando_Montero
Partner - Creator
Partner - Creator

Hello Mr. Patric,

I am trying to do the same but with car parts. I manually drew the borders following an image which I later uploaded to a Qlik Sense library. I having some issues with the coordinates that are required to align both the image and the layer drawn in QGIS (I am using version 2.18.28). I have two questions pertaining to this:

Is there a way or method to get exactly the coordinates you need to align the image with the layer? If you see image 01, the image of the engine parts is not aligned with the shape layer. On the right, the pickup truck has a subtle difference at the back between the image and the layer; nevertheless, they are not in alignment with one another. In order to solve this, I tried a couple of numbers to no avail.  As I mentioned before, the images in Qlik are the same ones I used to draw the lines in QGIS. 

Am I missing something while exporting the shapefile from QGIS? Maybe, the scale of the image (Image 02.)

(Image 01)

image01.png

 

(Image 02)

Rolando_Montero_0-1610584472390.png

 

Best regards 

0 Likes
Patric_Nordstrom
Employee
Employee

@Rolando_Montero 

I would do small adjustment in the xscale "right (longitude)" (see my figure above) to squeeze the image width. That would probably do it.

Thanks,

Patric

0 Likes
Version history
Last update:
‎2021-04-02 04:18 AM
Updated by: