Dienstag, 25. November 2014

dynamic feature labels not always displayed

We noticed that dynamic labels for FDO features are not always displayed. Depending on other map features (points and text) dynamic labels are generated or not. Here is one example: the blue text is a dynamically generated label for a grid cell:

dynamic label in centre of map.....
If the map extent is slightly different or additional layers are turned on the dynamic label disappears:
...disappears when other layers become visible

Unfortunately there is no "switch" to force AIMS to generate the label nonetheless. But Autodesk support kindly provided a more detailed explanation about what is going on and how to get around it:

"AIMS/Map: labels are not visible if point feature or other labels are at the same place
You miss labels coming from FDO Feature stylisation
 
Cause 
In general labels are visible always on top of the graphical objects, but labels are not visible if point features are at the same place
  
Solution 
As a workaround you can change the following settings in the .layer file of Map 3D or in the .xml of AIMS
• Save the FDO layer for point features class as .layer file
• Open the .layer file with notepad(++)
• Change following setting in the .layer file from True to False
                    <AddToExclusionRegion>false</AddToExclusionRegion>"


Map 2013, SP2

Donnerstag, 20. November 2014

AIMS / MapGuide - scripts for map maintenance

I have written a small script which helps with "map maintenance". We have 50+ maps - nearly all of them derived from a map template. From time to time we need to add new layers to our maps - a quite awkward and time consuming process with MapGuide Studio. The script allows to insert layers and groups into all maps. Drawing order of layers and position of the group in the legend tree can be controlled (by referencing an existing layer or group). I have used the script a couple of times now it seems to work well. The script is far from being perfect - despite it might be helpful to others.
If you are interested let me know - I do not want to provide the scripts as simple download (yet) as it is "work in progress" and text/comments/variable names 
are in German only. I'm interested in collaborating with anyone else out there wanting to improve MapGuide maintenance through scripting (PHP). Just drop me a line: robert.fritz - at - win.ch

Mittwoch, 19. November 2014

MapGuide / AIMS performance

Most of the data we publish to our intranet web gis (based on AIMS 2013) comes from Oracle via FDO Topobase provider. For performance reasons we have created an SDF file for the most often used base data - containing 30+ tables and 700'000 features. To my surprise the SDF file is not as fast as I expected. By changing the default value "DataConnectionPoolExcludedProviders" performance increased noticable.

By default SDF files are excldued from ConnectionPooling:
 
DataConnectionPoolExcludedProviders = OSGeo.SDF,OSGeo.SHP

By uncommenting the line and restarting AIMS things got better:

#DataConnectionPoolExcludedProviders = OSGeo.SDF,OSGeo.SHP

This has been mentioned before - but somehow I didn't know it. Here is an older reference:

http://zacster.blogspot.ch/2008/10/mapguide-performance-tips.html


In the next few days I will look into SQLite files as an alternative to SDF. A first test seems to be promising - SQLite file was much faster than SDF.

Map 2013, SP2

Montag, 17. November 2014

ORA-28031 maximum of 148 roles exceeded.

For some features in Map-Administrator (such as deleting an industry model) you need to log in with an Oracle user who has elevated privileges (DBA) compared to MAPSYS. We do not use Oracles SYSTEM user but have one with nearly DBA privileges called GISDBA. Recently we got the following error message when trying to log in with the user GISDBA:

ORA-28031 maximum of 148 roles exceeded.

When you create "guest users" with Security Administrator multiple roles are being created and two roles per guest user are attached to GISDBA.  We have many industry models (30+) and usually we create at least two guest users per industry model (one is read only, the second one allows data manipulation - depending on the complexity of the industry model we have more then 2 guest users).

But there is a limit on how many roles can be attached to one Oracle user - and we have hit the limit. The way to get around this issue is to create a second GISDBA user and to transfer some of the roles. 

select count(granted_role) from USER_ROLE_PRIVS where granted_role like 'TB%';
COUNT(GRANTED_ROLE)
-------------------
76


The example above shows that one GISDBA user now has 76 roles attached which are related to guest users.


Map 2013, SP2

Freitag, 24. Oktober 2014

Delete geometry but keep record

When you delete a geometry (industry model) Map also deletes the database record as well. In some situations you just want to delete the geometry of a feature but keep the record. How do you do this?

in Administrator:
(1) add the Geometry/Coordinate Editor control to the form





Administrator - Form Designer - add control....

in Map:
(2) set form in Edit mode
(3) open Geometry editor (button will appear next to the Editor control)



... Map - Form - use control to delete geometry.

(4) In the Geometry Editor window you can delete - step by step - all vertices of a feature (you cannot delete the whole feature in one go). After deleting all vertices don't forget to "Update" the record to make the changes permanent.

Freitag, 10. Oktober 2014

dynamic maps in Crystal reports - transparent background

In the process of migrating from TB2 to Map we also have to migrate CR reports. A few of them include a map which is created dynamically. For creating these maps with Map/AIMS I use the GeoRest extension (the one which comes with AIMS installation). The Georest extension seems only to be able to create PNG files - including a transparent background. But there is a bug in CR 2011 - transparency is not handled properly and converted either to a black or white background (see Note:  1199393 ). In our case the background was always black - the report with the map embedded didn't look nice at all:

transparent background appears black....


My colleague found a nice work-around. We created a layer which covers the whole area relevant for reporting. The layer is put in the background and gets the colour white. A map generated via GeoRest does not have a transparent background anymore:

....background colour set to white
Map 2013, SP2

Donnerstag, 9. Oktober 2014

Form filter settings and reference records gone missing.....

We experienced the loss of form filter settings and reference records. The issue kept us busy for quite some time. First one colleague reported, that form-filters he had defined in multiple industry models had gone. After setting the filters up again they went missing again. Then something similar was reported from a different colleague regarding reference records. The issues occurred in our production and our testing environment.  Initially we could not really reproduce the issues. Suddenly entries were gone. Sometimes on the same day as they had been made, sometimes a few days after. No one had an explanation and Autodesk support was as puzzled as we were. Obvious suspects such as 1-ClickMaintenance or importing forms or similar actions as a cause could be excluded right from the start.

We created a trigger on table TB_REF where reference records are kept. This way we could at least determine who did a delete in the table and when. With this information available it became clear where to look for the cause.

But first some words about our Map environment:

We have set up three MAPSYS users - each MAPSYS user is run by a different organizational unit (for security reasons one organizational unit shall not have unlimited access to the data of another unit). Each MAPSYS contains a set of distinctive industry models, for instance Mapsys1 contains the industry model for electricity, Mapsys2 contains the industry model for waste water and so on. Map users can only connect to one Mapsys - the one which belongs to their organizational unit. But users need data maintained in other Mapsys environments (the guys running the water industry model would like to see data from the waste water network as well). So we created guest users for each industry model (usually based on the read-only template in Security Admin) and imported these guest users into the other Mapsys users. In my example Mapsys1 now contains:
- electricity industry model (data user)
- waster water industry model via an imported guest user

The filter settings and reference records now go missing when you set up a new workspace (in Mapsys1) and you add a guest user (in my example waste water guest user) where the underlying data user is kept in a different MAPSYS (Mapsys2). Because the user ids of the users who created the filter settings and reference records (in Mapsys2) are not known in the Mapsys environment the project is created in (Mapsys1) the settings get deleted by Map.
But there is one exception - (public) settings made by the default "Administrator" user are kept - just because the default Administrator user is always present in a Mapsys and always has the same user-id. The settings get also deleted when a user just opens the project later in Map.

There are a couple of issues here:

(1) For some reasons the default read-only guest user template allows DELETE operations on tables TB_REF* and TB_GN_DIALOG_FILTER. By revoking the DELETE permission the problem should go away.

(2) There is some in-built functionality in Map which tries to keep data consistent and to prevent orphaned entries in "TB_" tables. But in the situation described above there aren't any orphaned entries - is just that Map doesn't recognize that the data user is kept in a different Mapsys environment and therefore no deletion should take place.


The trigger we set up in the industry model (kept in Mapsys2) logged users only able to connect with Mapsys1. They actually did not delete any records - the just opened a project containing a the guest user from Mapsys2.

Map 2013, SP2



Dienstag, 30. September 2014

Access to the path '\\users.winlan.net\users$\' is denied

We get the error message in three situations:

(1) - save a Map report as PDF (report preview window)
(2) - open a linked document from within form
(3) - exporting form data as ascii/excel file 



error message when trying to open a linked document

All users have a private folder on the network. The folder is connected as a drive, the root folder is "\\users.winlan.net\users$\". Map now tries to save a file in the root folder - but a user does not have any permissions there.

The following "solutions" are available:


(1) - save a Map report as PDF (report preview window)
- the pdf file is - despite the error message - saved locally in "C:\Program Files\Autodesk\AutoCAD Map 3D 2013\Temp". A user can open the file from there.

(2) - open a linked document from within form
- save the drawing first on the network drive, two levels below the path given the error message (in my case that would be: \\users.winlan.net\users$\users\frro3 - basically my root folder on the drive).

