Question about spatial views in ArcGIS 10.1

2267
3
02-12-2014 01:26 PM
Highlighted
New Contributor II
Hello,

We have an enterprise geodatabase in SQL server which was created in ArcGIS 10.0. From the time we created this, we have created spatial views in this database using the sdetable -o create_view command combining fields from more than one table in the same database.

In the last year, we have upgraded our Client applications and our ArcGIS server to version 10.1.  We have not upgraded the geodatabase at this point and still use the sdetable -o create_view command to create spatial views. 

I'm struggling to understand at this point the correct method for creating spatial views at 10.1.  I have tried using the new view option when you right click a database connection and specify a query; When I do this, it creates a query table instead of a spatial view despite specifying the ObjectID and shape field in the view query.  ArcMap can't seem to determine the ObjectID field when I try to add it to the map either, so I get a dialog box asking to select a unique identifier field every time I add it to the map.

What is the correct way to create a spatial view at 10.1? Should I just continue to use the sde command on my database server to do this?
Reply
0 Kudos
3 Replies
Highlighted
MVP Regular Contributor
If you're using a 10.1 desktop client, you have the option to use the Create Database View GP tool as described here.  That being said, to generate spatial views with this tool you would need to be using ST_Geometry or Geometry rather than a binary storage data type.  So, if you're using SDEBINARY for example, this tool probably won't help you create spatial views. 

I've always had good luck with the SDE command-line tools.  Although more complex commands can be tedious to write at times, the tools (at least the SDETABLE command tool) works with most if not all spatial data types.  There are times where I'll create the query using SDE commands and then further edit the view's SQL using RDBMS tools (e.g., SQL Studio Management Studio) afterwards.  I believe the SDE command-line tools are going away once the next release of ArcGIS comes out (whatever comes out after the 10.2.1 release). 

The method you described for creating a query layer isn't the same as a what we'd traditionally call a "spatial view", which are persistent views that live inside the database and contain a spatial column.  In my experience, query layers are temporary views (which can be spatial or non-spatial) and reside only within a map document or model. 

So in summary, you can use the Create Database View GP tool if you are using the right spatial data types.  Otherwise, use the SDE command-line tools as you are currently doing.
Reply
0 Kudos
Highlighted
Regular Contributor III
James,

One of the other main difference between the two views created using the Desktop interface and using SDE Command line tools, is that -- "Views created in enterprise geodatabases using the 'Create Database View' tool are not registered with the geodatabase."

If you don't want to select an unique identifier field every time while adding that view to ArcMap, try the below workflow:

Launch ArcMap-->go to File-->Add data-->Add Query layer-->connect to the geodatabase-->select the database view table-->Run the query select * from (table_name) -->validate-->check show advanced options box-->next-->the unique identifer's should already be identified-->ok.

You can continue using the sde command line to create the view for now, however as William mentioned, the command lines will be deprecated in the next MAJOR release.

Regards,
Reply
0 Kudos
Highlighted
MVP Regular Contributor
I'm struggling to understand at this point the correct method for creating spatial views at 10.1.  I have tried using the new view option when you right click a database connection and specify a query; When I do this, it creates a query table instead of a spatial view despite specifying the ObjectID and shape field in the view query.  ArcMap can't seem to determine the ObjectID field when I try to add it to the map either, so I get a dialog box asking to select a unique identifier field every time I add it to the map.

What is the correct way to create a spatial view at 10.1? Should I just continue to use the sde command on my database server to do this?


I really recommend you to read the entire thread I link below and try to digest what I have been writing there, as, although it has a different titel related to metadata too, it actually deals with the same issues and the misunderstandings about ordinary RDBMS database views (as the spatial view you created through the Create Database View tool or the New / View menu option), and ArcSDE  registered views created by the ArcSDE Command Line tools. These are not the same! Read this:

Database Views and Metadata

Marco
Reply
0 Kudos