Thursday 28 August 2014

Convert MapGuide 6.5 redlining objects

We are migrating MapGuide 6.5 to AIMS 2013. For one of the projects a user has digitized quite a few features as redlining objects and then saved the map locally as mwf file.



MapGuide 6.5 - redlining objects saved in mwf file

MapGuide 6.5 - redlining objects saved in mwf file - detail

Unfortunately there is no function in MapGuide Author to save the redlining objects as SDF nor did I find any other way to convert the redlining objects into a more useful data format. 


Jackie Ng suggested to use the MG Viewer API to convert the redlining objects to GeoJSON. That really was a very helpful suggestion - I have never done anything before with JSON and it was easy exporting the data as JSON using only a view lines of JavaScript. It's a quick and dirty solution - the html files can be downloaded here. It is kept simple without any checks - our maps only contain lines and text. Still it took me a while to get used to JS again and to write code in an text editor without any code completion.



GeoJson can be loaded directly into QGIS:

converted redlinige objects in QGIS...

or processed further in FME. I created a SDF3 file and loaded the file into Map. Objects can be labelled as before:


... and finally in Map


Tuesday 26 August 2014

AutoCAD units set by display model

Just learned that a setting in Map display models sets the units in AutoCAD (command: _units) when generating graphics.


command: _units
That caused some confusion on my side as my drawing template has been set up in "Meters" and after generating graphics AutoCAD units were set to "Millimeters".
 

The culprit can be found in TBDMMAP file an is called - surprise, surprise - <Units>:

<?xml version="1.0" encoding="utf-8"?>
<DisplayModelMap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3.0">
  <Name>WT_ST</Name>
  <Units>Meters</Units>
  <CoordinateSystem>CH1903/GSB.LV03-M</CoordinateSystem>


According to Product Support current AutoCAD units are being used for the setting when display model is saved for the first time.

Just don't know why most of my DM have "Meters" as setting an only one "Millimeters"....


Map 2013, SP2

Friday 15 August 2014

replace data user

If you make use of "guest users" you might want to replace a data user by another data user without users noticing the exchange.

There is no feature in SecurityAdministrator to replace a data user automatically. We have had the need to replace an existing data user with another (newer) data user a couple of times. First I created a few SQL statements which produced the required SQL statements for performing the switch. But it was quite a lot of manual labour involved and as I had to alter 10 guest users it became clear that a slightly more automated procedure would be helpful. I put Batch and SQL files together and semi-automated the first part of the process. Replacing a data user now doesn't take longer than 5 minutes. If one wanted to the process could be automated further.

First batch file
- it only gives you the name of the second role associated with the guest user - you need to put the name into the second batch file
- it also creates the GRANT statement for the guest user in order to be able to create synonyms (and the corresponding REVOKE statement as well).

Second batch file
- it requires to fill in the names / password of the existing data user, the new data user and the guest user and the name of the two roles as well
- it creates all sql statements you need to run to perform the switch

SQL scripts
- you need to run 5 resulting sql scripts manually
- the scripts need to be executed with different users

script 1
The guest user gets direct grants from the data user.
These grants need to be replaced.

script 2
The grants from the "old"  data user (the one which is replaced) to the guest user need to be revoked.

script 3
The guest user has synonyms pointing to the data user.
These synonyms need to be replaced.

script 4
There are two roles associated with a guest user. Grants to these roles need to be replaced.

script 5
The grants from the "old"  data user (the one which is replaced) to the guest user roles need to be revoked.


So far we haven't seen any issues replacing the data user (neither in AutoCAD Map nor in AIMS - both only operate with guest users). But there is no guarantee that the scripts above do all things required for a complete switch.

Download: https://drive.google.com/file/d/0B-MpwgWFuw57aktZbUdYcTA1eXM/edit?usp=sharing

Map 2103, SP2


Wednesday 13 August 2014

Hatch pattern "dots" not printed

We just discovered that the widely used hatch pattern "dots" does not appear or is hardly recognizable in any print out.





Left: AutoCAD hatch pattern "dots" printed off with TB2, right Map hatch pattern "dots" printed off with Map.
There is no issue displaying the hatch pattern on screen or when printing to PDF.
But when a hardcopy is produced (either directly by printing from Map or printing off the PDF file) the dots do not appear on paper.

To solve the issue you can add a "Lineweight" to the hatch pattern. The dots will then become visible when printing off a map.

Steps are:
- open layer XML file in an editor
- within the PATH tag add 

 <LineWeight>%LINEWEIGHT%</LineWeight>
- within the ParameterOverrides tag add
<Override>
 <SymbolName>DOTS</SymbolName>
 <ParameterIdentifier>LINEWEIGHT</ParameterIdentifier>
 <ParameterValue>0.2</ParameterValue>
</Override>


You might need to alter SymbolName and the value for ParameterValue.

The result should look like this:


<LineWeight> added within PATH section....
... and corresponding Override section added as well.

Map 2013, SP2

Friday 8 August 2014

Error message when opening form in Form Designer

In one of the documents we migrated from TB2 we got the following error message when opening any of the forms in Form Designer:

ORA-0001 Unique Conraint violated...

ORA-00001: Unique Constraint (WT_VP.TB_GN_CONTROL_P) violated.....
'insert into TB_GN_CONTROL(....)'


The form opens in Form Designer but adding a control and saving the form caused Administrator to crash (basically with same message).

I was able to solve the issue but I'm not 100% sure which of the following steps actually did the trick:

1) 1 ClickMaintenance
2) Re-Open project in Administrator
3) Duplicate an existing form

I did all three of them but I believe 1 Click Maintenance was not enough. Either you need to make sure to re-open the project afterwards or you need to insert an new form (I accidentally clicked the wrong button and the form got duplicated - and then the problem was gone....).

Map 2013, SP2

User groups

Just received an email about the upcoming german AutoCAD Map (Topobase) user group meeting. Traditionally it takes place the day before Intergeo opens its doors - this year in Berlin.

There is a swiss AutoCAD Map (Topobase) user group as well. Both have there own websites (shall I say "used to have" as the swiss one seems to be dead)  Anyway - here is the link in case you are interested:

http://www.autodesk-geospatial-usergroup.eu/Home.aspx


Labels - line break - additional character displayed in AIMS/MapGuide

Problem:
For labels with line breaks MapGuide/AIMS displays an additional character if the label is defined as MTEXT. The character is not displayed in Map nor does it get exported / appears in drawings created with _maptoacad.




Line break in MText - additional character is displayed in AIMS.

Solution:
Switch from MTEXT to TEXT in your label layer (or you could replace the existing line break with MText compatible line break: "\P" using SQL). If you switch Mtext to Text (at least in Studio) you will loose some format settings - such as Font height.

Additional info:
Has been reported to and confirmed by Autodesk Support.

To check which character-code is used for line breaks use DUMP command in Oracle sql:
SELECT text, dump( text, 1013 ) from p1 where text like '%(enter)%';

Typ=1 Len=30 CharacterSet=WE8MSWIN1252: 108,105,110,101,49,13,10,108,105,110,101,50,13,10,108,105,

110,101,51,13,10,40,101,110,116,101,114,41,13,10

typical combination for Windows based systems: 13,10

10 - line feed
13 - carriage return

Map 2013 SP2, AIMS 2013