Thursday 27 March 2014

Notepad++ syntax highlight for Map-layerfiles

I only use Notepad++ for viewing and editing Map layer files. To get XML syntax highlight automatically when opening the file you need to set it up:

1. Settings > Style Configurator - pick "XML" in the language list (left)
2. add file extension (layer) in "User ext.:" text box



Notepad++ Syntaxhighlight bei Layerdateien

Ich setze Notepad++ ein um die Layerdateien zu bearbeiten. Um den XML Syntaxdarstellung automatisch beim Öffnen der Datei angezeigt zu bekommen muss man bei "Einstellungen > Stile" als Sprache "XML" auswählen und bei den "Benutzer-Erw." die entsprechende Dateiendung eintragen:



Wednesday 26 March 2014

DWG export - lineweight missing

When exporting to CAD drawing (maptoacad, editable, with template) some polylines got the default lineweight of "0" although the Map display model assigns certain lineweights to them. In Map these lines displayed correctly. For the polylines affected the lineweight was set using an expression:

<Override>
 <SymbolName>LTYP20</SymbolName>
 <ParameterIdentifier>LINEWEIGHT</ParameterIdentifier>
 <ParameterValue>0.35 * 500</ParameterValue>
</Override>


To get the lineweight exported correctly one has to put the expression in brackets:

<Override>
 <SymbolName>LTYP20</SymbolName>
 <ParameterIdentifier>LINEWEIGHT</ParameterIdentifier>
 <ParameterValue>(0.35 * 500)</ParameterValue>
</Override>


Map 2103, Sp2

DWG Export - Linienstärke fehlt

In der exportierten DWG (_maptoacad, Bearbeitbar, mit Vorlage) hatten einige Linien die Linienstärke "0", obwohl im Darstellungsmodell ein anderer Wert eingestellt ist. In Map wird die Linienstärke auch korrekt dargestellt. Bei den betroffenen Linien war im Map-Layer die Linienstärke über einen Ausdruck festgelegt:

<Override>
 <SymbolName>LTYP20</SymbolName>
 <ParameterIdentifier>LINEWEIGHT</ParameterIdentifier>
 <ParameterValue>0.35 * 500</ParameterValue>
</Override>


Für den DWG Export lag die Lösung darin, den Ausdruck in Klammern zu setzen:

<Override>
 <SymbolName>LTYP20</SymbolName>
 <ParameterIdentifier>LINEWEIGHT</ParameterIdentifier>
 <ParameterValue>(0.35 * 500)</ParameterValue>
</Override>


Map 2103, Sp2

Friday 21 March 2014

DWG-Export - hatch pattern missing

We used some hatch patterns in our display model which we loaded via StyleEditor from external files (xml, pat). We also made sure that corresponding AutoCAD hatches with the same name were available when conducting DWG export - but theses were always missing in the drawing file.

It turned out that the following tag in the layer is responsible:

<ExtendedData1>
 <FileName>S:\GIS\...\Vorlagen\HTypWAV_Wald2.xml</FileName>
</ExtendedData1>


It automatically gets created when you load a hatch from an external file. After removing the tag DWG export worked as expected. Same happens by the way with lines styles.


Map 2103, SP2

DWG Export - eigene Schraffuren fehlen

Im Darstellungsmodell wurden einige Schraffuren aus externen Dateien verwendet. Für den DWGExport standen die entsprechenden Schraffuren als AutoCAD Schraffuren zur Verfügung - trotzdem wurde keine dieser Schraffur in der DWG erzeugt.

Ursache ist der folgende Verweis in der Layerdatei - dieser entsteht, wenn das Schraffurmuster aus einer externen Datei geladen wird:

<ExtendedData1>
 <FileName>S:\GIS\...\Vorlagen\HTypWAV_Wald2.xml</FileName>
</ExtendedData1>


Entfernt man den Eintrag funktioniert der Schraffurexport auch mit eigenen Schraffurmustern.
Ähnliches gilt auch für Linientypen.


Map 2013, SP2

Wednesday 19 March 2014

Display models - TB2 / Map / DWG-Export - progress report

We have invested quite some time in creating proper display models. We need to provide data to internal and external customers. With TB2 you can just save a drawing - with Map it gets more complicated...

Here is one example - "Leitungskataster Wasser". All styles are laid down in engineering standards which apply to the whole of Switzerland (similar standards exist in other countries as well).



data representation in TB2, Map, and Map-DWG Export

The screenshot shows:
- current representation of data in TB2 (plain CAD drawing we would pass on to customers)
- representation in Map (based on our new display model - FDO based)
- DWG as result of DWG-Export in Map and some additional tweaking

In Tb2 some features are drawn as CAD - multilines - something Map-DWG Export does not support. We have written a small tool which converts the exported polylines into multilines and applies the correct multilinestyle and scale as well.

Map 2013, SP2


Darstellungsmodelle - TB2 / Map / DWG-Export - Zwischenstand

Viel Zeit haben wir bisher in die Erstellung der Darstellungsmodelle investiert. Hier ein Bericht zum Zwischenstand - Beispiel Leitungskatasterplan Wasser, 1:250:

LK Wasser - TB2, Map, Map-DWG-Export
Im Screenshot sind zu sehen:
- die aktuelle Darstellung aus TB2 (links)
- die Darstellung in Map (Mitte)
- das Ergebnis des DWG Exportes mit Map (rechts - plus Nachbearbeitung)

Zum DWG Export - um wieder eine Multiliniendarstellung zu erhalten wie in TB2 wird die per _maptoacad (Optionen "Bearbeitbar", "mit Vorlage") - erstellte DWG nachberarbeitet. Dazu haben wir ein kleines Werkzeug geschrieben, dass aus den relevanten P-Linien wieder M-Linien erstellt, den richtigen Stil zuweist und skaliert. Alle dafür notwendigen Informationen sind bereits im Darstellungsmodell enthalten.

Map 2013, SP2

Monday 17 March 2014

thematic rules, expressions and null values

The issue I described earlier today involves a bit more than I  thought initially. Here are results for some further tests I did - all related to thematic rules and how <null> values in treated in Map expressions. All tests were done using just one thematic rule which was applied to column "CREATION_CODE_XY_1":

value                    count
<null>                    1222
2                            1
8                         5016   



Test 1 rule: "NOT CREATION_CODE_XY_1 IN (8)"

result in Map:
features with <null> value in column are displayed but cannot be snapped to
(features with CREATION_CODE_XY_1 = 2 are displayed as well but you can snap to them).

result in Oracle:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 not in (8);


COUNT(*)
--------
       1


conclusion:
- results in Map and Oracle are different
- object snap doesn't work on  features with <null> values

If you add a second rule without any expression, set the symbol color to "none" and move the rule to the bottom then snapping does work (but additionally the "hidden" symbol from the second rule is snapped to as well).

    
Test 2 - rule: "CREATION_CODE_XY_1 <> 8"

result in Map:
features with <null> value are not displayed
(features with CREATION_CODE_XY_1 = 2 are displayed  and symbols can be snapped).

result in Oracle:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 <> 8;


COUNT(*)
--------
       1

conclusion:
- results in Map and Oracle are the same
- expression from Test 1 is not that different from expression in Test 2 but the results in Map are quit  different


Test 3a - rule: CREATION_CODE_XY_1  NULL   OR   NOT  CREATION_CODE_XY_1  IN ( 8 )

results in Map:
features with  <null>  values are displayed and can be snapped

results in Oracle:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 is null or creation_code_xy_1 not in (8);


COUNT(*)
--------
    1223

conclusion:
- results in Map and Oracle are the same
 
Test 3b - rule : NOT  CREATION_CODE_XY_1  IN ( 8 ) OR  CREATION_CODE_XY_1  NULL

results in Map:
features with <null> value are displayed, features can be snapped

