Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Gis search scarc2013


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Gis search scarc2013

  1. 1. Customized “Find” tool for ArcGIS Desktop users
  2. 2. • Hi! I am Shawn Carson• GIS Manager - City of Rock Hill, SC• 36 square miles• Population 64,154• City is also a utility company–Aprox 33,000 customers– Water, Sewer and Electric
  3. 3. Why do this? (web is cooler)• Why make a FIND tool?– One exists• Not “data dependent”– More on that later…• Relatively straight-forward• “Code Completer” is a helpful feature• Desktop users were asking for it– For the Desktop users– Some not familiar with the tools
  4. 4. Environment/Specs• Visual Studio 2010– C#– ESRI SDK kit• Part of 10.1 download– .Net controls• DataGridView The Awesome Control– All Windows Forms• Listboxes, etc
  5. 5. Tools and skills• Win7 (also used XP)• Target Users: Anyone with:– Desktop installed– Geodatabase connection• Esri Templates (in VS2010)– Creating your initial “button” that shows ontoolbar
  6. 6. Tools and skills (cont’d)• ArcObjects (I plagerize)– Accessing Geodatabase– Querying a featureclass– Adding some graphics• Geocoding– Accessing a locator– Modifying an ESRI sample
  7. 7. Tools and skills (cont’d)• ArcGIS Add-in Manager (deployment)– ArcMapCustomizeAdd-In Manager
  8. 8. ESRI Templates (in VS2010)• Fire up VS2010– FileNewProject• Creates what you will see on the toolbar• Gets you your “application” (ArcMap) object• Gets you the “on_Click” event
  9. 9. Workflow – High Level Steps• Select a search type– Intersection, Street, Address, Parcel Id• Enter your “value”– Neely Store & Hopewell, Main St, etc• Select the FeatureClass• Select Features that meet criteria• Zoom• Add a graphic
  10. 10. Workflow – Access a database• Access your geodatabaseIWorkspaceFactory2 wrkspcfac = newSdeWorkspaceFactoryClass();IWorkspace wrksp =wrkspcfac.OpenFromFile(@"C:UsersUserAppDataRoamingESRIDesktop10.1ArcCatalogGIS10@gisscarson@sa.sde", 0);
  11. 11. Workflow – Access afeatureclass• Access a FeatureClassIFeatureWorkspace fwrkSpace =(IFeatureWorkspace)_wrksp;IFeatureClass _fcStreet =fwrkSpace.OpenFeatureClass(Settings1.Default.RoadLayer);
  12. 12. Workflow – Query afeatureclass• Access the attributes• Get to the geometryIQueryFilter qf = new QueryFilterClass();qf.WhereClause = strwhereClause; “St_Name = ‘Main’”IFeatureCursor featCur = _fcStreet.Search(qf, false);IFeature f = featCur.NextFeature();elem1.Geometry = f.Shape;IEnvelope env = f.Extent;
  13. 13. Create a graphic and Zoom• Once the feature is retrieved, mark it andzoom to it…ILineElement lelem = new LineElementClass();IRgbColor clr = new RgbColorClass();ITextElement tElem = new TextElementClass();gc.AddElement(elem, 1);av.Extent = env;av.Refresh();
  14. 14. Intersection – geocoding• A little different  geocoding– Need to have a locator• Access locator programmaticallyILocator _loc = null;ILocatorManager locManager = new LocatorManagerClass();ILocatorWorkspace2 locWrksp =(ILocatorWorkspace2)locManager.GetLocatorWorkspace(_wrksp);_loc = locWrksp.GetLocator(“DBO.myLocator”);
  15. 15. Intersection – geocoding(cont’d)• Raided the samples –•– Developing with ArcGIS– Learning ArcObjects– Spatial query and analysis– Geocoding
  16. 16. Intersection – geocoding(cont’d)• Zoom to an intersection– “Cherry Road & Mt Gallant”– “Neely Store & Hopewell”– “Shurley & Barnett”• Geocoding code gives you a point– The Intersection– point = valuesArray[i] as IPoint;• A point is one of the things returned from a “match”• IPoint pt = GeocodeAddress(addressProperties);
  17. 17. How Does Code CompleterWork?• DataGridView• TextBox– Textbox_TextChanged (event)– if (textBox1.TextLength > 3){string strWQ = " SteetName LIKE " + strvar + "%";}
  18. 18. How Does Code CompleterWork?(Cont’d)• Once you get your records back, stick them inDataGridView. (columns, etc etc, make itpretty.)• ITableSort– Sorts your records (ascending, descending)– Select Fields returned
  19. 19. How Does Code CompleterWork?(Cont’d)• #1054 (searchGIS.cs)
  20. 20. DataGridView• A standard VS control
  21. 21. Populating your DataGridViewSee sample…
  22. 22. How to Deploy…• Your component is an “Add-in”• CommandsAdd From File…
  23. 23. How to Deploy… (Cont’d)• After “Add from File”• The tool is in Add-In-Controls…• Drag it onto a toolbar…
  24. 24. Web folk…• Think about using Ajax’sAutoCompleteExtender for autocomplete onthe web…
  25. 25. Thanks for ComingQuestions?803-448-2767 (cell)