Skip to main content
Solved

Oracle Sptial Object Reader


Hello,

 

 

I want to create a shapefile from a view in Oracle Spatial. View is created by another application by querying number of table. So schema of the view changes every time. I am able to create shapefile first time but once schema changes I am not able to create. What should I need to do to handle this dynamic schema.

 

 

Cheers

Best answer by gio

If you have extracted the schema you then should be able to use dynamic writer, a shapefilewriter in dynamic mode.

 

 

On writer's general  tab you can choose Dynamic properties and point to the schema resource.

 

 

Of course you have to write the extracted shema to a file first.

 

And of course you need the objects form the view...

 

 

With

 

SELECT text

 

FROM all_views

 

WHERE view_name = 'DGDTW_VW_FUG'

 

 

Connect a SQL executor and enter the "text' as sql. It should run and get the geoobjects.

 

 

Write them out to shape using the schema you created..

 

 

(of course take care running sql you dont know...lol)

 

 
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

11 replies

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 28, 2015
HI,

 

You gave the answer yoursefl :) use the dynamic mode.

 

Tha way the writer will read the schema and apply it while running the worksoace.

 

 

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 28, 2015
MaterialisedView u can use a schemareader or a schemamapper.

 

 

 

If it is not a MV then  u can extract  the SQLquery of a certain view by

 

 

SELECT text

 

FROM all_views

 

WHERE view_name = 'DGDTW_VW_FUG'

 

 

(replace 'DGDTW_VW_FUG' with view you want to read of course)

 

 

1 Then parse the txt record using stringsearcher. For example regexp=" \\(select (.*) from .*"

 

2 Then Use attributesplitter to put result in a list; splitcharacter = ",".

 

 Explode list using listexploder.

 

3 etc. if and when nescessary 

 

   Stringsearcher or tester to filter out things like unions etc.

 

 

It depends on how complex the View is actualy.

 

If it is a simple select from then steps 1 and 2 will do.

 

If it is a very complex view, u need to finetune stringsearchering and regularexpressions.

 

 

 

 

  • Author
  • January 28, 2015
Hi ETLS-Itay,

 

 

I tried using dynamic mode but not able to create output.

 

 

Cheers

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 28, 2015
Mind you a shapefile has its limitations, for example not all atrribute names will map correctly if they are longer that 10 chars

  • Author
  • January 28, 2015
Yes I am aware of that even if I change output format from shape to MITAB it's failing.

 

Cheers

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 28, 2015
I read from your post that the views are created in ORA Spatial by another application.

 

I assume you are not tallking about materialised views.

 

So to get its schema, you can not use a schemareader, like you can with a materialised view or normal table.

 

The method above can read the schema.

 

 

 

 

Third column are the attributes.

 

 

Once you have the schema, you can use it to create a schemamap and then use this map to dynamicaly map it to the shape objects.

 

(if you're interested i can post the workbench i just made to create above table)

  • Author
  • January 29, 2015
Thanks Gio.

 

Yes view is created by other application depending on user selection on attributes. Now I am able to get the schema as suggested but still struggling to bind this schema with shape objects. Any pointers in this direction?

 

Cheers

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • Best Answer
  • January 29, 2015
If you have extracted the schema you then should be able to use dynamic writer, a shapefilewriter in dynamic mode.

 

 

On writer's general  tab you can choose Dynamic properties and point to the schema resource.

 

 

Of course you have to write the extracted shema to a file first.

 

And of course you need the objects form the view...

 

 

With

 

SELECT text

 

FROM all_views

 

WHERE view_name = 'DGDTW_VW_FUG'

 

 

Connect a SQL executor and enter the "text' as sql. It should run and get the geoobjects.

 

 

Write them out to shape using the schema you created..

 

 

(of course take care running sql you dont know...lol)

 

 

  • Author
  • January 30, 2015
Thanks Gio,

 

If I understand corrrectly, this means I need 2 workbenches first to create schema resource and second main workbench. Is this correct or am I missing something.

 

 

Cheers.

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • January 30, 2015
Yes,

 

Schema resource must be create first. (because view is unknown as well as its attributes)

 

 

You can have the one in wich you create the schema call the main trough a workspacecaller.

 

 

btw i tested these suggestions on some views here, and came across a view wich was larger then the maximum characters fo a text field...means it could not run the sql as it didnt fit. (most of the views fit though..)

 

You may want to keep an eye on this.

  • Author
  • January 30, 2015
Thanks Gio. I learned lot of things which I might have been difficult to learn by going through documentation.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings