Importing Photos - Using MapInfo and Spatial Queries

Importing / Attaching Existing Photographs
Bulk Import of Existing Photographs into a Dataset using Spatially Located Photos in MapInfo GIS


AFFECTS

Konect Manager

ISSUE

You have a large number of photographs that you want to import and link to records in a Konect dataset.

STEP-BY-STEP

Overview

This document discusses processes that can be used to import and associate a large number of existing photographs with records in a Konect Dataset. In this situation it is not practical to use the method described for a small number of photographs (see Importing Photos - Browsing from a Form)
The import process involves:

  1. Consolidate all photograph files to be imported into a single folder
  2. Produce a CSV file that contains a listing of Konect ID's and the photo filename to be linked to each Konect ID
  3. Place the CSV file in the same folder as the consolidated photographs
  4. Run the Konect Photo Import Tool


The instructions described are predominately related to the creation of the CSV file and it should be noted that it will not be possible to produce this file unless:

  • The photographs share an external unique ID with features already stored in Konect eg asset ID

OR

  • The photographs have been spatially located ie have coordinates allowing the photo location to be plotted on a map


Three methods for producing the CSV file can be used:

  1. Using Microsoft Excel – using a shared external unique ID  (link:  Importing Photos - Using Excel)
  2. Using MapInfo GIS – using a shared external unique ID (link:  Importing Photos - Using MapInfo with Linking ID's)
  3. Using MapInfo GIS – using spatial location (this article)

These instructions describe Method 3.

It is recommended that an appropriate file management structure is established to simplify the described processes. Ensure that a 'Photo' folder is created and all the images to be imported are copied to this location.


Instructions

A.  Export a TAB File from Konect

1.  Select the' Data Tab'

2.  Select the required Dataset from the list

3.  Select 'Export'. The export dialogue will open.

4.  Choose' MapInfo TAB File' as the 'Export Type'

5.  Ensure the 'Save photos' switch is set to off

6.  Click 'Save As' to open the Export to MapInfo Dialog (point 8 below)


7.  Browse to the file management folder established for the import task and 'Save' the table. In this example the file is called "AA_Example.tab" and the folder path is one level below the Photo folder.



B.  Prepare and process MapInfo tables

8.  In MapInfo open the TAB file exported from Konect. In this case "AA_Example.tab"


9.  Open the TAB file that has the mapped photo locations and a field containing the photograph filename. In this example this is "Photos_for_Export.tab". If a TAB file with mapped photo locations is not available then this process cannot be completed using this method.

NOTE: The photo locations must share identical coordinates (locations) with their related asset for the remainder of these instructions to work correctly. If coordinates are close but not exact matches then an alternate method using buffers will need to be used, however, it is beyond the scope of this document to describe this process.


10.  Add a field to the photo table called "Konect_ID". This should be a 254 character field and it must be the first field in the table.


11.  Run a Table > Update Column command to populate the Konect_ID with values from the exported Konect dataset.

        A.  Table to update = "Photos_for_Export.tab"

       B.  Column to Update = "Konect_ID"

       C.  Get Value From = "AA_Example.tab"

       D.  Calculate Value Of = "_id"

       E.  Specify Join - where object from "AA_Example"  INTERSECTS  object  from  "Photos_for_Export"


12.  Save the table. In this case "Photos_for_Export.tab"


C.  Export a CSV File from MapInfo

13.  Run a Table > Export command

        A.  Choose the "Photos_for_Export.tab"

       B.  Select 'Export'

       C.  Change the "Save as type" to CSV

       D.  Select 'Save' and save into the folder containing the photo files to be imported into Konect. The CSV must be in the same folder as the photo files.

       E.  Make sure that NO Column Titles are exported

       F.  OK


D.  Remove Formatting from the CSV File Using Notepad

NOTE: The CSV export from MapInfo will result in  "  " being placed around each value in the file. These must be removed for the Konect CSV import to work.

14.  Open the CSV file in Notepad (any text editor). There are " " around every value and the values are separated by ,


15.  Select Edit

16.  Select Replace from the menu

17.  Enter " as the Find value

18.  Leave Replace With blank

19. Select Replace All


20.  Close the Replace dialog


21.  Save the CSV file

E.  Final Editing of the CSV File in Excel

NOTE: Excel is the ideal tool to make any final edits to the exported CSV. There must be no header row and there must be only two columns - the first column is the Konect_ID and the second is the Photo filename. This format and field order is required by Konect in the next step. Edit the CSV to achieve this format.

22.  Open the CSV file in Excel


23. Complete any editing required to ensure that there are only two columns and no header row as shown below.


24.  Save the CSV file ensuring that the CSV format is maintained ie don't save as an xlsx file

25.  Close the CSV file. The following import in Konect will not work if the CSV file is left open.

F.  Import the Photographs into Konect

26.  Open Konect

27.  Select 'Catalogue'

28.  Select 'Import/Export'

29.  Select 'Photos – CSV/JPG'

30.  Click 'Browse'

31.  Select the CSV file exported, modified and saved at point 15 above.

32.  Select 'Open' and the import grid will populate


33.  Select the 'Dataset' to which the imported Photos will be linked

34.  Select the 'Photo field' to be linked

35.  Click 'Import'


36.  A status bar will present while the photographs are imported and uploaded to the database

37.  A summary of the import will present


38.  The photos will now be available in forms opened from Konect Manager or Konect App.