TransWikia.com

Arcpy doesn't put shapefiles in another database despite being defined

Geographic Information Systems Asked by Berke Şentürk on October 24, 2020

I’m trying to calculate the meancenter of a pharmacies in Istanbul file by grouping with the case field "ilce_adi" which means neighbourhood’s name. It works well but despite being defined, it does not put the output shapefiles into a new geographic database. Here is my script.

import arcpy
import time
 

input_FC = r"C:ScriptDatadata.gdbpharmacies"
CF_output = "pharmacies_CENTRALFEATURE.shp"
MEAN_output = "pharmacies_MEANCENTER.shp"

CASE_Field = "ilce_adi"

arcpy.env.overwriteOutput = True
arcpy.env.workspace = r"C:ScriptDataprocess.gdb"



print"The script is working.."

start_time = time.time()

             
arcpy.CentralFeature_stats(input_FC, CF_output, "Euclidean Distance", "#","#",CASE_Field)

arcpy.MeanCenter_stats(input_FC, MEAN_output, "#",CASE_Field,"#")

end_time = time.time()
process_time = end_time - start_time

print "Script is done in {:.2f} seconds".format(process_time)


One Answer

It looks like you did not set the output path. A shapefiles are to be saved inside folder. Use the following as outputs

import os
input_dir = r"C:ScriptData"
CF_output =os.path.join(input_dir, "pharmacies_CENTRALFEATURE.shp")
MEAN_output = os.path.join(input_dir,"pharmacies_MEANCENTER.shp")

the outputs will be saved here:

'C:ScriptDatapharmacies_CENTRALFEATURE.shp'
'C:ScriptDatapharmacies_MEANCENTER.shp'

Answered by Herve H on October 24, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP