0

When I create a kml file from an ArcGIS Pro layer using "arcpy.LayerToKML_conversion" all objects are shown in Google Earth Places (left pane) with [no name]. The piece of code doing this is as simple as this:

fc_node_live_available = os.path.join(working_folder, 'DATA\Optimity_Equipment.gdb', 'Node_Live_Available')
kml_node_live_available = os.path.join(out_path, 'Node_Live_Available.kmz')
arcpy.MakeFeatureLayer_management(fc_node_live_available, 'Node Live Available')
arcpy.LayerToKML_conversion('Node Live Available', kml_node_live_available, is_composite = 'NO_COMPOSITE', ignore_zvalue = 'ABSOLUTE')

However, when I do the same thing using the tool box ('Layer to kml' tool). Objects will show their name in Google Earth when importing the kml file.

Is there anything I am missing on my arcpy code?

  • If you right click the result from the results tab after running manually from the toolbox and select copy as python snippet, can you see any difference between your code and the copied snippet? – user2856 Apr 25 '18 at 12:44
  • No difference. Actually I found a weird way to make it work. If I first create the map layers I need (using a script) and later on I convert to KFL (with a DIFFERENT script), it works fine (names appear on Google Earth). If I do both things on the same script, it doesn't work ([no name] appears on Google Earth). I don't have the faintest idea of why this is behaving that way. – Pitrako Junior Apr 26 '18 at 7:40
  • What about lyr = arcpy.MakeFeatureLayer_management(etc...).GetOutput(0) then arcpy.LayerToKML_conversion(lyr, etc...) ? – user2856 Apr 26 '18 at 7:57
  • Sorry, getOutput pro.arcgis.com/en/pro-app/arcpy/classes/result.htm – user2856 Apr 26 '18 at 11:06
  • Just realised before you added the comment and deleted my comment :-) – Pitrako Junior Apr 26 '18 at 11:07

Your Answer

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

Browse other questions tagged or ask your own question.