Posts

Showing posts from June, 2015

Jupiter & Venus Conjuction 2015

Image
Look what Leo is chasing; Jupiter and Venus. Look up and towards the West to find two of the brightest objects in our night skies crossing paths.

Add Field to a SQL Geodatabase using T-SQL

Image
Sometimes a new field will need to be added quickly. The usual process of testing changes and pushing said changes to production is not very time sensitive. Here is a method I use when a new field is needed ASAP. In this case the feature classes have been registered in the geodatabase and archiving has been enabled. This means there is an SDE base table and several SDE delta tables. The information needed to proceed is listed below. This will require DBO level access and SQL Server Management Studio or other suitable RDBMS interface like Toad. Database Name = DemoData New Field Name = NewField New Field Type (Length) = string(50) / nvarchar(50) SDE Field Type Code =   Unknown New Field Name = NewField Feature Class Name = Marker Base Table Name = Marker Base Table ID = Unknown Delta Table (Adds) = Unknown Delta Table (Archive) = Unknown First thing to do is find the unknown values. The SDE Field Type Code via Esri tells us that the SDE Field Type Code for String i

Using MS Date Styles for Python

I began scripting with Python to automate nightly routines. After time many of my scripts would include similar variables such as date/time formatting.  For log files I usually apply this format: Sample output: RoutineLog_20150622.log Date Format: yyyymmdd For an email body I usually apply this format: Sample: "The routine succeeded June 22, 2015 02:10PM." Date Format: Mon dd yyyy hh:mm AM/PM Although I tend to apply similar formatting, I noticed different naming conventions as more and more scripts were written. Python Script A would call it datetime while script B called it ShortDate. dateTime1 = time.strftime("%Y%m%d") #yyyymmdd dateTime2 = time.strftime ("%b %d %Y %I:%M%p") I like standards and remembered that Microsoft (MS) has datetime style codes. This is what I now reference when setting date time formatting variables. https://msdn.microsoft.com/en-us/library/ms187928.aspx Although, MS does not account for each and every styl