• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk MapGuide Enterprise Developer

    Reply
    Contributor
    Posts: 19
    Registered: ‎11-25-2008

    Oracle view feature source

    3 Views, 5 Replies
    09-23-2009 08:51 AM
    Hi,

    We would like to use Oracle views (based on Spatial tables) for feature sources of the Mapguide layers. The display of the features is o.k., but the selection does not work. It does not work in the viewer, I can't select elements, nothing happens when I click on an element or draw envelope around an element. And it does not work from the API, I try to use the $selection->ToXml() and the XML looks like this, the IDs are empty:










    But if I modify the layer definition, and set the feature source to the Oracle table, instead of the view, the selection works fine, either with the viewer or from the API.

    What is missing from the view? Should I put any specific column into the view? I tried the "FEATID", but nothing changed.

    Mapguide Enterprise 2010
    Oracle 10.2.0.4
    Linux

    Thanks,
    Szabolcs
    Please use plain text.
    Contributor
    Posts: 19
    Registered: ‎11-25-2008

    Re: Oracle view feature source

    09-23-2009 08:54 AM in reply to: rszabolcs
    ooops, the engine erased my XML....

    so the XML is something like this:

    [?xml version="1.0" encoding="UTF-8"?]
    [FeatureSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd"]
    [Layer id="177000fc-0000-1000-8000-0019660110f5"]
    [Class id="FdoERV_GIS_IPE:ETAB_VV_VEZ_4_V"]
    [ID][/ID] [ID][/ID] [ID][/ID] [ID][/ID] [ID][/ID] [ID][/ID] [ID][/ID] [ID][/ID] [ID][/ID] [ID][/ID]
    [/Class]
    [/Layer]
    [/FeatureSet]
    Please use plain text.
    Member
    Posts: 3
    Registered: ‎08-22-2008

    Re: Oracle view feature source

    09-23-2009 12:06 PM in reply to: rszabolcs
    Did you create an primary key for the view?
    Please use plain text.
    Contributor
    Posts: 19
    Registered: ‎11-25-2008

    Re: Oracle view feature source

    09-24-2009 12:11 AM in reply to: rszabolcs
    The view is a join of two tables, like this:

    create table A
    (
    geom_id number primary key,
    geom mdsys.sdo_geometry,
    b_id number,
    ....
    );

    create table B
    (
    id number primary key,
    code varchar2(20),
    name varchar2(200),
    ....
    );

    create or replace view AB_V as
    select
    A.geom_id,
    A.geom,
    B.id,
    B.code
    ...
    A.geom_id ID,
    A.geom_id FEATID
    from
    A,B
    where
    A.b_id = B.id;
    Please use plain text.
    Contributor
    Posts: 19
    Registered: ‎11-25-2008

    Re: Oracle view feature source

    10-06-2009 06:04 AM in reply to: rszabolcs
    I didn't know that I can create primary key for a view. I created PKs for the tables only.

    Here is the sollution:
    http://www.mail-archive.com/mapguide-users@lists.osgeo.org/msg10933.html

    "RE: [mapguide-users] Oracle FDO and View
    Bruno Scott
    Fri, 29 May 2009 02:15:36 -0700

    This is the SQL syntax to add a primary key on an Oracle View

    alter view add constraint primary key
    () disable novalidate;

    Once the view has a primary key, selection becomes available.

    Bruno"
    Please use plain text.
    Contributor
    Posts: 19
    Registered: ‎11-25-2008

    Re: Oracle view feature source

    10-06-2009 06:07 AM in reply to: rszabolcs
    alter view [viewname] add constraint [constraintname] primary key ([columnlist]) disable novalidate;
    Please use plain text.