Tuesday, 30 June 2015

MapGuide / AIMS - performance, file access

We run AIMS on virtualized W2008R2 machines with 6 GB RAM. Most data displayed as maps comes directly from Oracle Spatial. Only for one job enabled Map industry model  we decided to export 40+ feature classes and views to an SDF file. File size is roughly 200MB.

In order to speed things up I created a RAM Disk on the server and did some performance tests:
- hard disk access (read/write) was already much better then on my physical machine
- depending on RAM disk driver and test performed read access was faster by up to factor 6 compared to hard disk access

Surprisingly moving the SDF file to the RAM disk did not help improving performance in AIMS/MapGuide. 

Conclusion seems to be that W2008R2 has already cached the SDF file and no further improvement is possible here. As the SDF file is used in all web mapping projects and layers based on file are visible by default I assume that the file will be cached all the time. 


Here are a few screenshots related to the testing:

- hard disk performance, local machine:



- hard disk performance, virtualized 2008r2 server




- ram disk performance, local machine (imdisk)




- ram disk performance, w 2008r2 (softperfect)





- AIMS/MapGuide performance test with sdf based map - sdf file on disk on virtualized w2008r2 server




- AIMS/MapGuide performance test with sdf based map - sdf file on ram disk on virtualized w2008r2 server



AIMS 2013

Wednesday, 24 June 2015

Feature with wrong geometry type for feature class

We had one feature (Industry Model) which was not displayed in Map. 1 Click Maintenance reported an unsupported geometry type for a polygon feature class. A closer look unveiled that the feature had been migrated as line feature and not as polygon feature:
  
Line string feature in a polygon feature class (Map Industry Model)

The geometry itself was correct - so it could not be "repaired" in Oracle Spatial. Here is one way to solve the issue:


1. connect via FDO Oracle and add feature class to Map 
   FDO Oracle will create a layer containing lines and polygons - the feature in question will therefore be displayed in Map.


Adding table via FDO Oracle - line and polygon features are displayed

2. save layer as sdf, add sdf to Map and remove layer based on FDO Oracle from Display Manager
3. rectify geometry in SDF based layer - for instance via "extract geometry" 
4. open form for Industry model feature where geometry type is incorrect
5. link rectified geometry with feature - confirm "Feature has already a geometry - replace?" 

Map 2013, SP2

Wednesday, 17 June 2015

ora-01950 no privileges on tablespace "string"

I was looking into a slow running query and wanted to re-create a spatial index.
In AIA I received the following error message:

ORA-29532: Java-Aufruf durch nicht abgefangene Java-Exception beendet: topobase.sql.TopobaseSqlException: ORA-01950: keine Berechtigungen für Tablespace 'TB_DATA'

(ora-01950 no privileges on tablespace "string")

When I tried to re-create the spatial index in SQL developer a smilar error message appeared. I compared the settings (roles, system privileges) of the user with other industry model users and for an unknown reason the "unlimited tablespace" privilege was missing.

Friday, 12 June 2015

error message "item has already been added" when opening form

I just received an error message as I opened a form for a newly created view:

Das Element wurde bereits hinzugefügt. Schlüssel im Wörterbuch: "191168". Hinzuzufügender Schlüssel: "191168"

and Bing translation:

The item has already been added. Key in dictionary: "191168". Key being added: "191168"

and Google translation:

The item has been added . Key in dictionary: " 191168 " . Be added is key : " 191168 "

Bit of fun on a friday afternoon....


Ok, the number mentioned in the error message text is an FID and unfortuantely the FIDs are not unique in my view. This causes the error message and as a result no useful information is displayed in my form:


FID needs to be unique....


In Map IM FID needs to be unique.


Map 2013, SP2


Tuesday, 2 June 2015

call ERMS d3 from form

