My Blog List

Wednesday, August 31, 2011

SW Gas: Select by Model Name report

I created a generic report that is designed to extend the list of reports available on the ArcMap Report toolbar.  The button in ArcMap looks like this:

Note that the "M" in the icon stands for ModelName.  The idea of the report is that it looks at the maps selected set of features and generates a report based on a configuration XML (Telvent.SE.ReportTools.Config.XML).  Essentially it reports out each item in the selected set if that feature is in the configuration list.  if it is in the configuration list, then all of the fields that you specify are reported. Below is an example of the output based on the XML snippet shown below:


  <SelectionByModelNameReport>
    <ClassModelName name="ControllableFitting" primaryField="FacilityID" fields="fACILITYID,OBJECTID" />
    <ClassModelName name="Valve" primaryField="FacilityID" fields="ObjectID,FacilityID,InServiceDate,CreationUser,ValveType,ValveUse,ValveDiameter" />
    <ClassModelName name="Pipe" primaryField="OBJECTID" fields="ObjectID,PipeType,PipePressure,Shape_Length" />
    <ClassModelName name="Regulator" primaryField="FacilityID" fields="FacilityID,ObjectID" />
    <ClassModelName name="NonControllableFitting" primaryField="FacilityID" fields="FacilityID,ObjectID" />
    <ClassModelName name="ServicePoint" primaryField="FacilityID" fields="FacilityID,LocationID,Premise" />
  </SelectionByModelNameReport>



Unlike Brook's reports, this does not use an XSLT style sheet.  Instead it uses a template HTML file.  The file is named, SelectionByModelNameTemplate.htm, and must be located in the same directory as the reports .dll and the configuration file.  If you are familiar with HTML, it should be easy to modify this template file.  You will see two special placeholder locations within the HTML file. ***GENERATED_DATE***, and ***TABLE***.  These two areas are overwritten during the creation of the report.  
As you can see from the output, you can have one specific field which is shown with a brown background color which acts as the Primary field.  Typically this would be FacilityID or maybe ObjectID. The comma separated list of fields in the configuration XML then specifies which fields you want to see in the report. 
Like some of the other reports on the Reports toolbar, you can right-click and have the relevant feature blink in the map. 


Update - This report was just modified to add support for images.  The ShowImages attribute is now required.  If ShowImages is set to "True", then the other parameters shown in the working XML snippet below become mandatory as well. 



 <SelectionByModelNameReport>
    <ClassModelName name="ControllableFitting" primaryField="FacilityID" fields="FacilityID,ObjectID"  showImages="False" />
    <ClassModelName name="Valve" primaryField="FacilityID"  fields="FacilityID,ObjectID" showImages="True" imagePrompt="True" imageHeight="300" imageWidth="300" imageResolution="96" imageScale="500" imageTempPath="c:\temp\images" imageClearSelection="False"/>
    <ClassModelName name="Pipe" primaryField="ObjectID" fields="FacilityID,ObjectID,LastUser,NominalDiameter,PipeType" showImages="True" imagePrompt="True"
                    imageHeight="100" imageWidth="150" imageResolution="96" imageScale="1500" imageTempPath="c:\temp\images" imageClearSelection="True"/>
    <ClassModelName name="Regulator" primaryField="FacilityID" fields="FacilityID,ObjectID"  showImages="False" />
    <ClassModelName name="NonControllableFitting" primaryField="FacilityID" fields="FacilityID,ObjectID"  showImages="False" />
    <ClassModelName name="ServicePoint" primaryField="FacilityID" fields="FacilityID,ObjectID" showImages="False"  />
  </SelectionByModelNameReport>

Tuesday, August 30, 2011

Reminders

  1. Send Jason an invitation for the AAL demonstration for Middle Tennessee. 
  2. WebEx with Steve re Logica on August 31 8:30

JEA: AAL expression to show conductor size / conductor material

There's been more than one utility that was interested in showing related records that could be grouped.  The classic example being conductorInfo records being grouped by size and material.  JEA was asking about that today, and I worked up a screen-shot of a working expression that utilizes the new 10 syntax of allowing full on SQL expressions and also uses the conditional labeler.


SW Gas: What shape is a polygon anyway?

Well, I found out today that a polygon is NOT just an envelope.  I was trying to create a polygon from an envelope that I had, and that didn't work.  I guess this isn't too surprising.  You actually have to create a new Polygon class and populate it from the envelope.  I wrote some VBA code to test this.


