2

I have a table in a native SQL database (no geodatabase, dc_geobank_public.sde in the code) with cca. 300 000 records and 18 fields. Two of the field contains projected X and Y coordinates, and one field contains geometry with SQL geometry type. The spatial index is rebuilt regularly with default parameters in MS SQL Server. The projection code is EPSG:23700. Based on this data I would like to create and update a feature class in a geodatabase (dc_geobank_map.sde in the code) on a daily basis.

So far I have written the following script, and it does the job, but clicking on the table in ArcCatalog and using the "Create table... from XY data" runs 100 times faster. (The script runs for 6 hours, and the "Create table... from XY data" tool runs for 3 minutes). Here is the script:

#importing arcpy library
import arcpy
#define workspace, this is the native SQL database
arcpy.env.workspace = r"C:\scripts\dc_geobank.sde"
print "changed workspace!"
#we let the script overwrite existing feature class
arcpy.env.overwriteOutput = True
print "output overwrite set!"
#creating xy event layer from table
arcpy.MakeXYEventLayer_management("geobank.dbo.FRS_fullos","EOV_X","EOV_Y","furasxy","23700")
print "eventlayer ready!"
#change workspace, that's where the feature class should be created, and THIS is a geodatabase
arcpy.env.workspace = r"C:\scripts\dc_geobank_map.sde"
print "changed workspace!"
#convert event layer to feature class
arcpy.CopyFeatures_management("furasxy","furas")
#project the feature class to Web Mercator projection
arcpy.Project_management("geobank_map.DBO.furas"","furasprojected","3857")

Anyone knows what the "Create feature class from XY data" tool might use that's so much faster? So far I am not making use of the geometry field, but I guess it should be useful.

EDIT: For better understanding of the issue: later on I would like to make a map service and a web mapping application based on this feature class. So my question:

How to make a feature class from the table faster?

I am on the 10.2.1 ArcGIS stack.

asked Jul 1, 2015 at 11:29
2
  • Please edit the question to: explain why you aren't using the geometry column in a Query Layer, clarify how you can have "no geodatabase" and add a simple feature class to the connection, include what you meant in the deleted comment about multiple projections, and make this question ask a single question, as per GIS SE policy. Commented Jul 3, 2015 at 10:33
  • I don't use Query Layer because it is slower in rendering, than a feature class. As it can be seen from the script, it is two seperate connection. One is geodatabase, other is native sql database. The answer for the rest of your questions is in my edited queestion, too. Commented Aug 6, 2015 at 11:24

1 Answer 1

1

The solution was to use a SearchCursor and an InsertCursor to copy the data from the event layer to the feature class. This solution was found here.

It is multple times faster than the arcpy.CopyFeatures_management tool.

answered Feb 8, 2016 at 14:13

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.