Select by point using ModelBuilder?

5969
10
Jump to solution
12-05-2015 07:28 AM
PV
by
New Contributor III

I am trying to select zonetypes (eg forest, agriculture) within  a municipality and to show the area of each zonetype in this municipality.

I am doing this in ModelBuilder and will export it to a python script later on.

I am stuck with following Points

  1. How can I tell ModelBuilder to perform the task on the municipality I click in with my Cursor? I heard Feature sets are helpful but I don't really understand how they work and how I must implement one as a pointer
  2. How can I get the area statistics? I thought by using the Calculate Area tool. This would create a new feature class.Another option would be exporting the selected data as a table and perform a summary on it. However, these two ways do not work with the "select layer by Location tool" as this requires a layer file as input


This question is also posted here: arcgis desktop - Select by point using ModelBuilder? - Geographic Information Systems Stack Exchange

modelbuilder.png

1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

The Select Layer by Location tool requires a Layer object as input so there shouldn't be any need for you to create a layer file on disk. The MakeFeatureLayer tool would be used to create the layer object for you. The reason why the select tool needs the layer object is because you can only apply a selection against a layer object. For example, say that you have a point feature class and you want to select the point with OID 3. To do this you would need to open ArcMap, add the data to the map, and then select the point. When you added the data to the TOC of the map document you've essentially created a layer object, which you can apply selections against.

I would think that if you want to calculate the area of data based on where you clicked within ModelBuilder you'd want to use a FeatureSet. The FeatureSet would essentially allow you to use the tool's dialog to create a point feature on the fly (i.e. when the FeatureSet parameter is active it would allow you to click on the map and it would create points there without you having to either create a feature class or start an edit session). You would use these points to select the intersecting polygons that you want to calculate the areas against. If you wanted to update the source data you could use the CalculateField tool to calculate the area in the units you're needing or you could make a copy of the data and perform the calculation there.

I would assume at the simplest your model would look as shown below.

MB.png

View solution in original post

10 Replies
ChrisDonohue__GISP
MVP Alum

Some questions/ideas that may help elucidate things:

  • What version of ArcMap are you using and what license level?  I ask as the available tools vary considerably depending upon what version and license level you have.  Also, the Python version typically changes with ArcMap version.
  • Is the source data in a File or Personal Geodatabase, Enterprise Geodatabase (SDE), shapefile, etc?  What format are you writing the outputs to?  The Calculate Areas task may be unnecessary if your data is going into a geodatabase, as it updates automatically.
  • For your Question #2, the way to make it a feature class again so you can run Calculate Areas against it is usually via the Copy Features tool.  Here's the quote from the Make Feature Layer Help:

The temporary feature layer can be saved as a layer file using the Save To Layer File tool or saved as a new feature class using the Copy Features tool.

Source:  Make Feature Layer (Data Management)

Chris Donohue, GISP

PV
by
New Contributor III

I work with ArcGIS 10.2 with an advanced license level. The source data is in a file geodatabase and so is the Output.

Thanks for the link to the Feature layer, will try if it works that way!

WesMiller
Regular Contributor III

You can use feature set as part of your interaction with your map. Create a model for testing purposes and use a feature set as a variable then use with select by location, that should give you a feel for haw it works.

A quick tour of using Feature Set and Record Set—Help | ArcGIS for Desktop

FreddieGibson
Occasional Contributor III

The Select Layer by Location tool requires a Layer object as input so there shouldn't be any need for you to create a layer file on disk. The MakeFeatureLayer tool would be used to create the layer object for you. The reason why the select tool needs the layer object is because you can only apply a selection against a layer object. For example, say that you have a point feature class and you want to select the point with OID 3. To do this you would need to open ArcMap, add the data to the map, and then select the point. When you added the data to the TOC of the map document you've essentially created a layer object, which you can apply selections against.

I would think that if you want to calculate the area of data based on where you clicked within ModelBuilder you'd want to use a FeatureSet. The FeatureSet would essentially allow you to use the tool's dialog to create a point feature on the fly (i.e. when the FeatureSet parameter is active it would allow you to click on the map and it would create points there without you having to either create a feature class or start an edit session). You would use these points to select the intersecting polygons that you want to calculate the areas against. If you wanted to update the source data you could use the CalculateField tool to calculate the area in the units you're needing or you could make a copy of the data and perform the calculation there.

I would assume at the simplest your model would look as shown below.

MB.png

PV
by
New Contributor III

Thank you Freddie, that Model and your explanation was a perfect base for my task!!

DanPatterson_Retired
MVP Emeritus

moved to Geoprocessing

Community structure is here for proper placement of questions...GeoNet Community Structure

Walaa_Njr
New Contributor III

Model Builder is an application that you can create, edit and manage forms. If you were not already done so, you should read to create a simple model, because it shows you, by example, the basic tasks to create a model in ModelBuilder. You should also read an overview of the concepts of the model and the conditions and matters referred to there, because they know many of the terms used here.

Below are presented application components ModelBuilder.

نافذة ModelBuilderشريط الأدوات ModelBuilder

Reading a summary of these tools

Discusses the minister added tool in creating a data model operations.

And discusses the navigation tools in the form of movement.

Select the item allows you to select an item to move, copy, access to the properties, and delete.

Communication tool connecting elements, such as variable data into a tool, and discussed the creation of the operations model.

Play button works and is discussed in turn model model.

You can not customize this toolbar.

Topics that follow discuss the use of ModelBuilder and the mechanics of creating, editing, and management models.

Build a model approach discusses the basic approaches to model building.

When building a model, you can create processes (process is a tool in addition to its own data) and communication between them, and create operations model shows you how.

You can run your models within ModelBuilder, or implementation of a tool like any other tool used in the dialogue or command line window. Run Sample shows you how to run models within ModelBuilder.

The ratification of the model shows you how to check your form for errors and synchronize data variables.

Typical environments discusses the use of geoprocessing environment variables and how they can be used in the models.

A typical appearance shows how you can change the shape and arrangement of elements model to increase readability.

You can print a diagram of the model (print model), and generate and print a report (Report) model, and the model for the export scenario (export model).

Documentation model is very important for models to participate. Process documentation shows how to submit documents for individual operations model.

DanPatterson_Retired
MVP Emeritus

Walaa Njr  Is it not helpful that you mark your own post helpful especially when done within minutes of posting it.

It might attract the attention of moderators.

Do you have any particular reason for adding this post since Freddie Gibson​ seems to have provide more than adequate coverage?

Can you point out where previous comments were deficient and where yours improve on the discussion since it might focus PV's consideration?

Walaa_Njr
New Contributor III

Simple explanation to use tool model builder

0 Kudos