Private Sub MakeIsoationPoly(env As IEnvelope, fc As IFeatureClass)
Dim app As IApplication
Set app = New AppRef
Dim edExt As IEditor
Set edExt = app.FindExtensionByName("ESRI OBJECT EDITOR")
edExt.StartOperation
Dim newFe As IFeature
Set newFe = fc.CreateFeature
Dim segCol As ISegmentCollection
Set segCol = New Polygon
Dim ln1 As ILine, ln2 As ILine, ln3 As ILine, ln4 As ILine
Set ln1 = New Line
Set ln2 = New Line
Set ln3 = New Line
Set ln4 = New Line
ln1.FromPoint = env.LowerLeft
ln1.ToPoint = env.LowerRight
ln2.FromPoint = env.LowerRight
ln2.ToPoint = env.UpperRight
ln3.FromPoint = env.UpperRight
ln3.ToPoint = env.UpperLeft
ln4.FromPoint = env.UpperLeft
ln4.ToPoint = env.LowerLeft
segCol.AddSegment ln1
segCol.AddSegment ln2
segCol.AddSegment ln3
segCol.AddSegment ln4

Set newFe.Shape = segCol
newFe.Store
edExt.StopOperation ("Make polygon")

End Sub

Monday, August 29, 2011

Isolation polygons for SW Gas benchmark

I worked with with Robert today to create the SW Gas Isolation polygon tool.  At the time of this writing, the tool is about 90% done, and Robert is adding the finishing touches. 

SUMMARY
The purpose of the tool is to create a new feature in a "IsolationPolygon" feature class based upon a selected set of features (as shown below). 
Ostensibly the selected set would be created by using the Gas Isolation Trace tool as shown above.  When you click on the ArcMap command, a new polygon is created based upon the geometry of the selected DistributionMain and ServicePipe features.  

ASSUMPTIONS
  • The user must be editing to use this tool
  • The user must have in his or her map at least three feature classes answering to the model names, DISTRIBUTIONMAIN, SERVICE, and ISOLATIONPOLYGON
OUTSTANDING ITEMS REMAINING (ROBERT M.)
  • Create a user interface so that the end user of the application can choose to have either a buffered polygon look (as shown above) or a rectangle representing the minimum bounding rectangle for the isolation polygon
    • The UI should include an ability to specify the buffer distance
  • Change the icon from the default bunny rabbit to something more appropriate. 
  • Modify the manner in which the selected set is retrieved to use Telvent.SE's methodology.  This will add in maintainability...
 Telvent.SE.Module.Elicitation.ObtainMapSelectionSet("modelName");



Friday, August 26, 2011

Telvent.SE.SpatialRelationshipAU


SUMMARY

Today Robert M. and I created a Special Autoupdater that is designed to migrate the attributes of a "spatially related" feature class to the feature being created or updated.  This was in support of the upcoming SW Gas benchmark. For example, lets say that I created a Drip Feature that intersects a Parcel feature and I want to migrate the value of the parcels "StreetName" field to the Drip's "StreetName" field.  This configurable autoupdater does just that. It works on points,lines, and polygon feature classes and should be able to handle migration between string and numeric data types.

The configuration file (Telvent.SE.SpatialRelationshipAU.XML) looks like this:

<Config>
  <MAP targetFeatureClass="Drip" spatialRel="Intersect" sourceFeatureClass="Parcel" sourceField="StreetName" targetField="StreetName" />
  <MAP targetFeatureClass="Drip" spatialRel="Within" sourceFeatureClass="StreetEdge" sourceField="Roads_ID" targetField="RoadID" />
  <MAP targetFeatureClass="StreetEdge" spatialRel="Cross" sourceFeatureClass="Parcel" sourceField="streetname" targetField="roads_id" />
</Config>

If you look at the last MAP in the config file (in blue), what is being said is that when the Autoupdater fires for a StreetEdge (on-create or on-update probably) look for the first parcel that it crosses and take it's streetname field and migrate it to the roads_id attribute of the street edge feature class.

Valid spatialRel values are (case sensitive): Intersect, Touch, Within, Contain, Cross, and Overlap.

Note that some behaviors may not be exactly what you expect...for example, a point that is snapped to a line does NOT touch the line...it is, however, within the line.

CONFIGURATION

To get this AU running, you'll need to RegEx the Telvent.SE.SpatialRelationshipAU.dll, edit the sample configuration file, and appropriately assign the AU to the feature class(es) that you want it to work on.  The name of the AU that you will see in ArcCatalog is: "Telvent.SE Inherit Spatial  Relationship Attributes".  It will appear only for Feature Classes - not object classes. 

