Applies to: any Plex-Earth version Audience: End users
Overview
When trying to import a KML/KMZ file into Plex-Earth, you may encounter one of the following error messages:
Error 1:
"Not Well-Formatted KML"
Error 2:
"'gx' is an undeclared prefix" or "'xsi' is an undeclared prefix"
Both errors indicate that the KML/KMZ file has a malformed or non-standard structure that Plex-Earth cannot parse using its default import method. This is typically caused by manual editing of the KML file, or by the file being generated by a tool that uses a non-standard KML format.
Solution
Plex-Earth includes a legacy KML import mode that can handle non-standard or malformed KML files. To enable it:
- In the CAD command line, type:
PXV_VAR_KMLIMPORT_LEGACY
- Press Enter
- Set the value to YES
- Press Enter again
- Try importing your KML/KMZ file again
Still Having Issues?
If enabling the legacy import mode does not resolve the issue, the file may have a more complex formatting problem that requires further investigation. Contact our support team with the KML/KMZ file attached so we can investigate.
FAQs
What causes a KML file to be "not well-formatted"?
This usually happens when a KML file has been manually edited using a
text editor, or when it was created by a third-party tool that did not
generate a fully valid KML structure. Even small issues in the file's
internal formatting can prevent it from being parsed correctly. More
specifically, the error typically occurs when namespace prefixes such
as gx or xsi are used in the file but not properly
declared at the top of the XML structure — both are legitimate and widely
used prefixes, but if the required declarations are missing, the parser
cannot interpret them correctly. This type of issue is most common in
files that have been manually edited or exported from tools that do not
fully comply with the XML specification.
Will enabling PXV_VAR_KMLIMPORT_LEGACY affect other KML imports?
Yes — once set to YES, the legacy import mode will be used for all subsequent
KML/KMZ imports in that CAD session. If you want to revert to the standard
import mode, type PXV_VAR_KMLIMPORT_LEGACY again and set
the value back to NO.
My KML file was exported from Google Earth and it still won't import. Why?
Google Earth uses some non-standard KML extensions, particularly the
gx namespace, which is not part of the core KML specification.
Enabling the legacy import mode using
PXV_VAR_KMLIMPORT_LEGACY set to YES should
resolve this.
Can I fix the KML file manually instead of using the legacy mode?
In some cases, yes. If you are comfortable editing XML, you can open the KML file in a text editor and look for undeclared namespace prefixes or malformed tags. However, this requires technical knowledge and is not always straightforward. Using the legacy import mode is the simpler and recommended approach.
The legacy mode worked but some of my KML objects are missing after import. What should I do?
If some objects did not import correctly even with the legacy mode enabled, the file may contain object types or structures that are not supported by Plex-Earth's KML import. Contact us at support@plexscape.com with the KML/KMZ file and a description of what is missing so we can investigate further.
Related Questions
This article explains how to fix KML and KMZ import errors in Plex-Earth, including "Not Well-Formatted KML" and undeclared prefix errors. You may have searched for:
- Plex-Earth won't import KML or KMZ file
- "Not well-formatted KML" error when importing into AutoCAD
- "gx is an undeclared prefix" or "xsi is an undeclared prefix" error in Plex-Earth
- KML file from Google Earth not importing into Plex-Earth
- KMZ file import failing or showing a format error
- How to import a non-standard or manually edited KML file into Plex-Earth