results in Oracle:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 not in (8) or creation_code_xy_1 is null;


COUNT(*)
--------
    1223

conclusion:
- results in Map and Oracle are the same

Test 4a - rule: CREATION_CODE_XY_1   NULL   OR   CREATION_CODE_XY_1   <> 8

results in Map:
features with <null> value are displayed, features can be snapped

results in Oracle:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 is null or creation_code_xy_1 <> 8;


COUNT(*)
--------
    1223

conclusion:
- results in Map and Oracle are the same
 
Test 4b - rule: CREATION_CODE_XY_1  <>8  OR  CREATION_CODE_XY_1  NULL
 

results in Map:
features with <null> value are not displayed

results in Oracle:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 <> 8 or creation_code_xy_1 is null;
COUNT(*)
--------
    1223

conclusion:
- results in Map and Oracle are different, order of expression changes result in Map but does not change it in Oracle (in Test 3b change of order didn't change result either in Map or Oracle)

summary:
- special attention is required when working with <null> values, the person who creates display models is not necessarily a database expert and doesn't know about <null> peculiarities
- always consider <null> values and use special operators such as "is null" "is not null"
- verify your rules with a test data set
- order of expressions might change result in Map
- Map and Oracle deliver different results where you would expect the same outcome

Finally another example in this context: the following rules were applied and the last rule was meant to deal with an "empty" column (but which actually contains <null> values):

ID_SYMBOLART  =  15  AND  ID_FARBE  =  1
….
to_char(ID_SYMBOLART)  = '' AND ID_FARBE  =  1


It was not possible to snap to the symbols on this layer.

The last rule needs to be rectified to:
NOT ID_SYMBOLART NULL AND ID_FARBE = 1

Map 2013, SP2

Punktfang und NULL Werte - Teil 2

Das Problem von heute morgen ist doch etwas anders gelagert als es auf den ersten Blick scheint. Hier eine Übersicht über unterschiedliche thematischen Regeln bzw. "Ausdrücke" und deren Ergebnis in Map und Oracle.

Ausgangsbedingungen:

- es gibt nur eine Regel im Layer
- Tabelle mit 6239 Datensätzen,
CREATION_CODE_XY_1    Anzahl
<null>                1222
2                        1
8                     5016   



Test 1 Regel: "NOT CREATION_CODE_XY_1 IN (8)"

Map-Ergebnis:
Objekte mit <null> werden dargestellt, aber Punktfang auf diese funktioniert nicht.
(Objekte mit z.B. CREATION_CODE_XY_1 = 2 werden dargestellt und Punktfang funktioniert).

SQL-Ergebnis:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 not in (8);
COUNT(*)
--------
       1

Anmerkung:
- Map und Oracle liefern unterschiedliche Ergebnisse.
- merkwürdiger Nebeneffekt in Map - der Punktfang funktioniert nicht.

Was ist an dieser Stelle der Fehler? Das Map ein anderes Ergebnis liefert oder der fehlende Punktfang?

Fügt man jetzt eine thematische Regel ohne Ausdruck ("Standard") hinzu, setzt die Farbe des Symbols auf "keine"  und verschiebt die Regeln nach unten dann funktioniert auch der Objektfang (zusätzlich wird aber auch auf das "unsichtbare" Symbol gesnappt).
      
      
Test 2 - Regel: "CREATION_CODE_XY_1 <> 8"


Ergebnis:
Objekte mit <null> Wert werden nicht dargestellt.
(Objekte mit z.B. NOT CREATION_CODE_XY_1 = 2 werden dargestellt und Punktfang funktioniert).

SQL-Ergebnis:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 <> 8;
COUNT(*)
--------
       1

Anmerkung:
- Map und Oracle liefern das gleiche Ergebnis
- der Unterschied im Ausdruck zwischen Test 1 und 2 ist minimal führt in Map aber zu einem ganz anderen Ergebnis


Test 3a - Regel: CREATION_CODE_XY_1  NULL   OR   NOT  CREATION_CODE_XY_1  IN ( 8 )

Ergebnis:
Objekte mit <null> werden dargestellt, Punktfang funktioniert.

SQL-Ergebnis:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 is null or creation_code_xy_1 not in (8);
COUNT(*)
--------
    1223

Anmerkung:
- Map und Oracle liefern gleiches Ergebnis
   
Test 3b - Regel : NOT  CREATION_CODE_XY_1  IN ( 8 ) OR  CREATION_CODE_XY_1  NULL

Ergebnis:
Objekte mit <null> werden dargestellt, Punktfang funktioniert.

SQL-Ergebnis:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 not in (8) or creation_code_xy_1 is null;
COUNT(*)
--------
    1223


Anmerkung:
- Map und Oracle liefern gleiches Ergebnis

 
Test 4a - Regel: CREATION_CODE_XY_1   NULL   OR   CREATION_CODE_XY_1   <> 8
 

Ergebnis:
Objekte mit <null> werden dargestellt, Punktfang funktioniert.

SQL Ergebnis:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 is null or creation_code_xy_1 <> 8;
COUNT(*)
--------
    1223

Anmerkung:
- Map und Oracle liefern gleiches Ergebnis   
   
Test 4b - Regel: CREATION_CODE_XY_1  <>8  OR  CREATION_CODE_XY_1  NULL 

Ergebnis:
Objekte mit <null> werden nicht dargestellt

SQL Ergebnis:
select count(*) from wdp_dp_punktelement where creation_code_xy_1 <> 8 or creation_code_xy_1 is null;
COUNT(*)
--------
    1223

Anmerkung:
- Map und Oracle liefern ein unterschiedliches Ergebnis, Reihenfolge des Ausdruckes beeinflusst Ergebniss in Map (nicht aber beim Test 3b, bei dem die neue Reihenfolge kein anderes Ergebnis zur Folge hatte).


Schlussfolgerungen:
- treten <null> Werte in den Daten auf ist besondere Aufmerksamkeit gefordert
- <null> Werte immer separat behandeln
- auf <null> immer mit den speziellen Ausdrücken testen (is null / is not null)
- Ergebnis mit Testdatensatz veifizieren
- Reihenfolge der Ausdrücke kann in Map das Ergebnis beeinflussen
- in Map führt Operator <> zu anderem Ergebnis als Operator (NOT) IN


Noch am Rande – folgende Ausdrücke wurden in einem DM verwendet. Der letzte als "Auffangregel" um auf "leere" Datensätze bei der Symbolart zu testen (die in der Regel <null> sind):

ID_SYMBOLART  =  15  AND  ID_FARBE  =  1
….
to_char(ID_SYMBOLART)  = '' AND ID_FARBE  =  1


Der Ausdruck führt ebenfalls dazu, dass der Punktfang nicht funktioniert. Der Ausdruck muss korrekt lauten:
NOT ID_SYMBOLART NULL AND ID_FARBE = 1


Map 2013, SP2

Snap does not work with some layers

Snapping doesn't work with some layers due to a bug in Map. The issue is related to thematic rules and <null> values. Here is an example -  there is only one rule which is defined as

NOT IS_EXTERNAL IN (1)

IS_EXTERNAL contains <null> values.

To get snapping to work again you need to:

- add a second rule which deals with <null> values (e.g. : IS_EXTERNAL  NULL)
- set colours for the symbol used in the second rule to "none" (symbol will not be drawn)
- move rule on lowest position in style-editor.



Snapping restored....

...by fiddling around with thematic rules.

The exact circumstances of the causes of the issue are not known to me.
Map 2013, SP2

Punktfang funktioniert für einige Layer nicht

Der Punktfang hat für einige Layer nicht funktioniert. 

Punktfang für Symbole funktioniert nicht.
Ursache ist ein Programmfehler. Dieser tritt scheinbar im Zusammenhang mit thematischer Darstellung und <null> Werten auf. Im Beispiel ist nur eine thematische Regel vorhanden, die wie folgt definiert ist:
 

NOT IS_EXTERNAL IN (1)

IS_EXTERNAL enthält auch <null> Werte.

Damit der Punktfang für diese Darstellung funktioniert muss man:

(1) eine weitere thematische Regel anlegen, die die  <null> Werte abfragt (z.B. : IS_EXTERNAL  NULL)

(2) die Farben des Symbols für diese Klasse jeweils auf "Keine" setzen, so dass effektiv kein Symbol gezeichnet wird.

(3) die thematische Klasse an die unterste Position schieben.


Thematische Regel ergänzen um Objektfang wiederherzustellen

Anschliessend funktioniert für die Objekte des Layers der Punktfang wieder.


Punktfang funktioniert wieder
Die genauen Umstände, wann das Problem im Zusammenhang mit <null> Werten auftritt sind mir nicht klar.

Map 2013, SP2

Thursday 13 March 2014

Creating Security Role takes a very long time

We ran into the following issue: it was not possible to create a security role as the process took a long time and eventually we had to kill SecurityAdminitrator before it finished. Whilst the process is running SecurityAdministrator doesn't respond anymore and it looks like the application has crashed. But SecurityAdmin is just waiting that the following SQL statement finishes in Oracle:

insert into mdsys.sdo_geom_metadata_table(sdo_OWNER, sdo_table_name, sdo_column_name, sdo_DIMINFO, sdo_SRID) select 'WT_EW_05_INFO', s.synonym_name, m.column_name, m.DIMINFO, m.SRID from all_sdo_geom_metadata m, all_synonyms s where m.owner=s.table_owner and m.TABLE_NAME = s.TABLE_NAME and s.owner='WT_EW_05_INFO'

We had that issue with Oracle 11.2.0.3 on AIX.

Autodesk Support suggested using SQL Tuning Advisor to find a better execution plan. So we did and it resolved the issue. The security role is now created within seconds. Drawback is - you need an extra license for Oracle's Tuning Package (luckily we have one).  You need to use Enterprise Manager to run the advisor.


AutoCAD Map 2013, SP2




Gastdokument anlegen dauert extrem lange

Das Anlegen eines Gastdokumentes dauerte extrem lange (mehrere Stunden bevor wir abgebrochen haben). Während der Erstellung des Oracle Benutzers und dessen Einrichtung scheint der Sicherheits-Administrator wie abgestürzt und reagiert nicht mehr. In Oracle läuft jedoch folgende Anweisung:

insert into mdsys.sdo_geom_metadata_table(sdo_OWNER, sdo_table_name, sdo_column_name, sdo_DIMINFO, sdo_SRID) select 'WT_EW_05_INFO', s.synonym_name, m.column_name, m.DIMINFO, m.SRID from all_sdo_geom_metadata m, all_synonyms s where m.owner=s.table_owner and m.TABLE_NAME = s.TABLE_NAME and s.owner='WT_EW_05_INFO'

Wir hatten das Problem mit Oracle 11.2.0.3 unter AIX.

Der Vorschlag vom Autodesk Support war, über den Oracle SQL Tuning Advisor einen alternativen Ausführungsplan ermitteln zu lassen. Das hat bei uns das Problem auch behoben - nur benötigt man dafür  die separate Lizenz für das Tuning Paket (die wir auch haben).

Oracle ermittelt dabei Abfragen, die mit hohem Ressourcenverbrauch bzw. langer Laufzeit einhergehen und schlägt einen alternativen Ausführungsplan vor. Dieser kann dann gespeichert werden, so dass in Zukunft bei der gleichen Abfrage der optimierte Ausführungsplan zur Anwendung kommt. Die Einstellungen dafür muss man über den Enterprise Manager vornehmen.

Noch am Rande - die SELECT Anweisung im genannten Statement läuft ohne weiteres durch. Erst im Zusammenhang mit dem INSERT kommt es zur extrem langen Ausführungszeit. 


Map 2013, SP2