To call d.3 - an electronic document management system - one can use the following code to lookup certain linked documents:


 Public Overrides Sub Button_Click()  
 '  
 ' ERMS d.3 parameter needs to be base64 encoded  
 '  
 ' ERMS d.3 - link to program and serach-field name  
  Dim ermsAufrufFix As String = "d3://searchdxplorer&doc_field_1="  
 '  
 ' ERMS d.3 get object id for current feature  
 '  
  Dim _name_number_value As String = Me.Dialog.Controls.Item("NAME_NUMBER").value   
 '  
 ' searching for specific entries only ("Dossier") - parameter and value  
 '  
  Dim tempSuchParameter As String = "3T.06.02.98.06-" + _name_number_value  
 ' base64 encoding  
 Dim ermsSuchobjektID As String  
 Dim data As Byte()  
 data = System.Text.Encoding.UTF8.GetBytes(tempSuchParameter )  
 ermsSuchobjektID = System.Convert.ToBase64String(data)  
 ' combine all parameters  
 Dim ERMSAufruf = ermsAufrufFix + ermsSuchobjektID   
 ' start/call ERMS d.3     
 Dim pro As New System.Diagnostics.Process  
 pro.Start(ERMSAufruf )  
 End Sub  

Friday, 22 May 2015

Form - VB.net get next available value for column

To get the nex available value for a column - example:

 Public Overrides Sub Button_Click()  
   dim nummerfeld as Autodesk.Map.IM.Forms.DialogControls.TextBox  
   nummerfeld = Me.Dialog.Controls.Item("NUMMER")   
   dim maxNummer as Long = Me.Document.ConnectionTools.LngValue("select max(NUMMER)+1 from wse_br_wohnen")  
   nummerfeld.Value = maxNummer   
 End Sub  

Tuesday, 19 May 2015

Execute stored procedure from form

I was asked to figure out how to execute a stored procedure from a form. Here is a working sample (VB.net):


 Public Overrides Sub Button_Click()  
   
      ' prepare SQL execution  
      Dim MyCommand As Autodesk.Map.IM.Data.Provider.Command = New Autodesk.Map.IM.Data.Provider.Command("", Me.Document.Connection)  
   
      ' define input/output parameters for stored procedure  
      Dim ParameterOut as Autodesk.Map.IM.Data.Provider.DataParameter  
      Dim ParameterIn1 as Autodesk.Map.IM.Data.Provider.DataParameter  
      Dim Parameterin2 as Autodesk.Map.IM.Data.Provider.DataParameter  
      Dim returnValue as String  
   
      ' set up SQL command - type StoredProcedure  
      MyCommand.CommandType = System.Data.CommandType.StoredProcedure  
      ' PackageName.ProcedureName  
      MyCommand.CommandText = "emp_eval.eval_department"  
   
      ' assign values to input parameters  
      ParameterIn1 = MyCommand.CreateParameter()    
      ParameterIn1 .DbType = System.Data.DbType.Int32  
      ParameterIn1 .ParameterName = "DEPARTMENT_ID"  
      ParameterIn1 .Value = 100  
      ParameterIn1 .Direction = System.Data.ParameterDirection.Input  
      ParameterIn2= MyCommand.CreateParameter()    
      ParameterIn2.DbType = System.Data.DbType.Int32  
      ParameterIn2.ParameterName = "DUMMY_ID"  
      ParameterIn2.Value = 101  
      ParameterIn2.Direction = System.Data.ParameterDirection.Input  
        
      ' set up output parameter - return value   
      ParameterOut= MyCommand.CreateParameter()    
      ParameterOut.DbType = System.Data.DbType.String  
      ParameterOut.ParameterName = "TEXT"  
      'Direction needs to be Output and not ReturnValue   
      ParameterOut.Direction = System.Data.ParameterDirection.Output   
   
      ' add parameters to sql command, keep order of parameters in mind  
      MyCommand.Parameters.Add(ParameterIn1 )   
      MyCommand.Parameters.Add(ParameterIn2 )  
      MyCommand.Parameters.Add(ParameterOut )  
        
      ' execute SQL   
      MyCommand.ExecuteNonQuery()  
         
      ' get output/return value  
       returnValue = MyCommand.Parameters.Item("TEXT").Value  
       MyCommand.Dispose()  
       MsgBox("ok --> " & returnValue)  
         
      'refresh dialog   
      me.Dialog.Requery()  
  End Sub  

In Oracle the procedure is defined as:

PROCEDURE eval_department(department_id IN NUMBER , dummy_id IN NUMBER, text OUT VARCHAR2) ;

I found a presentation from the 2007 Oracle Spatial user Conference with some sample code but I needed to adapt it a bit:

http://download.oracle.com/otndocs/products/spatial/pdf/osuc2007_presentations/gita07200a_lvvwd.pdf

Map 2013