How to bring over only 2 fields from the join feature class when using “SpatialJoin_analysis” and set up...

ListPlot join points by nearest neighbor rather than order

If a contract sometimes uses the wrong name, is it still valid?

Storing hydrofluoric acid before the invention of plastics

How to bypass password on Windows XP account?

Do I really need recursive chmod to restrict access to a folder?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

Why didn't this character "real die" when they blew their stack out in Altered Carbon?

Should I use a zero-interest credit card for a large one-time purchase?

Identify plant with long narrow paired leaves and reddish stems

Book where humans were engineered with genes from animal species to survive hostile planets

How can I make names more distinctive without making them longer?

Can a non-EU citizen traveling with me come with me through the EU passport line?

Why did the Falcon Heavy center core fall off the ASDS OCISLY barge?

How to deal with a team lead who never gives me credit?

Should I discuss the type of campaign with my players?

Dating a Former Employee

Echoing a tail command produces unexpected output?

English words in a non-english sci-fi novel

Apollo command module space walk?

How do I stop a creek from eroding my steep embankment?

Output the ŋarâþ crîþ alphabet song without using (m)any letters

What LEGO pieces have "real-world" functionality?

What to do with chalk when deepwater soloing?

What exactly is a "Meth" in Altered Carbon?



How to bring over only 2 fields from the join feature class when using “SpatialJoin_analysis” and set up a merge rule?



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Where clause problems when all parts are user input variablescopy feature class and retain selected fields with arcpyUsing ArcPy FieldMappings for Spatial Join?When using arcpy can I only calculate fields of a subtype and not the entire feature class?How to transfer attributes to thousands of local points from ArcSDE feature class with millions of polygons?Adding IDs of links composing polygon?Deleting many fields from many feature classes using ArcPy?Scripting spatial join in ArcPy to set field attribute in field mapping object?Passing attributes from join features to target features in 'SpatialJoin_analysis'?Iterating over set of feature classes and spatial join to create only one output?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I'm trying to understand how to use FieldMap and FieldMappings.
I know very little about objects plus I'm finding the explanations on ESRI website not very good and far from comprehensive.
All I'm trying to do is to perform a spatial join between two polygon datasets and I need to bring over to the target feature class 2 fields from the join class and the merge rule should be 'First'.



Can anyone please explain how to do this?



All I have is this incomplete piece of code:



fm = arcpy.FieldMap()
fm.mergeRule = 'First'
arcpy.SpatialJoin_analysis('fl_London_Bldngs', 'fl_VS2_agl_polyg_1', fc_VS2_agl_polyg, join_operation = 'JOIN_ONE_TO_ONE', match_option = 'INTERSECT', join_type = 'KEEP_COMMON', field_mapping = .....)


NOTE: Several polygons from the join feature class can intersect with 1 target feature. Therefore the need to establish a rule to choose the first value of those intersecting features.



Could anyone recommend a site where all this is nicely explained?










share|improve this question
















bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    1















    I'm trying to understand how to use FieldMap and FieldMappings.
    I know very little about objects plus I'm finding the explanations on ESRI website not very good and far from comprehensive.
    All I'm trying to do is to perform a spatial join between two polygon datasets and I need to bring over to the target feature class 2 fields from the join class and the merge rule should be 'First'.



    Can anyone please explain how to do this?



    All I have is this incomplete piece of code:



    fm = arcpy.FieldMap()
    fm.mergeRule = 'First'
    arcpy.SpatialJoin_analysis('fl_London_Bldngs', 'fl_VS2_agl_polyg_1', fc_VS2_agl_polyg, join_operation = 'JOIN_ONE_TO_ONE', match_option = 'INTERSECT', join_type = 'KEEP_COMMON', field_mapping = .....)


    NOTE: Several polygons from the join feature class can intersect with 1 target feature. Therefore the need to establish a rule to choose the first value of those intersecting features.



    Could anyone recommend a site where all this is nicely explained?










    share|improve this question
















    bumped to the homepage by Community 1 min ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I'm trying to understand how to use FieldMap and FieldMappings.
      I know very little about objects plus I'm finding the explanations on ESRI website not very good and far from comprehensive.
      All I'm trying to do is to perform a spatial join between two polygon datasets and I need to bring over to the target feature class 2 fields from the join class and the merge rule should be 'First'.



      Can anyone please explain how to do this?



      All I have is this incomplete piece of code:



      fm = arcpy.FieldMap()
      fm.mergeRule = 'First'
      arcpy.SpatialJoin_analysis('fl_London_Bldngs', 'fl_VS2_agl_polyg_1', fc_VS2_agl_polyg, join_operation = 'JOIN_ONE_TO_ONE', match_option = 'INTERSECT', join_type = 'KEEP_COMMON', field_mapping = .....)


      NOTE: Several polygons from the join feature class can intersect with 1 target feature. Therefore the need to establish a rule to choose the first value of those intersecting features.



      Could anyone recommend a site where all this is nicely explained?










      share|improve this question
















      I'm trying to understand how to use FieldMap and FieldMappings.
      I know very little about objects plus I'm finding the explanations on ESRI website not very good and far from comprehensive.
      All I'm trying to do is to perform a spatial join between two polygon datasets and I need to bring over to the target feature class 2 fields from the join class and the merge rule should be 'First'.



      Can anyone please explain how to do this?



      All I have is this incomplete piece of code:



      fm = arcpy.FieldMap()
      fm.mergeRule = 'First'
      arcpy.SpatialJoin_analysis('fl_London_Bldngs', 'fl_VS2_agl_polyg_1', fc_VS2_agl_polyg, join_operation = 'JOIN_ONE_TO_ONE', match_option = 'INTERSECT', join_type = 'KEEP_COMMON', field_mapping = .....)


      NOTE: Several polygons from the join feature class can intersect with 1 target feature. Therefore the need to establish a rule to choose the first value of those intersecting features.



      Could anyone recommend a site where all this is nicely explained?







      arcpy arcgis-pro field-mapping






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 13 '18 at 15:33







      Pitrako Junior

















      asked Mar 13 '18 at 14:57









      Pitrako JuniorPitrako Junior

      21218




      21218





      bumped to the homepage by Community 1 min ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 1 min ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I had this same issue when trying to build a field map, the best documentation I found is the esri Help. Though I agree it's not the greatest in this case.



          There is an arcpy.FieldMappings() help page which is better than the Spatial Join help page.



          Read through FieldMappings page carefully, pay particular attention to the script at the bottom. Then just try it, once you do it you will realize it is not actually as complicated as it looks. It really is a step by step thing. You can use the same steps from that page to do the field mappings for your spatial join, even though they are using a merge for the example. They do a few more things in the sample code for the spatial join page, but these are not required, and your code should still work.






          share|improve this answer
























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "79"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f274588%2fhow-to-bring-over-only-2-fields-from-the-join-feature-class-when-using-spatialj%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I had this same issue when trying to build a field map, the best documentation I found is the esri Help. Though I agree it's not the greatest in this case.



            There is an arcpy.FieldMappings() help page which is better than the Spatial Join help page.



            Read through FieldMappings page carefully, pay particular attention to the script at the bottom. Then just try it, once you do it you will realize it is not actually as complicated as it looks. It really is a step by step thing. You can use the same steps from that page to do the field mappings for your spatial join, even though they are using a merge for the example. They do a few more things in the sample code for the spatial join page, but these are not required, and your code should still work.






            share|improve this answer




























              0














              I had this same issue when trying to build a field map, the best documentation I found is the esri Help. Though I agree it's not the greatest in this case.



              There is an arcpy.FieldMappings() help page which is better than the Spatial Join help page.



              Read through FieldMappings page carefully, pay particular attention to the script at the bottom. Then just try it, once you do it you will realize it is not actually as complicated as it looks. It really is a step by step thing. You can use the same steps from that page to do the field mappings for your spatial join, even though they are using a merge for the example. They do a few more things in the sample code for the spatial join page, but these are not required, and your code should still work.






              share|improve this answer


























                0












                0








                0







                I had this same issue when trying to build a field map, the best documentation I found is the esri Help. Though I agree it's not the greatest in this case.



                There is an arcpy.FieldMappings() help page which is better than the Spatial Join help page.



                Read through FieldMappings page carefully, pay particular attention to the script at the bottom. Then just try it, once you do it you will realize it is not actually as complicated as it looks. It really is a step by step thing. You can use the same steps from that page to do the field mappings for your spatial join, even though they are using a merge for the example. They do a few more things in the sample code for the spatial join page, but these are not required, and your code should still work.






                share|improve this answer













                I had this same issue when trying to build a field map, the best documentation I found is the esri Help. Though I agree it's not the greatest in this case.



                There is an arcpy.FieldMappings() help page which is better than the Spatial Join help page.



                Read through FieldMappings page carefully, pay particular attention to the script at the bottom. Then just try it, once you do it you will realize it is not actually as complicated as it looks. It really is a step by step thing. You can use the same steps from that page to do the field mappings for your spatial join, even though they are using a merge for the example. They do a few more things in the sample code for the spatial join page, but these are not required, and your code should still work.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 13 '18 at 19:50









                Simon.ySimon.y

                17010




                17010






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f274588%2fhow-to-bring-over-only-2-fields-from-the-join-feature-class-when-using-spatialj%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                    Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

                    Meter-Bus Содержание Параметры шины | Стандартизация |...