www.it-ebooks.info ffirs.indd iiffirs.indd ii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info BEGINNING ARCGIS® FOR DESKTOP DEVELOPMENT USING .NET INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi PART I THE BASICS CHAPTER 1 Why Geospatial Is Special . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 CHAPTER 2 Introduction to ArcGIS for Desktop Applications Customization . . . . . 35 PART II .NET PROGRAMMING FUNDAMENTALS CHAPTER 3 .NET Programming Fundamentals, Part I . . . . . . . . . . . . . . . . . . . . . . . . . . 63 CHAPTER 4 .NET Programming Fundamentals, Part II . . . . . . . . . . . . . . . . . . . . . . . . 103 PART III ARCOBJECTS PROGRAMMING CHAPTER 5 Understanding ArcObjects Object Model Diagrams . . . . . . . . . . . . . . 139 CHAPTER 6 Accessing Maps and Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 CHAPTER 7 Working with Tables and FeatureClasses . . . . . . . . . . . . . . . . . . . . . . . . 197 CHAPTER 8 Subsets of Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 CHAPTER 9 Constructing and Using the Geometry of Features . . . . . . . . . . . . . . . . 257 CHAPTER 10 Rendering Geospatial Data and Using Hyperlinks and MapTips . . . . 295 CHAPTER 11 Labeling, Exporting ActiveView, and Working with Elements . . . . . . . 327 CHAPTER 12 Geoprocessing with Tools and Models . . . . . . . . . . . . . . . . . . . . . . . . . . 365 CHAPTER 13 Feature Data Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 CHAPTER 14 Advanced Topics in ArcObjects Programming and Deployment . . . . 429 APPENDIX Answers to Chapter Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 ffirs.indd iffirs.indd i 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info ffirs.indd iiffirs.indd ii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info BEGINNING ArcGIS ® for Desktop Development Using .NET ffirs.indd iiiffirs.indd iii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info ffirs.indd ivffirs.indd iv 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info BEGINNING ArcGIS ® for Desktop Development Using .NET Pouria Amirian ffirs.indd vffirs.indd v 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info This edition rst published 2013 © 2013 John Wiley & Sons, Ltd. Registered of ce John Wiley & Sons Ltd, The Atrium, Southern Gate, Chichester, West Sussex, PO19 8SQ, United Kingdom For details of our global editorial of ces, for customer services and for information about how to apply for permission to reuse the copyright material in this book please see our website at www.wiley.com. The right of the author to be identi ed as the author of this work has been asserted in accordance with the Copyright, Designs and Patents Act 1988. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, except as permitted by the UK Copyright, Designs and Patents Act 1988, without the prior permission of the publisher. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Designations used by companies to distinguish their products are often claimed as trademarks. All brand names and product names used in this book are trade names, service marks, trademarks or registered trademarks of their respective owners. The publisher is not associated with any product or vendor mentioned in this book. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold on the understanding that the publisher is not engaged in rendering professional services. If professional advice or other expert assistance is required, the services of a competent professional should be sought. Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and speci cally disclaim all warranties, including without limitation warranties of tness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read. Trademarks: Wiley, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its af liates, in the United States and other countries, and may not be used without written permission. ArcGIS is a registered trademark of Esri in the United States and other countries. All other trademarks are the property of their respective owners. John Wiley & Sons, Ltd. is not associated with any product or vendor mentioned in this book. A catalogue record for this book is available from the British Library. 978-1-118-44254-8 (paperback) 978-1-118-44253-1 (ebook) 978-1-118-44255-5 (ebook) 978-1-118-44252-4 (ebook) Set in 9.5 /12 Sabon LT Std Roman, by MPS Limited, Chennai, India. Printed in the United States by Bind-Rite ffirs.indd viffirs.indd vi 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info To the best mother and father in the whole world, Nosratolah and Soghra To the best wife in the solar system, Ana To the best sister and brother in the Milky Way, Paria and Payam ffirs.indd viiffirs.indd vii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info ffirs.indd viiiffirs.indd viii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info [...]... 25/02/13 12:33 PM INTRODUCTION REQUIRED SOFTWARE PACKAGES FOR THIS BOOK TITLE PACK AGE GIS software ArcGIS for Desktop 10.1 or ArcGIS Desktop 10.0 Integrated Development Environment For ArcGIS for Desktop 10.1: all versions of Visual Studio 2010 Software Development Kit ArcObjects SDK for NET For ArcGIS Desktop 10.0: all versions of Visual Studio 2008 and all versions of Visual Studio 2010 except Visual... (service pack 1), which is installed with ArcGIS for Desktop 10.0 and 10.1 You also need an Integrated Development Environment (IDE) to be able to write code You can use any IDE from Microsoft that supports NET 3.5 sp1 The following is a list of available IDEs that can be used to develop add-ins for ArcGIS Desktop 10.0 and ArcGIS for Desktop 10.1: ➤ Supported IDEs for version 10.0: ➤ ➤ ➤ All editions of Visual... approaches for storing and managing geospatial data ➤ Chapter 2, “Introduction to ArcGIS for Desktop Applications Customization”: Chapter 2 looks at different approaches for customizing ArcGIS for Desktop applications It introduces techniques for customizing the user interface, Python scripting, Desktop Add-Ins, and extending ArcObjects For each approach, I present at least one Try It Out example to show you... code used in this book is available for download in both C# and VB.NET at www.wrox.com (for more information, see the “Source Code” section later in this introduction) WHAT THIS BOOK COVERS This book walks you through ArcGIS development from the very fi rst steps to the deployment phase You will learn that it is a simple task to customize and develop ArcGIS for Desktop applications — this process isn’t... 12:33 PM INTRODUCTION This book uses the latest version of ArcGIS, which is ArcGIS 10.1 All the code examples are tested to work in version 10.0 as well The focus of this book is on creating a new model of ArcGIS customization: the Desktop Add-In (or add-in for short) Unfortunately, the add-in model is not available for previous versions of ArcGIS (8.x and 9.x) However, if you have one of the older... eye-opening experience It is time for expressing my feelings that never can be told using words I am the luckiest person in the whole world because I have the greatest parents I want to thank them for countless reasons: for always listening patiently, for their constant support, and for always being by my side Also, I am so grateful to my father- and mother-in-law for all they do for Ana and me I owe my life... can read messages at any time on the web If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing For more information about how to use the Wrox P2P, read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specific to P2P and Wrox books To read the... Geodatabase 19 19 20 20 21 21 23 30 Personal Geodatabase File Geodatabase ArcSDE Geodatabase 30 30 31 Summary 32 CHAPTER 2: INTRODUCTION TO ARCGIS FOR DESKTOP APPLICATIONS CUSTOMIZATION Four Ways to Customize ArcGIS for Desktop Customizing the User Interface Scripting Desktop Add-Ins ArcObjects SDK Summary 35 36 37 41 48 55 59 www.it-ebooks.info ftoc.indd xv 25/02/13 4:06 PM CONTENTS PART II: NET PROGRAMMING... you will see different approaches for customizing ArcGIS for Desktop applications ➤ Chapter 1, “Why Geospatial Is Special”: This chapter shows you some unique characteristics of geospatial data Then it explains the different kinds of GIS software and provides a high-level survey of the ArcGIS platform The chapter fi nishes with an overview of the major approaches for storing and managing geospatial... xx 25/02/13 4:06 PM INTRODUCTION WELCOME TO Beginning ArcGIS for Desktop Development Using NET If you have always wanted to start your journey in the world of ArcObjects, this book is your perfect one-stop resource Whether you are a new ArcGIS user with no background in programming or a programmer with a little experience in the ArcGIS platform, this book helps you be more productive This book starts . iiffirs.indd ii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info BEGINNING ARCGIS FOR DESKTOP DEVELOPMENT USING .NET INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . iiffirs.indd ii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info BEGINNING ArcGIS ® for Desktop Development Using .NET ffirs.indd iiiffirs.indd iii 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info ffirs.indd. ivffirs.indd iv 26/02/13 12:47 PM26/02/13 12:47 PM www.it-ebooks.info BEGINNING ArcGIS ® for Desktop Development Using .NET Pouria Amirian ffirs.indd vffirs.indd v 26/02/13 12:47 PM26/02/13