Tag Archives: ArcGIS

ArcGIS API for JavaScript version 4. X updated and the project startup error: Module parse failed: Unexpected token(… …

 

Question:

When using the project created by vue and webpack, after the ArcGIS API for JavaScript 4. X is upgraded from a lower version to a higher version, problems occur in building the project:

Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type…

error  in ./node_modules/@arcgis/core/views/3d/layers/SceneLayerWorker.js
Module parse failed: Unexpected token (5:673)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| See https://js.arcgis.com/4.24/esri/copyright.txt for details.
| */

Reason:

The new version of the ArcGIS API references the new version of ES2020 optional chaining and nullish coalescing, resulting in parsing errors in the old version of Webpack, so you need to install the appropriate dependencies or upgrade the framework.

Solution:

1. Download Dependencies

Download the corresponding dependencies through the command

npm install -D @babel/core @babel/plugin-proposal-nullish-coalescing-operator @babel/plugin-proposal-optional-chaining babel-loader

Or add the following codes in package.json, and then initialize npm install

 "@babel/core": "^7.18.9",
 "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
 "@babel/plugin-proposal-optional-chaining": "^7.18.9",
 "babel-loader": "^8.2.5",

2. Add Configuration

Find the webpack.config.js file and add the following codes below

   module: {
     rules: [
       {
         test: /\.m?js$/,
         exclude: {
           and: [/node_modules/],
           not: [/@arcgis[\\/]core/]
         },
         use: {
           loader: "babel-loader",
           options: {
             plugins: [
               ["@babel/plugin-proposal-nullish-coalescing-operator", { loose: true }],
               ["@babel/plugin-proposal-optional-chaining", { loose: true }]
             ]
           }
         }
       }
     ]
   }

Note: If your project is using the vue1 framework, i.e. you can’t find the webpack.config.js file, then you need to configure the configureWebpack configuration item in the vue.config.js file.

3. Restart the project

The python script tool of ArcGIS reports an error: indentationerror: unexpected indent solution

Background

At the beginning, I wrote an ArcGIS Python script, which is an independent script. I ran it in Python and ran it successfully. But if you put this script in the ArcGIS toolbox, it won’t work properly. The following errors are reported.

IndentationError: unexpected indent。

  The above figure is an article from Baidu experience. Because there was no screenshot at that time, I didn’t bother to reproduce this problem again…

Find solutions

Code indentation problem

When searching for this error report on Baidu, most of the answers are to ask you to find the indentation problem and space problem in the code. As in the article from the above figure.

The problem is that my code can run successfully in pycharm, and I checked the code several times and found no problem…

Chinese in code (including Chinese in notes)

I use ArcGIS 10.2 and python version is 2.7. This version of Python doesn’t support Chinese very much, but generally you can run normally by adding # coding = UTF-8 at the beginning of the code in the python environment.

# coding=utf-8

There is a Chinese comment on the last line of the wrong line of my code. So I tried to remove that line of Chinese notes and succeeded

Summary

1. If the python script of ArcGIS does not need Chinese, do not use Chinese

2. If you have to use Chinese, you can consider adding # coding: cp936 at the beginning of the script code

 

Error 999999: error executing function

Today, when arcGIS is used for projection, it is mainly carried out in the WGS84 coordinate system.

But ArcGIS kept reporting errors.

Compared with various methods, this problem has not been solved.
And then finally, with the guidance of the great God, we found the root of the problem, it turned out that the latitude and longitude had been reversed, and the projection had to be longitude, latitude, something like that.
Let’s make sure that this doesn’t happen again.

ArcGIS Earth 1.7 beta installation method-solve the 0X80070057.DirectX device creation failed problem

Recently, ArcGIS Earth 1.7 beta was released. It tried to install the flagship version of Windows 7 on LAN PC. After an afternoon’s attempt, the installation was finally successful.
1. Download ArcGIS Earth 1.7 Beta
Download: Download address
64 – bit
2. After installation, error report: 0X80070057.DirectX device Creation failed
3. It was assumed that the Invidia video card driver was not installed properly, but the video card was GTX 1050 TI
Go to nvidia’s website to download the latest graphics driver: download address
4. After installation, still report an error. DrectX 11 has no problem by running the DirectX diagnostic tool (CMD — DXDIAG).
5. Maybe the LAN computer system is not patched, so download the patch: patch download
After installing Windows 6.1-KB2670838-x64.mSU, the problem is resolved.
 

The registered version of ArcEngine can edit the data in SDE (How to Fix 0x80040356 Error)

1, the problem put forward

in my last post (ArcGIS edits SDE’s vector data (set) (fixes versioning issues)) solved the unregistered uneditable problem of editing SDE in ArcGIS, and the same idea can be solved in ArcEngine. This is a relatively simple problem, so to make it longer, I’ve put together a post on my usual approach to solving the ArcEngine problem, skipping the second part if I’m in a hurry.

2. Solution </h2 b>

I have always believed that a problem the best solution for the first is to help document, the second is baidu Google, so in after already know how to solve the problems in ArcGIS can look up relevant content in the help document, we search “RegisterAsVersioned” in the help document, the following results were obtained:

This tells us that we should call the “IVersionedObject” interface, as ArcGIS always does, and of course the latest interface, IVersionedObject3.

we focus to the next object model diagram (installation under the path of ao), the interface is in ESRI ArcGIS. Geodatabase namespace, so you can open “GeoDatabaseObjectModel”, search IVersionedObject3, get this interface is here, this is an abstract class:

so we can to implement it like this: </ p>

IVersionedObject3 versionedObject = pDataSet as IVersionedObject3;

The next steps for

are basically the same as in arcgis.

3. Code implementation: </h2 b>

I find a lot of information on the net, most of these code editing mode setting is not only the versioning patterns, but did not say how version, so, first to determine whether the data set is already registered version, if the registered version set directly edit mode without versioning editor, otherwise, you need to first register edition to edit. By this logic, the code should look like this:

                if (pWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    IVersionedObject3 versionedObject = pDataSet as IVersionedObject3;
                    if (versionedObject != null && !versionedObject.IsRegisteredAsVersioned)
                    {
                        versionedObject.RegisterAsVersioned(true);
                    }
                    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
                }
                //else
                //{
                //    pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
                //}
                pEngineEditor.StartEditing(pWorkspace, pMap);

if you edit the sde data set update without a registered version, an error is reported: HRESULT:0x80040356