TIPS AND TRICKS

This page details some helpful tips and tricks relating to data publication within the DataBC Program.


Table of Contents


CONNECTING TO THE BCGW

Use the following information to create connections to DataBC database environments.

It is a best practise to connect to the BCGW in ArcCatalog prior to starting work in ArcMap. This helps users avoid waiting for BCGW connection multiple times over the course of thier daily work.

Connecting to BCGW Production using ArcGIS Desktop

In ArcCatalog, under Database Connections, there should be a Database Connection configured called BCGW.sde

  • If you do not see this connection in ArcCatalog, click Add Database Connection and set the Database Connection properties to:
    • Database Platform: Oracle
    • Instance: <BCGW Host Name>/<BCGW Service Name>
      • If you do not know the instance information (BCGW Host Name and BCGW Service Name), please open a ticket with the Data Systems & Services request system, with the subject Request: BCGW Production Instance Details.
    • User Name: this is your IDIR
    • Password: this is your BCGW password How do I get an account to the BCGW?
    • DO NOT save your credentials in database connections as this will embed your username and password into any saved MXDs and LYRs that use this connection. This poses a security threat and can corrupt your MXDs when you are required to change your password.

Other Database Connections

The BC Geographic Warehouse has three environments: Delivery, Test, and Production, which can be directly connected to from GTS desktops. For data review purposes you may need to connect to the BCGW Test or Delivery databases. These connections are not part of the default start up script on NRS GTS desktops, therefore they will need to be added.

  1. Open ArcCatalog
  2. Expand Database Connections
  3. Click on Add Database Connection and fill in the appropriate parameters
    • Chose Database Platform: Oracle
    • Instance: <Host Name>/<Service Name> or <tns alias>
      • If you do not know the instance information (BCGW Host Name and BCGW Service Name), please open a ticket with the Data Systems & Services request system, with the subject Request: BCGW [Delivery or Test] Instance Details.
    • Again DO NOT save username or password
  4. Rename the sde database connection to the appropriate name for BCGW delivery or test database environments:
    • BCGWTEST.sde
    • BCGWDLVR.sde

Connecting to BCGW Production using FME

Easy Connects are recommended.

<Server Alias>/<Service Name>

If not using an Easy Connect then the connection requires ESRI syntax and thus is dependent on the local version of ArcGIS and Oracle Client configuration.

  • Example:
    ArcGIS 10.6 - <BCGW Host Name>/<BCGW Service Name>

ADDING DATA USING ARCGIS DESKTOP

The following outlines how to use ArcCatalog to connect to BCGW data efficiently, so users are not repeatidly waiting for connection to the entire BCGW.

ADDING LAYERFILES

There are two ways to access pre-styled layers from the Layerfile Library: the TSAT Toolbar in ArcMap and ArcCatalog. Layerfiles use standard themes to represent data and can be very useful for quick and consistent visualization and map production.

Tip: It is suggested to avoid using the Add Data button in ArcMap, as this re-establishes the connection to the BCGW each time, resulting in long waits to access data.

TSAT toolbar in ArcMap

  • In ArcMap, from the TSAT toolbar, click the Add Library Layers button.
  • Search or browse for your layer(s), and then add to your map Tip: Adding layerfiles via the TSAT Toolbar allows the user to search using keywords

ArcCatalog

  • Make sure you have a network connection in Windows Explorer on the GTS to \data.bcgov\layer_library. If this connection is not set up first in Windows Explorer, it will not be available to connect to in ArcCatalog
  • In ArcCatalog, set up a Folder Connection to \data.bcgov\layer_library
  • Browse for the layer, then drag-and-drop into ArcMap

ADDING DATA DIRECTLY FROM BCGW

  • If you know the object name of the data you want to add to your map, open the BCGW connection and browse for the object. Drag-and-drop into your map.
  • If you do not know the object name for your data, use the BC Data Catalogue to browse for data and the associated object name (shown at the bottom of the metadata record).

RETURN TO TOP


IDENTIFIED BUGS

1. RED (!) beside all layer names, indicating data sources are broken. UNCONFIRMED IF STILL A BUG

Tip: Open the layer properties and review the Source - this will show the original object name for the broken layer. e.g., WHSE_BASEMAPPING.TRIM_WATER_LINES

  • Workaround
    • Add a standalone layer from the same DB connection and leave it at the top of table of contents/drawing order.
    • The first standalone layer in the table of contents cannot be text (annotation) or a group layer.
    • This presentation can be turned off
    • Once added, Save and close the document.
    • Next time it is opened all connections should be live.

