MapGuide Application Development Series (10) -- what is a resource?

Source: Internet
Author: User

 

Resource Autodesk has published an official document and we have published it on the forum. Because it is an English version, it is easy for domestic MapGuide developers to read. I will translate it here and add my personal understanding.

MapGuide has a powerful set of APIs to manipulate resources, such as element sources, maps, layers, and webpage la S. By using Resource Service APIs, MapGuide-based applications can create dynamic topic charts, filter data, create layers, and provide a better user experience.

 

What are resources and what are the functions of resources and resource services?

When talking about Resource service, first we need to introduce what is Resource ). Resources in MapGuide are actually the Feature Source represented in xml documents, the Drawing Source, layers, maps, and the user interface of MapGuide browser, that is, WebLayout. Correct understanding of the concept of resources is the key to programming the MapGuide-based resource service in the future. Here we will focus on how to manipulate resources in the MapGuide application so that you can dynamically add layers, change the filtering conditions or style of layers, or customize maps or WebLayout.

 

What are resource and resource databases?

MapGuide stores Layer Definition, Map Definition, DataSource Connection, Symbol Definition, and WebLayout in the resource database as XML. The organization of resources in the resource database is a bit like a file system, which is also organized and stored in hierarchical directory. Each Resource has two basic components: Resources Header and Resource Content. The Resource Content is the XML mentioned above, and the Resource Header is the description of the Resource Content, which is also an xml file, the access permission of the resource. In addition to the Resource header and content, there is also a concept of Resource Data ). Resource data is the part that contains real data. It may be a file, a string, or a byte stream. It is also common to understand the file situation. For example, my SDF file and SHP file may be the resource data of the Feature source resource; resource Data is a string. Generally, it is only applicable to FDO Data Connection. For example, you can connect to a database such as Oracle or SQL Server through FDO and save it in Resource Data) the authentication information, including the user name and password, is protected. for resources such as Symbol, resource data is a byte stream.

 

There can be a reference relationship between resources. For example, a Map consists of a series of layers, that is, Map Definition can reference Layer Definition. The following figure shows the reference relationship between resources.

 

Permanent and Temporary resource libraries

Resource databases are classified into two types. One is permanent. They are stored in the hard disk of the MapGuide Server. We call it Library Repository ). We can use MapGuide Studio to create, modify, and delete database warehousing. There is also a temporary resource called Session repository ). Regardless of database warehousing or session warehousing, we can use the Resource Service (ResourceService API) of MapGuide WebExtension API to create, modify, and delete resources.

How is the resource represented? We need a resource ID (ResourceIdentifier). The basic format is as follows:

RepositoryType: [RepositoryName] // [ResourcePath/] [ResourceName. ResourceType]

As mentioned above, there are two types of warehousing: Library and Session. Let's look at several resource ID examples:

Library: // MyStuff/MyLayer. LayerDefinition indicates a layer that defines resources under the MyStuff directory of the Library;

Session: {SessionId} // TempLayer. LayerDefinition indicates a temporary layer resource in the Session repository.

Library: // MyFolder/indicates a directory in the repository. Note that the last slash is necessary.

 

Well, this time we will focus on the basic concepts of resources and resource warehousing, and correctly understand these concepts. In the future, it will be very helpful for us to develop resources using Resource Service APIs correctly. If you have any questions, please comment below or go to the MGDN forum to discuss them.

 

Daniel Du)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.