Autodesk Infrastructure Map Server(AIMS) API Training content : Part-3

By Daniel Du

In this post, we discuss site service and resource service. As we talked in part 2, there are 7 services in MapGuide Web Extension API. Before a page can use a service, it must open a site connection and create an instance of the necessary service type. All other 6 services are created by site service from a site connection. You have to initialize web tier in every page with following code snippet:

MapGuideApi.MgInitializeWebTier(“webconfig.ini”)

webconfig.ini file is text file used to perform basic initialization when a session starts, it is read by MgInitializeWebTier(). It contains parameters required to connect to the site server: IP address, port numbers, map agent requests customization, e.g. pause time between successive request, passwords for OGC (WMS & WFS) requests and etc. The values set in this file affect the performance of map server. In most cases, no need to change. If you have to, please check out this document

An Infrastructure Map Server repository is a database that stores and manages the data for the site. The repository stores all data except data that is stored in external databases. Data stored in a repository is a resource.  A resource can be persistent resource or temporary resource. Persistent resource that is available to all users is stored in the Library repository.In addition, each session has its own repository, which stores the run-time map state. It can also be used to store other data, like temporary layers that apply only to an individual session. For example, a temporary layer might be used to overlay map symbols indicating places of interest.

Resource service is used to manipulate these resources with API. To use a resource service, web page must open a site connection and create an instance of a resource service:

MgUserInformation userInfo = new MgUserInformation(sessionID); siteConnection = new MgSiteConnection(); siteConnection.Open(userInfo); MgResourceService resourceService = (MgResourceService)siteConnection    .CreateService(MgServiceType.ResourceService); 

Here are some commonly used methods of resource service, please find the complete method list from the AIMS API Reference.

MgResourceService::EnumerateResources

MgResourceService::GetResourceContent

MgResourceService::SetResource

With these simple APIs, you can create very useful/powerful applications as long as you have deep understanding of the resource content, in most case they are xml. If you are not familiar with resource and resource service, please view the chapter 3 of AIMS API training materials first. The exercise code sample solution 3 can be downloaded here. After that, you may want to check out this intelligence landing page, it is a good example of usage of resource service. Please look at the source code, I believe you will find it very interesting. 

Download EN_AIMS_API_Chapter_3


Comments

4 responses to “Autodesk Infrastructure Map Server(AIMS) API Training content : Part-3”

  1. Do you have a way to control cover areas in infrastructure and hove they impact on existing ground. They should be controlled better so that the landscape can be molded better and more exact.

  2. Sorry but I do not understand your requirement. But it is possible to embed a base layer like Google Maps/Bing Map, etc to AIMS with flexible web layout. Not sure whether it is what your want to do…

  3. Dolf Despojo Avatar
    Dolf Despojo

    Hi Daniel, how do we integrate Google Maps or Google Earth Enterprise to AIMS? We are an electric utility and currently migrating our electrical facilities data from Mapguide 6.3 to AIMS 2013. But there is a need to align the same facilities data to a new base map which in our case is possibly Google Maps or Google Earth Enterprise.

  4. Integration with Google Map/Bing Map/Yahoo Map is part of built-in functionalites of AIMS 2013, you can set it up in Infrastructure Studio, and you need to use flexible web layout.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading