Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Super Contributor
Posts: 301
Registered: ‎02-10-2016

Developing export autocad for WebMap by using GeoMedia engine

HI team,

 

We create an export autocad tool for WebMap by using GeoMEdia exporting autocad engine and MapServer. The legend connections are stored in library, when the service is called, the connections are loaded into a map server instance. Each legend entry is loaded, then feeded to exportToAutoCadService.

 

 

While testing we observe that the number of output features is not consistent in the same bounding box. We suspect that the autocad version could have something to do with that or the loading data for legend entry into map server is not truely completed.

 

2018-04-03 17_40_00-WinServer2012R2Base00_P2018E (Before installing P2018) [Running] - Oracle VM Vir.png

 

Appreciate all suggestions and ideas on investigating the problems

 

Kind regards,

 

 

Technical Evangelist
Posts: 523
Registered: ‎09-11-2015

Re: Developing export autocad for WebMap by using GeoMedia engine

Hi Bob,

 

if the number of exported elements only differs for different Autocad versions, and are consistent within the same Autocad version,

then the version most likely matters and it has nothing to do with LoadData. It is possible that different Autocad versions supports different element types, so something gets exported in one version and is missing in other one.

 

Pavel

Super Contributor
Posts: 301
Registered: ‎02-10-2016

Re: Developing export autocad for WebMap by using GeoMedia engine

[ Edited ]

Hi team,

 

Our investigation shows that the version has nothing to do with the inconsistency. We are still investigating and the event viewer shows some info about some issue with the connection and COM object

 

2018-04-04 18_15_52-WinServer2012R2Base00_P2018E (Before installing P2018) [Running] - Oracle VM Vir.png

 

 

2018-04-04 18_15_24-WinServer2012R2Base00_P2018E (Before installing P2018) [Running] - Oracle VM Vir.png

 

I am not sure what goes wrong here. Appreciate all ideas and suggestions

 

Kind regards,

Technical Evangelist
Posts: 523
Registered: ‎09-11-2015

Re: Developing export autocad for WebMap by using GeoMedia engine

Hi Bob,

 

the error means that a COM object has been released and the .NET wrapper points to invalid memory now. If you use Marshal.ReleaseComObject somewhere in your code, make sure that it is in pair with the variable assignment. If you use Marshal.FinalReleaseComObject, then rewrite the code and never use this function.

 

Pavel

Super Contributor
Posts: 301
Registered: ‎02-10-2016

Re: Developing export autocad for WebMap by using GeoMedia engine

[ Edited ]

Hi team,

 

The code is working for web map 2014, 2015 and 2016 and now we test against 16.5

The tool works ok if only one request at a time or multiple requests with only one web map instance. When we do multiple requests at the same time and have multiple webmap instances, the results become inconsistent.

In our code, we use spatialfilterpipe to filter legend entry's records that belong in the input bounding box and I don't know why but the spatial filter fails occasionally. As the result of this, the output record returned is the number of instances in the input record, but no exception is thrown in the spatialfilterpipe.

 

 

2018-04-06 19_00_12-WinServer2012R2Base00_P2018E (Before installing P2018) [Running] - Oracle VM Vir.png

 

I really no idea why it behaves like that. Really appreciate all insights and suggestions

 

Kind regards,  

 

Highlighted
Super Contributor
Posts: 301
Registered: ‎02-10-2016

Re: Developing export autocad for WebMap by using GeoMedia engine

Hi team,

 

Our experiments show that spatialfilterpipe is the one that is not working properly. What we now try to work around is to apply the spatil filter pipe for originating pipe instead of applying it later after calling load data for each legend entry.

 

Here is our steps:

  1. Firstly get a fresh map server instance, set coordinate system
  2. Create an instance of LegendLibrary, so  legend moniker is loaded 
  3. Create an instance of LegendEntries, so all feature connections are loaded to map server
  4. Get all feature connections, go through each one and get its originating pipe
  5. [Important] Apply spatial filter on the originating pipe
  6. [Important] Refresh the legend entries to make sure spatial filter is applied.

We are not so sure that step 5 we do correctly and how to do step 6

 

Here is the detail of how we code it

Part 1.png

 

part 2.png

 

part 3.png

2018-04-09 18_57_23-WinServer2012R2Base00_P2018E (Before installing P2018) [Running] - Oracle VM Vir.png

 

 

 

part 6.png

 

During testing, we observe that get legend entries and legend entry's load data are not robust and need to be taken care carefully with try/block.

We originally would like to apply spatial filter after load data function of each legend entry, but it seems to fail occasionally, returning the same number records as the input.

 

We appreciate all suggestions and insights on these problem.

 

Kind regards,

Technical Evangelist
Posts: 523
Registered: ‎09-11-2015

Re: Developing export autocad for WebMap by using GeoMedia engine

Hi Bob,

 

there are couple of potential problems in your code, but it is not clear whether they actually are the issue. For example GeoMedia objects are mostly not thread safe, but it is not clear whether you use multiple threads or not. Also try...catch block usually does not solve problems, this construct rather hide or mask them.

 

So I think it would be the best if you create support ticket. In this case, we would most likely ask you for a whole working sample code with data to test.

 

Pavel

Super Contributor
Posts: 301
Registered: ‎02-10-2016

Re: Developing export autocad for WebMap by using GeoMedia engine

Hi Pavel,

 

Thank you for looking into this problem. Would you mind pointing for us which parts of our code could be potential problem?

I am sure we are not using multiple threads. We understand that a try/catch block doesnt' solve the problem, just work around this, so we appreciate if you briefly outline how it should be approached.

 

As I mention, the part that we still have problem is how to use spatialfilterpipe so it should work correctly and consistently. I have no idea how it could be inconsistently when doing multiple requests. Appreciate all insights and explanations on this problem.

 

Kind regards,  

 

Technical Evangelist
Posts: 523
Registered: ‎09-11-2015

Re: Developing export autocad for WebMap by using GeoMedia engine

Hi Bob,

 

I cannot infer much more from the code snippet you provided. As I wrote before, the best would be if you create a support ticket, and then possibly provide your code the the assigned analyst.

 

Thanks, Pavel

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.