0

I am creating a new layer out of an old one with MakeFeatureLayer_management like this:

arcpy.MakeFeatureLayer_management("layername", "newlayername", "DEPTH = 1200")

This works for the first time but if I want to execute the function on the same layer again (with a new out_layer and a different where clause) like this:

arcpy.MakeFeatureLayer_management("layername", "secondlayername", "DEPTH = 1400")

I get

Runtime error Traceback (most recent call last):
File "", line 1, in
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 5774, in MakeFeatureLayer
raise e ExecuteError: ERROR 000622: Failed to execute (Make Feature Layer). Parameters are not valid. ERROR 000628: Cannot set input into parameter in_features.

Also the auto completion for in_features no longer shows the used layer.

What can I do to fix this?

0

Based on the edits to your original question, try something like this:

import arcpy

input = "featureclass or shapefile"

arcpy.MakeFeatureLayer_management(input, "newlayer", "query")
arcpy.MakeFeatureLayer_management(input, "newlayer2", "query")

Make the input to the MakeFeatureLayer management tool the dataset rather than a layer created from the dataset.

  • I'm sorry I seem to have not phrased my question good enough: I want to create multiple new layers out of the original layer. Each layer will only have one where clause though. The problem is that for the second execution (with a different where clause but the same input layer) the input layer is no longer accesible – k-nut Dec 12 '14 at 14:05
  • I edited the question to hopefully make this a little clearer – k-nut Dec 12 '14 at 14:07
  • making the input a featureclass instead of a layer created from the dataset seems to have solved the problem. Thank you! – k-nut Dec 16 '14 at 12:26

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.