(3) - exporting form data as ascii/excel file
- The problem does not occur on all machines. On some machines Map just crashes. The crash report contains the error message mentioned above. On some machines the crash can be avoided by accepting the default path in the "Save" dialog. On some machines export just works. By the way - the crash only happens when you save the data as shown in the form - no matter whether you try to create an excel or an ascii file.



crash on some machines when trying to export form data


Map 2013, SP2

Montag, 29. September 2014

Cannot convert GIS objects to CAD objects


When exporting to DWG we got the following error message:

"GIS-Objekte konnten nicht in AutoCAD-Objekte konvertiert werden."


(Gis object cannot be converted to CAD object).

and - no surprise - certain objects were missing in the CAD drawing.

After fiddling around for ages I found out that the problem is caused by an erroneous expression in one layer. Funny though, as there is no error message when generating the graphics in Map nor are any features missing. But if you check the expression in Map it will return a hint:

error message displayed - only if you ask for it....


The expression was:

ID_ABSTLINIENART  IN ( 2, 5, 6, 7, 11, 12 ) AND  >  1

but should have been

ID_ABSTLINIENART  IN ( 2, 5, 6, 7, 11, 12 ) AND ID_ABSTANDSLINIENTYP >  1

So, the error message is misleading - kind of.


Map 2013, SP2

Donnerstag, 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


Dienstag, 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

Freitag, 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


Mittwoch, 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

Freitag, 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

Donnerstag, 31. Juli 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.

Dienstag, 22. Juli 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

Sonntag, 20. Juli 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.


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


AutoCAD Map 2013, SP2

Freitag, 18. Juli 2014

MapGuide - An exception occurred in DB XML component

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

PUBLIZIEREN ABGEBROCHEN:
- 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"
exit


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


Freitag, 11. Juli 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

Freitag, 27. Juni 2014

Security Admin - tables of wrong schema are displayed

I don't know how many people actually make use of Map's Security Admin but it seems there aren't many. Some basic information about Security Admin can be found here We have seen a couple of issues I want to document here for reference:

(a) some functionality is broken when using a Guest
We found out that some features in Map are broken when using a guest instead of the main data document (such as soft split/hard split not working properly anmyore, wrong form opens up for selected feature). Fortunately Autodesk has fixed that (for Map 2013 in form of hot-fixes).

(b) performance issue when creating a guest
That seems to be depending on the Oracle version in use. There is a workaorund (see here).  Unfortunately the SQL profile suddenly stopped haveing any effect in our database and the re-creation of a new profile has not yet solved the issue. But hey, it worked very well for almost 2 months. Some discussion is going on here.

(c) tables of wrong schema are displayed

When you open your guest user in Security Admin you might be surprised to see a completely wrong set of tables. In fact Security Admin shows the tables and views of different Oracle schema - not the one you have created the guest role for.
This will happen if your base schema (main document) contains synonyms. Security Admin displays the tables/views of the schema where the synonyms are pointing to. The only way to work around this - as far as we know - is to create PUBLIC synonyms instead of "normal" private ones.



Map 2013, SP2 (and a few hot-fixes)



Samstag, 21. Juni 2014

MapGuide fusion viewer - "The specified object was not found."

I just tried to select a feature in MapGuide Studio's "Map Preview" and got the following error message:

"The specified object was not found."

I hadn't seen the message before nor did it occur in any of the other maps.

I did a bit of research and came accross and older positing in MapGuide OS discussion list.


I checked whether I had the same situtaion here or not - by opening the xml definition of the layer file in Maestro. The order of the PropertyMappings seemed to be ok but I then noticed that there was one property mapping in upper and lower cases whereas all other PropertyMappings were in upper cases:

invalid property mapping in layer file?

It turned out that this property didn't occur in the featue table at all. After removing the mapping the message went away. It seems to effect fusion viewer only.

AIMS 2013 SP2,

Freitag, 23. Mai 2014

Administrator crashes when trying to add view

Map - Administrator might crash when you add a view (add new feature class > create from existing view). If  log file or CER report (dmpuserinfo.xml) contain the following error message:

OSGeo.FDO.Common.Exception: ORA-01406: Gelieferter Spaltenwert wurde abgeschnitten
 'SELECT USER, view_name, text FROM user_views'


(Translation of ORA message: fetched column value was truncated)

the cause for the crash could be due to a view definition with more than 10000 characters.

The 10000 character limit I haven't tested myself but was told by an Autodesk employee some time ago. It seems the issue was introduced in Map 2013 and didn't not exist in prevoius releases. I don't know if this has been fixed in newer releases.

