How to replicate state tree from GDBTools?

2405
10
09-27-2016 06:04 AM
ChrisMathers1
Occasional Contributor II

 I got a new computer which means a completely fresh install of Desktop at 10.4.1 which means no more rolling GDBTools forward. I really liked being able to visualize the state tree and want to try to replicate it using python. I'm grabbing the state list using

use sde
select sde.sde_states.state_id, parent_state_id, lineage_name, name
from sde.SDE_states
left join sde.SDE_versions
on sde.sde_states.state_id
= sde.sde_versions.state_id
order by state_id;

but I'm having trouble sorting the states into their branches however. Anyone at esri have some advice?

0 Kudos
10 Replies
JoshuaBixby
MVP Esteemed Contributor

AlthoughRe: GDBT to ArcGIS 10.1? is old, there are some comments at the end from last year that speak to this topic.  I posted an SDE State Tree Example on JSFiddle, but something very similar could be done using one of the Python visualization libraries.  I went with JavaScript because I liked the interactive nature of it rather than outputting a static PNG or some other image.

ChrisMathers1
Occasional Contributor II

Wow this works great. What query are you using to get your state list? Mine is causing an error to throw in the JS from a duplicate value it doesn't like. I don't have PHP installed anywhere so I'm going to use python to execute the query, put the files in a CSV, and launch the webpage.

Edit: Actually its not my query thats a problem. For some reason the database is giving 7 replications the same State ID, Parent ID, and Lineage ID.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

My SQL is effectively the same as yours, just for Oracle instead of SQL Server and without the lineage name.  I haven't run into the situation you have, so I don't get the error you are seeing.  Are the state tree results you are seeing even valid?  I haven't worked in SDE for a while, will have to think about the situation you describe.

0 Kudos
ChrisMathers1
Occasional Contributor II

Yeah not sure whats going on with it but everything is working so I'm not very worried about it, just a little concerned. After a sync and compress 2 of the 6 now have new IDs but they are once again duplicate.

name    owner    version_id    status    state_id
SYNC_SEND_34522_45    SDE    3049    16777216    601500
SYNC_SEND_34559_45    SDE    3050    16777216    601500
SYNC_SEND_29256_471    SDE    3053    16777216    601500
SYNC_SEND_30056_475    SDE    3054    16777216    601500
SYNC_SEND_34512_107    SDE    3058    16777216    601529
SYNC_SEND_34516_105    SDE    3059    16777216    601529

0 Kudos
AndrewQuee
Occasional Contributor III

Have you tried the GDBT registry hack by asrujit_pb?

We have used this to put GDBT on clean ArcGIS installs from 10.1 to 10.3.1, no problems.  (Not tested on 10.4 yet)

RebeccaStrauch__GISP
MVP Emeritus

FYI, I used the hack on a 10.4.1 machine and it did work to get it installed.  Unfortunately, I don't have any updated SDE (SQL) databases yet to check it against, so I'm not sure if the tools themselves are working.  fwiw.

ChrisMathers1
Occasional Contributor II

It works but Im not keen on a registry hack if I dont need to.

0 Kudos
AndrewQuee
Occasional Contributor III

In my non-professional experience (A.Dip. Network Engineering, many years experience system building, desktop and GIS support), this is perfectly safe.  It is a simple change that is easily undone, and you can also backup the registry entry and restore it if it all goes pear-shaped.  In fact I recommend making a backup before editing anything to anyone considering fooling around with the registry.

That said, your IT group may take a very dim view of such activity, if not banning it outright - for good reasons usually.  It's the equivalent of fiddling around with your car's spark plug cables and fan belts - while the engine is running.

So I'd say that Derek Law has it right, and everyone interested in this tool should vote up the idea.  It's quite silly that in this day and age, we're relying on a 10.0 third-party extension and registry hacks to manage enterprise geodatabases!

0 Kudos
ChrisMathers1
Occasional Contributor II

Yesterday I implemented the JS tree version by bixb0012 posted earlier in this thread with python getting the state information. I barely used the other GDBT functions so this meets my needs. Its actually much faster when there are a lot of states as well.