SuperMap iServer supports the following types of data service providers:
Configure UGC Data Provider.
Configure a UGC data provider as follows:
<provider name="ugcDataProvider1" class="com.supermap.services.providers.UGCDataProvider">
<config class="com.supermap.services.providers.UGCDataProviderSetting">
<workspacePath>../../samples/data/World/World.sxwu</workspacePath>
<disableFieldNameToUpperCase>false</disableFieldNameToUpperCase>
<defaultFieldForOrderBy>POP</defaultFieldForOrderBy>
<excludedFieldsInDatasources>
<com.supermap.services.providers.ExcludedFieldsInDatasource>
<dataSourceName>World</dataSourceName>
<!-- Set exclusion fields -->
<excludedFieldsInDatasets>
<com.supermap.services.providers.ExcludedFieldsInDataset>
<datasetName>Countries</datasetName>
<excludedFields>SMID,SmUserID</excludedFields>
</com.supermap.services.providers.ExcludedFieldsInDataset>
</excludedFieldsInDatasets>
<com.supermap.services.providers.ExcludedFieldsInDatasource>
</excludedFieldsInDatasources>
<!-- Delay in submitting configuration -->
<dataProviderDelayCommitSetting>
<enabled>false</enabled>
<logEntireErrorMsg>true</logEntireErrorMsg>
<dayOfWeek>1,2,3,4,5,6,7</dayOfWeek>
<hour>3</hour>
<minute>0</minute>
<commitMode>SPECIFICTIME</commitMode>
<countToCommit>1000</countToCommit>
<updateInterval>300</updateInterval>
<cachePath>/output</cachePath>
</dataProviderDelayCommitSetting>
<!-- Batch add element configuration -->
<maxFeatureWriteThreadCount>1</maxFeatureWriteThreadCount>
<writePermitTimeout>120</writePermitTimeout>
<!-- Set the information of the published data source dataset -->
<datasourceInfos>
<com.supermap.services.providers.FilteredDatasourceInfo>
<datasourceName>China</datasourceName>
<includedDatasetNames>
<string>World_Continent_pg</string>
<string>Island_B_pg</string>
<string>World_Ocean_txt</string>
</includedDatasetNames>
</com.supermap.services.providers.FilteredDatasourceInfo>
</datasourceInfos>
<isMultiInstance>false</isMultiInstance>
<isDatasetsCheck>true</isDatasetsCheck>
<ignoreTotalCount>false</ignoreTotalCount>
<videoStreamServiceInfo>
<serviceName>test</datasourceName>
<protocolName>HLS</protocolName>
</videoStreamServiceInfo>
</config>
</provider>
The class in < provider > identifies the implementation class of the UGC data provider, and the class identifies the configuration class corresponding to the UGC data provider, that is , UGCDataProviderSetting , and the content in < config > is the corresponding configuration item.
Among them, com.supermap.services.providers.ExcludedFieldsInDatasource、com.supermap.services.providers.ExcludedFieldsInDataset set implementation classes for field exclusion. <DataSourceName> is the name of the data source , <DatasetName> is the name of the dataset, <ExcludedFields> specify the fields to exclude.
- <dataproviderdelaycommitsetting>: Delayed submission settings for feature operations. When this setting is enabled, the system will delay the submission of the executed operation according to the set time after the editing operation is performed on the element. The parameter is optional. If it is not set, the edit operation of the feature will be submitted synchronously and take effect immediately. This parameter is available when the data is editable. Specific settings include:
- < enabled >: Whether to enable delay commit.
- < logEntireErrorMsg >: Whether to enable console error logging. When enabled, the detailed error message will be displayed on the console when an error occurs during an operation.
- < commitMode >: Set submission methods, including timed submission of SPECIFICTIME and intermittent submission of INTERVALUPDATE. Scheduled submission refers to batch submission at specific time points, which requires setting < dayOfWeek >, < hour >, < minute >. Interval submission refers to batch submissions made at regular intervals. The <updateInterval> parameter needs to be set.
- < countToCommit >: Max requests. This is valid when the submission method is INTERVALUPDATA. For example, if set to 1000 and the number of data editing requests reaches 1000 before the specified time, the system will automatically submit these operations.
- < dayOfWeek >: Set the update period. For example, < dayOfWeek > 1,3,5< /dayOfWeek > indicates that the executed operation is automatically submitted on Monday, Wednesday, and Sunday of each week. This parameter is available when the value of < commitMode > is SpecificTime.
- < hour >: Set the number of hours for commit time (24-hour format). The value of < commitMode > is SPECIFICTIME This parameter is available when.
- < minute >: Set the number of minutes for commit time. This parameter is available when the value of < commitMode > is SpecificTime.
- < updateInterval >: Commit interval, in seconds. For example, < updateInterval > 300 < /updateInterval > indicates that updates data every 300 seconds. When the parameter is available when < commitMode > is IntervalUpdate.
- < cachePath >: The storage address of the operation information. At the specified commit time, the system automatically submits these operation information files to the background to complete element editing.
- < maxFeatureWriteThreadCount >: The maximum number of concurrent access threads, default to 1, indicates that the maximum number of concurrent access threads is 1. This parameter is optional and used to configure the function of batch adding features. You can adjust the value based on the available resources of the server. Please note that this parameter should be less than the maximum number of connections to the database being used.
- < writePermitTimeout >: The timeout period for waiting to obtain write permission, measured in seconds, defaults to 120 seconds, indicating that waiting for more than 120 seconds to obtain write permission is considered a timeout. This parameter is optional and is used to configure the function of batch adding features.
- < datasourceInfos >: The data source information list can include 0 to multiple com. supermap. services. providers The Filters Data Source Info node.
- < com.supermap.services.providers.FilteredDatasourceInfo >: This node is an implementation class for setting the data source information to be published. Among them, information such as the name of the data source and the name of the dataset included can be set. Administrators can select some data sources or datasets to publish as needed. Specific parameter settings can be made according to the following situations:
a. When datasource name exists, you need to set:
- < datasourcename >: Datasource name.
- < includedDatasetNames >: Choose datasets to publish list.
b. When datasource name does not exist, you need to set:
- < connInfo >: data source connection info.
-
- < alias >:datasource alias.
- < engineType >: The engine type.
- < server >: Service.
- < database >: Name.
- < driver >: The name of the driver required for the data source connection.
- < password >: Password.
- < user >: User name.
- < connect >: Whether the data source automatically connects data.
- < exclusive >: Whether to open the data source exclusively.
- < openLinkTable >: Whether to add other non-SuperMaps in the database The data table opens as a LinkTable.
- < readonly>: read-only.
- < includedDatasetNames >: Filtered dataset list.
- < isDatasetsCheck >: Whether to enable data set check. After it is enabled, if the specified data set is not compliant (for example, the data source does not contain a data set, the data set under the data source does not contain a spatial table, and the data set name specified by the user does not exist), the data verification fails. The default is false。
- < isMultiInstance >: Whether to enable multiple instances of service. The default is false.
- < videoStreamServiceInfo >: Video streaming service information. When the workspace you publish contains a video dataset generated by importing local video files into SuperMap iDesktopX, it is recommended that you publish both video streaming services and data services. At this time, you need to set the video streaming service information in the data service configuration to bind the service and enable the client to load the video dataset normally.
- < serviceName >: The name of the video stream service.
- < protocolName >: The streaming protocol used in the published video stream. Currently only HLS is supported.
- < ignoreTotalCount >: Whether to ignore obtaining the total count value of the query result, which defaults to false. When set to true, the total count value of the query result will be ignored during data querying, and the number of query features will be returned based on the actual maxFeatures set.
Configure REST Data Service Providers
Configure a REST data service providers as follows:
<provider name="restMapProvider1" class="com.supermap.services.providers.RESTDataProvider">
<config class="com.supermap.services.providers.RESTDataProviderSetting">
<restServiceRootURL>http://localhost:8090/iserver/services/rest</restServiceRootURL>
<token>GsXST0cE0CumxQUFXBX7Oopin4<token>
</config>
</provider>
The class in < provider > identifies the implementation class of the REST data service provider, the class in <config > identifies the configuration class corresponding to the REST data service provider, that is, RestDataManagerSetting, the content in < config > is the corresponding configuration item:
- < restServiceRootURL >: The address of the REST data services, pointing to the root resource path of the service, such as http://localhost:8090/iserver/services/data-world/rest.
- < useCache >: Enable caching. The default is true. After enabling caching, REST requests for resources will be cached locally, and the next time the same request is received, it will be read directly from the cache without the need to send it to the server again.
- < restProviderCacheConfig >: The storage settings that service providers request to cache in memory, including:
- < maxElementsInMemory >: The maximum number of request records allowed to be stored in memory. 0 means no limit; 1 means no memory cache. The default is 1. If not 1, the request record is stored in memory first.
- < maxSizeOnDisk >: Maximum disk capacity. The unit is MB, and the default size is 2048 MB.
- < timeToLiveSeconds >: Set the upper limit of cache survival time, and the cache will be cleared automatically after timeout. It is calculated from the creation of the record, and the unit is second. The default is 0, which means that the cache is permanent.
- < timeToIdleSeconds >: Set the upper limit of cache idle time, and the cache will be cleared automatically after timeout. Calculated from the last time it was accessed, in seconds. The default is 0, which means the cache is permanently alive.
- < token >, < httpReferer >: When security mechanisms are enabled, accessing protected services requires providing a Token. If the token used is applied for through HTTP referee, the corresponding < httpReferer > needs to be set.
Configure ArcGIS REST Data Service Provider
Configure an ArcGIS REST data service providers as follows:
<provider class="com.supermap.services.providers.ArcGISRestDataProvider" enabled="true" name="arcgisRestDataProvider-test">
<config class="com.supermap.services.providers.ArcGISRestDataProviderSetting">
<restServiceRootURL>http://localhost:6080/arcgis/rest/services/SampleWorldCities/FeatureServer</restServiceRootURL>
<token>51fda53ceb25478cb37fa059ab013160</token>
</config>
</provider>
The class in <provider> identifies the implementation class of ArcGIS REST data service provider, the class in <config> identifies the configuration class corresponding to the ArcGIS REST data service provider, namely ArcGISRestDataProviderSetting, the content in <config> is the corresponding configuration item:
- < restServiceRootURL >: The address of the ArcGIS REST feature service, pointing to the root resource path of the service.
- < token >, < httpReferer >: When security mechanisms are enabled, accessing protected services requires providing a Token. If the token used is applied for through HTTP referee, the corresponding <httpReferer> needs to be set.
- <closePostMockGet>: Turn off sending requests to the original ArcGIS Feature service via POST mock GET requests. The default is false. It is recommended that you set this configuration to true when you provide an original ArcGIS Feature service that can only get information through GET request.
Configure WFS Data Service Provider
Configure a WFS data service providers as follows:
<provider class="com.supermap.services.providers.WFSDataProvider"
enabled="true" name="wfsDataProvider-test">
<config class="com.supermap.services.providers.WFSDataProviderSetting">
<serviceRootURL>http://localhost:8090/iserver/services/data-world/wfs100/utf-8</serviceRootURL>
</config>
</provider>
The class in < provider > identifies the implementation class of the REST data service providers, and the class in < config > identifies the configuration class corresponding to the REST data service provider, that is , WFSDataProviderSetting , and the content in < config > is the corresponding configuration item:
- < serviceRootURL >: The access path of the WFS data services.
- < idMappingClassName >: Feature ID converter class name. The conversion rules for element IDs vary depending on the implementation of different WFS services. Therefore, when accessing a WFS service, a featureID converter is required to establish a one-to-one mapping between the element IDs of the WFS service and integers. SuperMap iServer defaults to converting the last digit of the WFS service element ID to an integer as the element ID value. When customizing conversion rules, it is necessary to implement the FeatureIDMapping interface.
Configuration GeoPackage Data Service Providers
Configure a GeoPackage data service providers as follows:
<provider class="com.supermap.services.providers.GeoPackageDataProvider" enabled="true" name="gpkgData-samplevectors">
<config class="com.supermap.services.providers.GeoPackageDataProviderSetting">
<filePath>../../samples/sample_vectors.gpkg</filePath>
</config>
</provider>
The class in < provider > identifies the implementation class of GeoPackage data service providers, and the class in <config> identifies the configuration class corresponding to the GeoPackage data service provider, that is, GeoPackageDataProviderSetting, and the contents in < config > are the same as GeoPackageDataProviderSetting The configuration items in correspond to:
- < filePath >: The path to the GeoPackage database file.
Configure Shapefile Data Sservice Provider
Configure a Shapefile data service providers as follows:
<provider class="com.supermap.services.providers.ShapefileDataProvider" enabled="true" name="shapefileData-">
<config class="com.supermap.services.providers.ShapefileDataProviderSetting">
<shpDir>E:/supermap/data/shp</shpDir>
<charset>UTF-8</charset>
</config>
</provider>
The class in < provider > identifies the implementation class of the Shapefile data service providers, and the class in <config> identifies the configuration class corresponding to the Shapefile data service provider, that is, ShapefileDataProviderSetting, and the contents in < config > are the same as ShapefileDataProviderSetting The configuration items in correspond to:
- < shpDir >: Path to the Shapefile data file.
- < charset >: Set the encoding format.
Configuring PostGIS Data Service Providers
PostGIS data service providers are configured in the < provider > node. The specific configuration is as follows:
<provider class="com.supermap.services.providers.PostgisDataProvider" enabled="true" name="data-postGIS">
<config class="com.supermap.services.providers.PostgisDataProviderSetting">
<dbType>postgis</dbType>
<host>192.168.17.212</host>
<port>5432</port>
<database>postGIS</database>
<schema>public</schema>
<user>postgres</user>
<passwd>iserver</passwd>
<isDatasetsCheck>true</isDatasetsCheck>
<!-- Set the information of the published data source dataset -->
<datasourceInfos>
<com.supermap.services.providers.FilteredDatasourceInfo>
<datasourceName>test</datasourceName>
<includedDatasetNames>
<string>test_pg</string>
<string>test_B_pg</string>
<string>test_Ocean_txt</string>
</includedDatasetNames>
</com.supermap.services.providers.FilteredDatasourceInfo>
</datasourceInfos>
</config>
</provider>
The class in < provider > identifies the implementation class of PostGIS data service providers, and The class in <config> identifies the configuration class corresponding to the PostGIS service provider. Class identifies the configuration class corresponding to the PostGIS service providers, that is, PostgisDataProviderSetting, and the content in < config > corresponds to PostgisDataProviderSetting Corresponding configuration item:
- < dbType >: Database type.
- < host >: The address of the PostGIS server.
- < port >: The port number of the PostGIS server.
- < database >: The database used to store the data to be published.
- < schema >: The schema of the postgis service, which supports the use of table data in modes other than public.
- < username >: The user name that has access to the database.
- < password >: The password for the user.
- < isDatasetsCheck >: Whether to enable data set check. After it is enabled, if the specified dataset is not compliant (for example, the dataset is null, the dataset name is incorrect, etc.), the data verification fails. The default is false.
- < datasourceInfos >: Data source information list, which can contain 0 to multiple com.supermap.services.providers.FilteredDatasourceInfo nodes.
- < com.supermap.services.providers.FilteredDatasourceInfo >: This node is the implementation class for setting the data source information to be published. Here, you can set information such as the datasource name and the included dataset name. The administrator can select some data sources or data sets to publish as required. Parameters can be set according to the following conditions:
-
- < datasourcename >: Datasource name.
- < includedDatasetNames >: Choose datasets to publish list.
Configure Elasticsearch Service Provider
The Elasticsearch service providers is configured in the < provider > node. The specific configuration is as follows:
<provider class="com.supermap.services.providers.ElasticsearchDataProvider" enabled="true" name="data-es">
<config class="com.supermap.services.providers.ElasticsearchDataProviderSetting">
<maxfeatures>1000</maxfeatures>
<connInfo>
<serverAdresses>
<string>https://127.0.0.1:9200</string>
</serverAdresses>
<clusterName>my-application</clusterName>
<indexName>i-1VLKvgQhmAYdIwI7tfkg</indexName>
<username>node</username>
<password>123456</password>
</connInfo>
</config>
</provider>
The class in < provider > identifies the implementation class of the Elasticsearch service providers, and the class in <config> identifies the configuration class corresponding to the Elasticsearch service provider, that is, the ElasticsearchDataProviderSetting, and the content in < config > corresponds to configuration item corresponding to ElasticsearchDataProviderSetting:
- < Max features >: The maximum number of returned features. The default is 1000.
- < Server Adresses >: The address of the Elastics earch server, which supports the configuration of two types of protocols.
- < string >: Server address string. When using Elasticsearch service with HTTPS protocol, fill in something similar to https://127.0.0.1:9200; When using the Elasticsearch service with HTTP protocol, fill in the form 127.0.0.1:9200 or http://127.0.0.1:9200.
- < clustername >: Cluster name.
- < indexName >: Index.
- < username >: The username with access to the database. When using Elasticsearch service with HTTPS protocol, this parameter is mandatory.
- < password >: The user's password. When using Elasticsearch service with HTTPS protocol, this parameter is mandatory.