UPDATING DATA SOURCES

VIA ArcCatalog

This is how ESRI recommends changing sources but as some MXDs have a large variety of source metadata embedded this can take some time. A few additional tips are included below:

  1. Connect to the BCGW in ArcCatalog. You will only need to connect to the BCGW once when taking this as a first step, avoiding being promtped multiple times when changing more than one source.
  2. In ArcCatalog navigate to the MXD
  3. Right Click and hit Set Data Source(s)…

 Set Data Source(s) in ArcCatalog

  1. You will be prompted for a user name and password potentially more than once. If you already logged in in Step 1, then we recommend that you hit Cancel on these.
  2. Change the Current data source with the New data source by one or mix of the following:
    • copy the following text Database Connections\BCGW.sde and pasting accordingly into the Replace with…
      • If only a few layers:
        • Copy and paste one by one into each New data Source
      • If all the same Current data source path:
        • Select All and then Replace All and paste into Replace with…
      • If many different Current data source paths:
        • Select only the same and then hit Replace and paste into Replace with…
        • You may have to do this multiple times until all off the data sources have been changed

Set Data Sources

  1. Once done hit OK.

VIA ArcGIS Documents

This section describes how to manage Oracle database connections in ArcMap and ArcCatalog.

ESRI’s guidance on repairing broken links for multiple layers

  1. Open MXD
  2. When prompted for BCGW database credentials hit the Cancel button. You may have to hit Cancel more than once
  3. All the feature classes connected to the BCGW will now have red exclamation mark (!)**

Broken Links in MXDs

  1. TIP!!! Determine the name of one of the feature classes by double clicking on it in the pane, which opens the Layer Properties
  2. Select the Source tab and copy the name of the feature class.
    • This is done so that you don’t have to scroll through all the objects but can paste it later in the steps
  3. Close the Layer Properties
  4. At this point there are two options:
    1. Click directly on the red exclamation mark for that feature class. This opens the Set Data Source window or
    2. Right click on a dataset and scroll down to -> Data -> Repair Data Source…
  5. Navigate to Database Connections and click on the predefined connection called BCGW.sde

  6. Enter your BCGW credentials
  7. Paste the name of the feature class or scroll down to the feature class and select

Select BCGW Dataset

  1. Hit Add

Let this run.

  • Large MXDs may take a while to run.
Generic arcpy python tools for updating connections

Please see ESRI’s guidance for updating and fixing data sources

Available DataBC Script Tools

There are Multi LYR File Update OR Single MXD File Update Database Connections for 10.6 clients. For GTS users and Government employees the scripts are available here:

****[gogs Update Database Connections](https://gogs.data.gov.bc.ca/daops/UpdateDatabaseConnections) - this is a \*.pyt python tool box with two scripts **(WHICH REQUIRES THE USE OF THE ARCINFO LICENSE LEVEL)** one for multiple layer file conversion and one for a single MXD update:

Tby.PNG

Some things to consider:

  • There is a How To document here - How to use Single MXD File Update Database Connections

  • Click X to close the window on any database connection prompts and it will run faster.
  • Enable the ArcINFO licensing level on your client
  • There is an issue of connection prompts hiding
    • look for and close connection prompt windows by clicking the X button
    • ESRI/ArcPY does not allow a way to automate this step!
  • Garbage collection and creating new layouts/data frames in MXDs is not possible with ArcPY.

    • LIMITATION #1 - You can not do the same thing in arcpy that the saveAs feature in ArcMAP does (ie. cleans out garbage info and unused mxd connection info),
    • LIMITATION #2 - You cannot create or copy map layouts or data frames to other MXDs (you can only modify them)

Due to these limitations there are two output MXDs created per Single MXD script run. Their suffixes are:

  • *do_a_saveAs_on_this_to_remove_useless_connects.mxd -can be used IF the input HAD map layouts and/or multiple data frames (do a ‘saveAs’ in ArcMap/Catalog to rid it of the unused connection prompts.
  • *cleaned_but_has_removed_any_layouts_or_extra_data_frames.mxd - can be used IF the input did not have map layouts OR multiple data frames
  • This script will not do annotation layers
  • This script will not remap joins
  • If you leave the parameters blank for service and server name will overwrite ALL connections regardless of connection type

Post Update Testing:

  • FOR ALL APPROACHES ALWAYS VERIFY!
  • To verify, open MXD/LYR in ArcMap and check the data source tab in the table of contents.

RETURN TO TOP