Thursday, 31 July 2014

MapGuide / AIMS - drawing order - sorting

We are setting up MapGuide (AIMS) 2013 and TBVIEW as our intranet GIS system.
Our current solution is based on MapGuide 6 and TBWebframe.

In MapGuide 6 we have a map "template" containing all layers we provide. For a single project (we have roughly 30) we just take the template and remove all layers which are not required. The template map contains around 650 layers. I assume we will have more layers with Map/MapGuide as we will offer more display models to our users.

With Map 2013 we publish all required display model to MapGuide. A new map is merged with our template by exporting both as XML and copy/pasting the content. That works quite well. A bigger issue is setting up layer draw order.
Copying an XML fragment (<MapLayer>) at the right position is difficult with 600+ layers. Doing it with MapGuide Studio is not practical.

I have written a little tool which helps sorting layers and layer groups:
- export map as XML (Studio or MapAgent)
- load XML file into tool and create text file with all layers and groups (including current draw order)
- open text file in excel and sort layers/groups as required
- import layer into tool and apply to map - layers and groups get sorted accordingly
- import XML into MapGuide (MapAgent).

I have done a few tests and it seems to work reasonably well. If anyone is interested - drop me an email and I will send you the tool and source code.

Tuesday, 22 July 2014

Map cache

For certain FDO data sources (such as Oracle) Map caches data locally. The cache folder is set in Map-options (command: _mapoptions, tab "System").

Whenever you suddenly get strange error messages in Map related to FDO data and the issue is not reproducible on a different machine a first measure is to empty the Map-cache folder.

Unfortunately the button "Empty cache" in Map-options does not delete all files. Therefore you need to delete the files using  Windows Explorer.

Map 2013 SP2

Sunday, 20 July 2014

Remove TB2 entities from drawing

Here is a little c# application which deletes TB2 entities from a drawing.
We have one project where TB2 saves drawings containing TB2 entities. Moving to Map we need to remove these entities but keep all non-TB2 drawing objects.

The application:
- checks whether a drawing entity has XDATA or not, if there is any XDATA the app checks whether XDATA contains the string "FID:", if so, the object gets deleted
- purges all layers
- creates one new layer (fixed name)
- removes non-TB2 objects on one specific layer (fixed name)
- creates a log file and lists all drawings which could not be processed

The app runs within AutoCAD, you only need to specify the folder where the files are stored (
netload, command: win_deletetb2entities).

Source code is attached as well. Maybe it is useful for someone else.

AutoCAD Map 2013, SP2

Friday, 18 July 2014

MapGuide - An exception occurred in DB XML component

When publishing from Map to MapGuide(AIMS) I occasionally receive the following error message

- Remote-Server konnte den XML-Stream nicht analysieren!

(Publishing aborted - remote server couldn't analyse xml-stream)

This happens if my display model contains lots of layers (let's say more than 30).

In MapGuide Studio I occasionally receive the following error message:

Error message in Studio

An exception occurred in DB XML component.
Error: Not enough space.

or similar error messages referring to the DB XML component.

This happens if I try to delete lots of resources (layers) at the same time.

Autodesk Support provided the following workaround:

- change the following settings in serverconfig.ini temporarily to:

DBMaxLockers = 5000
DBMaxTransactions = 5000

- restart MapGuide
- publish Display Model or delete resources
- set the aforementioned settings back to previous values
- restart MapGuide

AIMS 2013

Map Oracle industry model - Mapsys/Mapmain password

The ordinary Map user needs to know the password of the mapsys or mapmain user in order to connect to Oracle:

Map - Log in dialog box for Industry Models
We are not able to log in using the mapmain user - Map just gives us an error message back. So we need to let users connect via mapsys. Mapsys is a quite powerful Oracle user - we don't want to give username and password to a normal (Map) user (even if it were the mapmain user).

Additionally we have two databases - a production one and a test one. Users need to be able to connect to either of them. Here is how we do it without handing over the passwords:

Map - username and connection details for the login dialog box (command: _mapdbconnect) are stored locally. All details are saved in an XML file. Connection details comprises Oracle database name, mapsys/mapmain user name and password (encrypted).

We have created two xml files - one with the details required to connect to the production database, the other one with the details required to connect to the test database.

There are two desktop shortcuts to fire up Map. A script copies the machting xml file from the network drive to the local folder before Map gets started:

copy SYSTEM.config.mapsys.proddb "C:\ProgramData\Autodesk\AutoCAD Map 3D 2013\R19.0\deu\Settings\SYSTEM.config"
cd /D "C:\Program Files\Autodesk\AutoCAD Map 3D 2013\UserDataCache\"
start "" "C:\Program Files\Autodesk\AutoCAD Map 3D 2013\acad.exe"  /product ACAD /language "de-DE"

The Map user finds all the details for the Login-dialog box filled in already - all he or she needs to do is to enter the personal password. For the user the process is transparent.

Map 2013, SP2

Friday, 11 July 2014

DWG - Export - somes hatches appear as SOLID

When exporting to DWG some hatches are displayed as SOLID hatch. First I thought the export process is to blame or its due to the known issue with hatches and large coordinate values.

same hatch - different appearance

The funny thing was, that the properties of the hatch looked good - it got the right hatch pattern and scale assigned - but nonetheless appeared as "solid". Increasing the hatch scale helped to display the hatch correctly - but I didn't want to change the hatch scale.

It turns out that setting the AutoCAD variable HPMAXLINES to 10'000'000 solves the display issue.

increasing hpmaxlines solves the display issue

Map 2013, Sp2