Quantcast
Channel: OpenCities Map Wiki
Viewing all articles
Browse latest Browse all 1284

- Creating Oracle Spatial Views

$
0
0
Current Revision posted to Bentley Map - Wiki by Inga Morozoff on 4/19/2018 8:07:43 PM

The following may be helpful to create an Oracle view that can be registered and queried as a spatial feature.

The PARCELS has a number of columns:

Oracle Database 12c Standard Edition Release 12.2.0.1.0 - 64bit Production

 SQL> DESCRIBE PARCELS;

Name                                 Null?   Type

------------------------------------ -------- ------------------

OWNER                                         VARCHAR2(50)

ADDRESS_1                                  VARCHAR2(50)

CITY_STATE_ZIP                         VARCHAR2(30)

ADDRESS_2                                   VARCHAR2(50)

LAND_TYPE                                  VARCHAR2(24)

TOWNSHIP                                     VARCHAR2(24)

FIRE_DISTRICT                             VARCHAR2(24)

ZONING                                           VARCHAR2(8)

TAX_DISTRICT                              VARCHAR2(8)

OGC_GEOMETRY                         MDSYS.SDO_GEOMETRY

XFM_ID                     NOT NULL VARCHAR2(36)

ACRES                                             NUMBER(8,2)

ASSESSMENT_YEAR                    NUMBER(8)

DEEDBOOK                                     NUMBER(8)

LAND_VALUE                                NUMBER(8)

MARKET_VALUE                           NUMBER(8)

REMODELED_YEAR                      NUMBER(8)

ROOMS                                            NUMBER(8)

SALE_PRICE                                    NUMBER(8)

TAXABLE_VALUE                         NUMBER(8)

 

These columns are also visible in Bentley Map using the Data Browser or Analyze Feature:

This complete set of property data may be needed for managing the parcel data in Bentley Map by GIS editors. However, for map reviewers, it may be necessary to provide a limited set of property data. To to that, you can set up an Oracle view.

In the following example, a view called PARCEL_MAIL_VIEW is created with the following columns from the PARCELS table: OWNER, ADDRESS_1, CITY_STATE_ZIP, XFM_ID, and OGC_GEOMETRY

 

SQL> CREATE VIEW PARCEL_MAIL_VIEW

2 AS SELECT OWNER, ADDRESS_1, CITY_STATE_ZIP, XFM_ID, OGC_GEOMETRY

3 FROM PARCELS;

View created.

 

Bentley Map requires a primary key be defined on the spatial table. However you can’t have a primary key on a view. To get around this limitation, a primary key is created and then disabled.

we create the primary key, but we disable it, by the following:

 

SQL> ALTER VIEW PARCEL_MAIL_VIEW ADD PRIMARY KEY(XFM_ID) DISABLE;

View altered.

 

As with spatial tables, the geometry metadata needs to be added:

 

SQL> INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)

2             VALUES ('PARCEL_MAIL_VIEW', 'OGC_GEOMETRY',

3             MDSYS.SDO_DIM_ARRAY

4 (

5 MDSYS.SDO_DIM_ELEMENT('X', 2197290.78, 2401264.08, 0.00000005),

6 MDSYS.SDO_DIM_ELEMENT('Y', 703310.077, 911592.401, 0.00000005)

7 ),

8 NULL);

 

1 row created.

  

Reviewing the contents of the view in Oracle SQL Developer shows that it only contains those columns as specified in the CREATE VIEW statement.

 

 

  

When registering the Oracle data source in Bentley Geospatial Administrator, the view will appear in the Register Features page of the wizard.

 

 

Once registered, you can proceed to insert the feature placement metadata, define symbology and perform any other administrator tasks required. Once saved and exported, the same columns are available for review using the Data Browser:

 

 

  

Using Oracle views is a great way to show limited property data in Bentley Map. In this example, you could query the data and easily save the mailing address into a CSV file to use with a Microsoft Word mail merge.

 

Lastly, you can also consider creating Oracle user roles to provide further protection to the data. For example, a GIS_EDITOR role for the users who require full access to the spatial tables and data, and a GIS_VIEWER role for those users who only need to view the data.

A PDF of this article is available for download:

communities.bentley.com/.../Creating-Oracle-Spatial-Views.pdf

Tags: Oracle, Views

Viewing all articles
Browse latest Browse all 1284

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>