【发布时间】:2020-09-30 20:56:01
【问题描述】:
我正在尝试使用 GIS 数据构建地图数据 React 应用程序。我正在访问公共 GIS 端点。
端点是http://gis.infrastructure.gov.au/infrastructure/rest/services/KeyFreightRoute/KFR/MapServer/0
在本地开发方面,它运行良好。但是,一旦推送到现场,它就会返回错误:net::ERR_CONNECTION_REFUSED。因为它是一个 HTTP 端点。
The ArcGIS docs describe a solution 使用配置,我已经包含以下代码:
esriConfig.request.interceptors.push({
// set the `urls` property to the URL of the FeatureLayer so that this
// interceptor only applies to requests made to the FeatureLayer URL
urls: featureLayerUrl,
// use the BeforeInterceptorCallback to check if the query of the
// FeatureLayer has a maxAllowableOffset property set.
// if so, then set the maxAllowableOffset to 0
before: function (params) {
if (params.requestOptions.query.maxAllowableOffset) {
params.requestOptions.query.maxAllowableOffset = 0;
}
},
// use the AfterInterceptorCallback to check if `ssl` is set to 'true'
// on the response to the request, if it's set to 'false', change
// the value to 'true' before returning the response
after: function (response) {
if (!response.ssl) {
console.log('not ssl');
response.ssl = true;
}
},
});
但是,它仍然无法正常工作!?事实上,console.log('not ssl') 甚至没有登录实时站点(但它正在登录 localhost)。
如何访问 HTTP GIS 端点?
【问题讨论】:
标签: rest http arcgis arcgis-js-api arcgis-server