3

I'm using ArcGIS Pro 2.0 and I've updated my system path to point to the version of Python (3.5.3) which shipped with ArcGIS Pro.

FeaturesToJSON_conversion is well documented as including a parameter for exporting to geoJSON in the new version. The desktop version of ArcPy does not include this parameter which is why I upgraded.

I receive a 999999 error when specifying geoJSON='GEOJSON'. Just to be sure I'm using the right version of ArcPy I confirmed that it can take the parameter geoJSON='NO_GEOJSON'

I know how to do this with ogr2ogr -f GeoJSON but I was hoping to stay in ArcPy this week.


This gives error 999999:

arcpy.FeaturesToJSON_conversion("lyr", r"G:\GIS_Projects\Backups\json\myjsonfeatures.json", geoJSON='GEOJSON')


but this works fine:

arcpy.FeaturesToJSON_conversion("lyr", r"G:\GIS_Projects\Backups\json\myjsonfeatures.json", geoJSON='NO_GEOJSON')

2 Answers 2

3

I was able to reproduce your ERROR 999999 by running this code snippet:

import arcpy

arcpy.management.CreateFishnet(r"C:\Temp\TestProject\TestProject.gdb\PolyFC", "0 0", "0 1", 1, 1, 1, 1,
                               None, "LABELS", "DEFAULT", "POLYGON")
arcpy.management.MakeFeatureLayer(r"C:\Temp\TestProject\TestProject.gdb\PolyFC", "PolyFC_Layer")
arcpy.conversion.FeaturesToJSON("PolyFC_Layer", r"C:\Temp\TestProject\PolyFC_FeaturesToJSON.json",
                                "NOT_FORMATTED", "NO_Z_VALUES", "NO_M_VALUES", "GEOJSON")

to see:

Python 3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license()" for more information.

========================== RESTART: C:\Temp\test.py ========================== Traceback (most recent call last): File "C:\Temp\test.py", line 7, in "NOT_FORMATTED", "NO_Z_VALUES", "NO_M_VALUES", "GEOJSON") File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\conversion.py", line 367, in FeaturesToJSON raise e File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\conversion.py", line 364, in FeaturesToJSON retval = convertArcObjectToPythonObject(gp.FeaturesToJSON_conversion(*gp_fixargs((in_features, out_json_file, format_json, include_z_values, include_m_values, geoJSON), True))) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing_base.py", line 506, in return lambda *args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: ERROR 999999: Error executing function. Failed to execute (FeaturesToJSON).

>

Consequently, I think you should report it to Esri's Technical Support as a bug.

0
0

Please note that the FeaturesToJSON tool dose not fully support the GeoJSON Specification (RFC 7946) in ArcGIS Pro 2.1.1 or previous ArcGIS versions.

Here is a output example from ArcGIS Pro 2.1.1 that clearly illustrate how the GeoJSON Specification (RFC 7946) is not fully supported:

{
  "type" : "FeatureCollection",
  "crs" : {
    "type" : "name",
    "properties" : {
      "name" : "EPSG:3857"
    }
},

From Appendix B in RFC 7946 - The GeoJSON Format:

Appendix B. Changes from the Pre-IETF GeoJSON Format Specification This appendix briefly summarizes non-editorial changes from the 2008 specification [GJ2008].

B.1. Normative Changes

  • Specification of coordinate reference systems has been removed, i.e., the "crs" member of [GJ2008] is no longer used.
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.