ASSUMPTIONS

  • The target feature class name in the configuration file is the class to which the autoupdater is assigned.  This is the actual database name (not a model name)
  • The source feature class name is the feature class is to be searched.  IT MUST EXIST IN YOUR MAP.
  • The target fields and the source fields are numeric or string data types.  The two do not have to match, however if you are mapping a string field to a numeric field, the AU would of course only work if you had a string like "31".  A value like "Pine" can't be coerced into a number. 
  • The value from the first spatially related feature found are used.  If no related feature is found, then nothing should occur (the feature is created, and the value for the target field will be null). 
KNOWN ISSUES
  • We did run across some errors during testing when .Store() was called, but it seems very likely that this was an error raised by some external component.  The errors are caught by the AU and it seems to work.  At this point, it is just something to keep an eye on. 

Thursday, August 25, 2011

Tasks and completed assignments (TODO list)

COMPLETED

  1. Deliver power-point to Lane for Glendale detailing DMS functionality within AAL
  2. Find and deliver the Staking Cost Estimate report that Brooks wrote. 
  3. Get with Jessica to figure out how the SAM report needs to be queried for comments. Group by month or something. 
  4. SW Gas - Bug...get right-click context tool  (show on map) working for linear features
  5. SW Gas - Add support for images in Mail Merge document
  6. SW Gas - Created SW Gas QA rule to verify the necessity of an Excess Flow Valve. COMPLETED 9-22
  7. SW Gas - Make Model Name report roll up (collapsible regions in HTML)
  8. Glendale - Prepared and gave AAL demonstration.  Follow-up with power-point slides detailing DMS labeler. COMPLETE 9-22
  9. SW gas - Pipe system report isn't outputing Material, and the columns are therefore not getting put into the proper position...meaning that there should be four fields output, but only three are showing and in the wrong table column. Fixed
  10. SW Gas - Created Stored Trace tool. COMPLETE 9-21
  11. Middle Tennessee - Prepare and give AAL demonstration.  
  12. Glendale - Get AMI tools working - COMPLETED 9-12-11.  Note that the code for this is the Telvent.SE.AMIIntegrationAdvanced
  13. SW Gas - Modify Model Name report so that coded value descriptions from domains are used and not database values. COMPLETED 9-10-11
  14. SW Gas - Modify Customer report so that all customers and not just the first one for each service point are reportedComplete 9/10/11 - The issue was in the CMDGasCustomerReport.cs class.  I introduced code to loop through all of the CasCustomer Objects for each service point.  Look for //DKT 9-10-11 in code. Link here
  15. SW Gas - Modify model name report so that you can see images of the features in the reports. See post here.
  16. Create an Isolatable Polygon Map tool - The idea here is that we run a Gas Valve Isoation Trace and then based on the results, we turn that into a polygon which is used as the shape of a new named "IsolationPolygon" feature. The tool should allow for polygons to be created using both a buffer and a rectangular area. UPDATE - Nearing completion...see: http://devontaigtelvent.blogspot.com/2011/08/isolation-polygons-for-sw-gas-benchmark.html
  17. Create a new report which could integrate with the MMReports tool bar which provides a summary of connected objects.  The idea would be to inspect the selected set of objects, and then look for, by model name, "ControllableFitting", "Valve", "Pipe", "Regulator", "NonControllableFitting", and "ServicePoint".  The report should be in an HTML format and offer right-click functionality to zoom to individual features which are listed by FacilityID.  The report should be grouped by model name. Completed - Please see http://devontaigtelvent.blogspot.com/2011/08/sw-gas-select-by-model-name-report.html
  18. Modify Brook's Division Inheritance code so that lines, points, and polygons all work.  Currently it just works on points apparently.: Completed 8/26/11- I worked with Robert on this, and we actually decided to build an AU from scratch.  Please see the post on Telvent.SE.SpatialRelationshipAU
  19. Fix the MM Report Tools Mail Merge tool.  It doesn't bring up a word document: Completed 8/25/11- This simply worked on my machine.  Will try to deploy the latest .dll to Sean / Ryan / Neil. 
  20. Modfiy the MM Report Tools Gas Customer Report so that it inclues the total customers count:  Completed 8/25/11 - The number of customers (found by traversing the MeterSetting>ServiceAddress>CustomerInfo relationship is now passed as a parameter to the style sheet (search this blog for XSLT arguments for more detail). 

Tuesday, August 23, 2011

Oracle SQL Developer

Oracle SQL Developer is an alternative to the new web based interface for being able to explore a database. I think we used to call this "Management Studio" or something.   It has a pretty nice interface for being able to issue SQL statements, view tables and views, and create tables and the like. The standard web based interface (which I think is new with 11G) seems to not work if the IP address changes. Jen Baxter has more information on this.

Updating ArcSDE license

Ran across an interesting problem today when trying to view an Oracle database in ArcCatalog.  The error was something along the lines of ArcSDE not started on the server...Attempting to start the service revealed that the license was expired or not set for version 10. In order to update an ArcSDE license, you have to actually update an Oracle table (sde.server_config) and provide the new key.  This is the example that Jen Baxter sent me.


update sde.server_config set char_prop_value =

'arcsdeserver,100,ecp895569880,30-jun-

2012,ZZYTYXLPECJPA4S8A214' where

PROP_NAME='AUTH_KEY';

Don't forget to commit the transaction in Oracle.  You then need to (1) Restart Oracle and (2) Restart the ArcSDE service. That should allow you to then browse the database in ArcCatalog.

Monday, August 22, 2011

Scoring system for resume evaluation


Here's my 30 point scoring system to evaluate a resume.  Each category is worth various points (30 points possible).  Todd gets a 10.

- ArcGIS  (+1)
- ArcObject (+3)
- .NET (+5)
- General Programming (+3)
- SQL Server / Oracle (+2)
- ArcGIS Server (+4)
- Utility Experience (+2)
- Quality Education (+3)
- Work Experience (+3)
- General Web Experience (+3)
- Quality of Resume (+1)

Sales Engineering developer samples to Kim for ArcFM Resource Center documentation

I just made contact with Kim Despins about getting some of the Sales and Engineering developer samples included in the ArcFM Resource Center's Developer samples / documentation.  The zip / rar files are located at:

\\tntserver\users\SeanG

What I need to do for her is get the source code, and she'll try to compile and get running on ArcGIS 10. 

Update - Sent Kim a link to source code (under SeanG folder) for four of the requested samples. 

Thursday, August 4, 2011

Collapsible regions in HTML (from an XSLT transform)

There was an error in the manner in which Brooks code was creating collapsible regions within HTML.  This may apply to more than one project, but manifested for sure in the Telvent.SE.FiberCustomerReport.  The cause of the error was in the Javascript code which essentially hid ALL of the rows.  You don't want to do that, because if you do, then you won't be able to click on a row to get the region to reappear.  I have a nice working example here.   

Passing arguments to XSLT

I didn't know that you could pass arguments to XSL, but this article has a really good example: http://projects.ischool.washington.edu/tabrooks/545/ContentManagement/PassingParameters.htm  .  This could be useful to us, because often during a transformation we have to inject stuff into the XML (like today's date) in order for it to contain the data that we want.  In reality, that's not very clean since in a real environment, the XML might be furnished by a third party.  Better to pass such arguments to the stylesheet.