Map 2013, SP2

Mittwoch, 21. Mai 2014

Publish to AIMS fails if layer groups exist in Display Manager

The following issues is a known defect:

Publish to AIMS fails when layer Groups exist in Display Manager

Issue:
After running MAPPUBLISHTOMAPGUIDE in a drawing that has layers arranged within Groups, the following error appears in the browser Layout:

Problem:
The application encountered a problem and could not finish the operation you just requested properly.

Solution:
If it's the first time you met this problem, try again or restart the application / session; otherwise, describe the steps to reproduce this problem to the server administrator for suggestions.

Causes:
Known issue. Being tracked as DE7876 internally.

Solution:
Workaround:
1. Remove all Groups from the Map 3D Display Manager.
2. Run MAPPUBLISHTOMAPGUIDE.
3. In AIMS Studio, create Folders to use for grouping Layers.


Link

Apperently the descrpition above applies to Map 2104 (I was told by product support).

I have a related issue in Map 2013 : if my DisplayModel contains only one level of groups publishing to AIMS 2013 is not an issue. Only if the Display Model has subfolders then:
- the top level folder does not appear in MapGuide Studio (I have only one top level folder)
- previewing the map in Studio fails with error message mentioned above

I found the following solution:
- just create the missing top level folder in Studio!

It seems that Map publishes the information about the top level folder but does not create the top level folder itself. Just adding the top level folder solves the issue for me.

Map 2013, SP2

Mittwoch, 14. Mai 2014

Plot - new or modified features missing

Newly created or modified features in an Oracle based industry model might be missing in a plot if the plot option "plot in background" is active. The features are shown in plot preview but do not appear in the plot itself. You need to generate graphics before plotting or disable the aformentioned option in the plotting dialog box.


Plot option - "plot in background"
Map 2013, SP2

Plotten - neue/geänderte Objekte fehlen im Ausdruck

Erfasst man in Map (Oracle Fachschale) neue Features oder ändert Features dann kann es passieren, das diese nicht im Plot erscheinen (aber in der Plotvorschau). Dies tritt scheinbar auf, wenn man beim Plotten die Option "im Hintergrund plotten" aktiv hat. In diesem Fall müsste man einen neuen Bildaufbau vor dem Plot ausführen. 



Plotoption  "im Hintergrund plotten"
Map 2013, SP2

Donnerstag, 24. April 2014

Map API - MapButton

I tried to use a MapButton but Map crashed after clicking on it. MapButton allows the user to click or draw a rectangle in the drawing area and returns the coordinates for further processing. See developer sample #30.

As alternative one can use the following call:

Autodesk.Map.IM.Graphic.Polygon poly = this.Application.Documents.Active.Map.GetRectangle("first point:", "second point:");

further details Map API Doc: MapLogic.GetRectangle Method

Map 2103, SP2

Map API - MapButton

In Map 2013 SP2 funktioniert der MappButton nicht - es kommt zum Absturz. Über den MapButton kann man dem Benutzer ermöglichen z.B. ein Punkt oder ein Rechteck im Zeichenbereich aufzuziehen und dann die entsprechende Koordinaten auszuwerten (siehe Developer Sample 30_MapButton).

Als Alternative kann man folgenden Aufruf verwenden (Beispiel Rechteck):

Autodesk.Map.IM.Graphic.Polygon poly = this.Application.Documents.Active.Map.GetRectangle("Erster Eckpunkt:", "Zweiter Eckpunkt:");

siehe Map API Doc: MapLogic.GetRectangle Method

Map 2013, SP2

Donnerstag, 17. April 2014

Username / Benutzername speichern

Namen des aktuellen Benutzers über Trigger abspeichern / save name of current user via trigger:

create or replace TRIGGER wfe_sk_strassenkarte_I  BEFORE INSERT ON wfe_sk_strassenkarte
FOR EACH ROW

DECLARE
begin   
     SELECT USER_MGMT.GETVALUE('LOGIN_NAME') INTO :new.visum FROM dual;
END;


Map 2103, SP2

Mittwoch, 16. April 2014

Start external application from form

From a waste water industry model form we want to launch an external application with certain parameters. In Map form designer you can add a button with VB.net script. Map API provides a function called OpenURL which seemed to be a good starting point. 

Map API Industry Model Docs

 The following script will open Notepad++:

Public Overrides Sub Button_Click()
      Me.Application.OpenUrl("C:\Program Files (x86)\Notepad++\notepad++.exe")
End Sub


It doesn't just open Notepad++. Notepad++ also tries to open a file C:\0:


Notepad++ message when called from Map form
It seems Map adds a parameter to the call which Notepad++ interprets as a reference to a file to be opened. Unfortunately I was not able to call Notepad++ with further parameters - such as a specific file name.

I couldn't figure out whether OpenURL is a suitable function for calling external apps or not. Instead of using Map API one can use the .Net Framework functionality as well. The following VB.net script launches the external app including certain startup parameters:

Public Overrides Sub Button_Click()   

 'Haltung auslesen
 dim d as Autodesk.Map.IM.Forms.DialogControls.TextBox
 dim name_number as String
 d = Me.Dialog.Controls.Item("NAME_NUMBER")
 name_number = d.Value
 dim parameter as String =  " /p Q:\KINS\Daten\öffKanal/h " + name_number

 'Msgbox( "Aufruf von:C:\Program Files (x86)\KINS\KINS.EXE " + parameter)
 'Aufruf
   
 Dim startInfo As New System.Diagnostics.ProcessStartInfo
 startInfo.FileName = "C:\Program Files (x86)\KINS\KINS.EXE"
 startInfo.Arguments = parameter
 Dim pro As New System.Diagnostics.Process
 pro.Start(startInfo)

End Sub

 
Map 2013 SP2


Externes Programm aus Formular starten

Wir müssen aus dem Abwasser-Haltungsformular eine Applikation mit Parametern - unter anderem die aktuelle Haltungsnummer - aufrufen. Im Formular kann man einen "Button" einbinden und mit VB.Net Script hinterlegen. In der Map API gibt es eine Funktion, die für einen Aufruf vom Namen her "passen"  könnte - OpenURL.

Map API Dokumentation

Damit lässt sich tatsächlich ein Programm starten, z.B. so:

Public Overrides Sub Button_Click()
      Me.Application.OpenUrl("C:\Program Files (x86)\Notepad++\notepad++.exe")
End Sub


Beim Aufruf von Notepad++ erscheint jedoch folgende Meldung:




Meldung in Notepad++ nach Aufruf aus Map
Es scheint, dass beim Aufruf schon ein Parameter angehängt wird den Notepad++ als Verweis auf eine bestimmte Datei interpretiert. Legt man eine Datei mit dem Namen "0" im Root Verzeichnis von C: an, öffnet Notepad++ die Datei auch beim Aufruf.

Es hat nicht funktioniert, das Programm mit eigenen Parametern aufzurufen - z.B. mit einem bestimmten Dateinamen.

Eine Datei - die mit einem Programm verknüpft ist - liess sich nicht öffnen:

Public Overrides Sub Button_Click()
      Me.Application.OpenUrl(" C:\Temp\testdatei.txt")
End Sub


Um ein Programm zu starten kann man die Funktionalität des .Net Frameworks nutzen:

Public Overrides Sub Button_Click()   

 'Haltung auslesen
 dim d as Autodesk.Map.IM.Forms.DialogControls.TextBox
 dim name_number as String
 d = Me.Dialog.Controls.Item("NAME_NUMBER")
 name_number = d.Value
 dim parameter as String =  " /p Q:\KINS\Daten\öffKanal/h " + name_number

 'Msgbox( "Aufruf von:C:\Program Files (x86)\KINS\KINS.EXE " + parameter)
 'Aufruf
   
 Dim startInfo As New System.Diagnostics.ProcessStartInfo
 startInfo.FileName = "C:\Program Files (x86)\KINS\KINS.EXE"
 startInfo.Arguments = parameter
 Dim pro As New System.Diagnostics.Process
 pro.Start(startInfo)

End Sub


Map 2013, SP2

Donnerstag, 3. April 2014

Master-Detail forms and form designer

When you open a master-detail form in form designer and then close the designer without saving alle settings for the detail forms are lost. Either you have a copy of your forms (you can save form definitions as XML) you can re-import or you need to set up the detail forms again.

Map 2013, SP2

Master-Detail Formulare - Formulardesigner

Öffnet man ein Master-Detail Formular im Formular Designer und schliesst den Designer ohne zu speichern gehen die Einstellungen für die Detailformulare verloren.
Entweder man kann eine Sicherungskopie einspielen (Formulare lassen sich als XML exportieren) oder man muss die Detailformulare wieder neu einrichten.

Map 2013, SP2

Donnerstag, 27. März 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:



Mittwoch, 26. März 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

Freitag, 21. März 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

Mittwoch, 19. März 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

Montag, 17. März 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