Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've got data from all over Europe in one feature class projected in Web Mercator Auxiliary Sphere. Due to the fact, that length and area values are not usable I'm now working on a python script (ArcGIS 10.0) that projects the features to the corresponding UTM zones and writes the calculated values back to the orginal fc.

First the script assigns the corresponding UTM zone to each feature via spatial join with an UTM zone fc. Within the next step I'd like to select all features within one UTM zone and project them (e.g. all features with value 32 will be projected to UTM ETRS89 zone 32 and so on). My problem is, that project_management does not have a "where_clause" so what will be the best way to make this selection? I've got lot's of data in one feature class and many feature classes, so speed does matter...

If anybody knows a better way to get precise length and area values for data in Web Mercator projection, please let me know!

Thanks in advance!

share|improve this question
    
Have you tried using the Select tool which has a where_clause before each Project and tried doing the processing in_memory? –  PolyGeo Aug 15 '13 at 11:55
    
Actually not - sometimes it can be so easy ;-). I've already thought of using a SearchCursor (but didn't really now how to proceed then) or creating a feature layer (but haven't got any experiences with feature layers in python and don't now how to proceed with them) which both support where_clauses. I also wanted to avoid creating many temporary files... But the in_memory hint seems to be very useful to speed up things. Thank you very much! Anybody better ideas how to cope with accuracy problems within Web Mercator data? –  ateko Aug 15 '13 at 12:10
add comment

1 Answer

I would try to this approach (I have not test it). With this approach you do not have to create new feature classes.

  1. Run your script to fill your field utm_zone
  2. Add 2 fields (e.g. area_utm and length_utm)
  3. In Environment Setting set OutputCoordinate System to UTM 32. (And set also a Geographic Transformations in Environment Setting).
  4. Select By Attribute all features in one spezific zone (e.g. for zone 32)
  5. Calculate length and area (only for selected features) with Calculate Field Tool. Use !shape.area! and !shape.length! for calculation. The Calculate Field Tool should use the UTM 32 Sytem you set in Environmet Settings.
  6. Loop through step 3 to 6 for the other UTM zones
share|improve this answer
    
This sounds pretty good. We already have these fields (AREA_DY, LENGTH_DY, EASTING_DY, NORTHING_DY) but as far as I know I cannot use the Calculate Field Tool within a python script?! The python script should run each night within a batch process because we have also users editing data via an web application without special tools like the Calculate Field Tool and therefore need a workflow to ensure that we have correct length and area values for all features in our SDE. –  ateko Aug 15 '13 at 12:58
    
Are you sure that Calculate Field Tool does not run within a python script? Here are some code examples (see section CalculateField example: Calculate centroids) of this tool running within a python script. –  Jens Aug 15 '13 at 13:05
    
Ok, today I'm feeling like a complete beginner, but I think you are right. This seems to be the most elegant way to calculate the correct values. I will give you a feedback as soon as I've had the time to test this solution... –  ateko Aug 15 '13 at 13:29
    
I've had the time to test this approach but getting stuck at point 4. "Select Layer By Attribute" needs a feature layer as input, but I'm having a feature class, so I've tried Make Feature Layer with a temporary "in_memory" output layer. Unfortunately the "Calculate Field" tool does not support feature layer. If I use my unfiltered fc instead of the layer as input for the Calculate Field tool the values will be calculated, but still in Web Mercator, so the Environment Settings are not being considered... –  ateko Sep 3 '13 at 10:59
    
some ideas you can try: 1) do not use Create Feature Layer and Select By Attributes. Instead make query inside Calculate Field (example of if-else-then in “CalculateField example: Calculate ranges”). 2) do not use Select By Attribute. Instead make a query in Make Feature Layer (where_clause option in Make Feature Layer). According to help a feature layer is a valid input for calculate field tool. –  Jens Sep 6 '13 at 6:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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