UPDATE - I put this to use in the Gas Customer Report.  The XSL stylesheet now accepts a parameter for the number of customers.  This was probably do-able in some other way (e.g. counting the Customer nodes), but it works and it is actually pretty easy. See the Telvent.SE.ReportTools.GasCustomerReport for details.

Tuesday, August 2, 2011

NTest and Fiber Customer Report


I've been looking into a problem that Neil reported yesterday about the NTest window in ArcMap not getting populated with the alarms that were being generated by the simulator executable. I found the code on Brook's old machine and now have it sort of working on my machine.  The solution includes two projects - Telvent.SE.ArcMapNTest and Telvent.SE.SimulateNTestRTU.  The simulator simply writes alarms events to a configurable database table when a button is clicked.  It doesn't seem like there is any problem there at all.  In the Telvent.SE.ArcMapNTest project, there are two command - CMDOpenManager (which launches a dockable window that is to contain the events sent to the database table from the simulator) and also CMDFiberCustomerReport.  On my machine when you click on the CMDOpenManager, it correctly docks and populates - on Neil's machine, it does not populate. Neil thinks this may be because he has another version of Telvent.SE.FiberTools.dll (which is apparently the location of an older / alternate version of the Customer Report).  The newer version of the report, which apparently has an XSL that allows for collapsible regions, is in the Telvent.SE.ArcMapNTest assembly.  The two customer reports can be distinguished by their bitmaps.  The old one is red and the new one is blue.
New bitmap for Customer Trace (called also from Right-click context of Alarms dockable window).

UPDATE - In Telvent.SE.ArcMapNTest the right-click context menu for launching to Customer report is actually using different code than what the button (command) does despite the fact that they are in the same project.  So in essence there are three copies of this Customer report - the first red one the Telvent.SE.FiberTools assembly, and the other two in the ArcMapNTest assembly.