Infrastructure Map Server Developer

Reply
Contributor
rszabolcs
Posts: 19
Registered: ‎11-25-2008
Message 1 of 6 (22 Views)

Oracle view feature source

22 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
Contributor
rszabolcs
Posts: 19
Registered: ‎11-25-2008
Message 2 of 6 (22 Views)

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]
Member
RafaelDeMelo
Posts: 3
Registered: ‎08-22-2008
Message 3 of 6 (22 Views)

Re: Oracle view feature source

09-23-2009 12:06 PM in reply to: rszabolcs
Did you create an primary key for the view?
Contributor
rszabolcs
Posts: 19
Registered: ‎11-25-2008
Message 4 of 6 (22 Views)

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;
Contributor
rszabolcs
Posts: 19
Registered: ‎11-25-2008
Message 5 of 6 (22 Views)

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"
Contributor
rszabolcs
Posts: 19
Registered: ‎11-25-2008
Message 6 of 6 (22 Views)

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;

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community