Getting halfway point in Polyline in ArcGIS API for JavaScript?Polyline insertPoint issue using ArcGIS API...

Can I cause damage to electrical appliances by unplugging them when they are turned on?

Did the UK lift the requirement for registering SIM cards?

What is the highest possible scrabble score for placing a single tile

Do we have to expect a queue for the shuttle from Watford Junction to Harry Potter Studio?

The IT department bottlenecks progress, how should I handle this?

How would you translate "more" for use as an interface button?

Has the laser at Magurele, Romania reached a tenth of the Sun's power?

A Trivial Diagnosis

Is it necessary to use pronouns with the verb "essere"?

How could a planet have erratic days?

Stack Interview Code methods made from class Node and Smart Pointers

Permission on Database

What (the heck) is a Super Worm Equinox Moon?

How to get directions in deep space?

Does the reader need to like the PoV character?

Is this part of the description of the Archfey warlock's Misty Escape feature redundant?

Can I say "fingers" when referring to toes?

Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?

Make a Bowl of Alphabet Soup

Has any country ever had 2 former presidents in jail simultaneously?

How to preserve electronics (computers, iPads and phones) for hundreds of years

Doesn't the system of the Supreme Court oppose justice?

Is it allowed to activate the ability of multiple planeswalkers in a single turn?



Getting halfway point in Polyline in ArcGIS API for JavaScript?


Polyline insertPoint issue using ArcGIS API for JavaScript?ArcGIS API for Silverlight - pass geometries to ESRI servicepass string varialbe to placeholder for attribute in infoWindow (ArcGIS Javascript)ArcGIS JavaScript API: onAnimate ErrorHigh-DPI printing with ArcGIS API for JavaScript and esri.dijit.Print?Project Point using ArcGIS API for JavaScript?How to use same info window setup for more than one layer with identify, arcgis javascript api, cmv templateDetecting onClick event for clicking Printout button of ArcGIS API for JavaScript?Getting Z component from point in ArcGIS API for JavaScript?Esri Javascript API .applyEdits() firing on(“edits-complete”), not erroring, but not updating the database













0















I would like to reach the mid point of a polyline.



I just tried the centroid and realcentroid properties but I only got a soluction in ArcPy with the code below:



Midpoint = geometry.positionAlongLine(0.50,True).firstPoint
... print Midpoint.X
... print Midpoint.Y


How do I find the correct mid point (not centerline or gravity point of an irregular polyline)?



enter image description here










share|improve this question
















bumped to the homepage by Community 3 mins ago


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




















    0















    I would like to reach the mid point of a polyline.



    I just tried the centroid and realcentroid properties but I only got a soluction in ArcPy with the code below:



    Midpoint = geometry.positionAlongLine(0.50,True).firstPoint
    ... print Midpoint.X
    ... print Midpoint.Y


    How do I find the correct mid point (not centerline or gravity point of an irregular polyline)?



    enter image description here










    share|improve this question
















    bumped to the homepage by Community 3 mins ago


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


















      0












      0








      0








      I would like to reach the mid point of a polyline.



      I just tried the centroid and realcentroid properties but I only got a soluction in ArcPy with the code below:



      Midpoint = geometry.positionAlongLine(0.50,True).firstPoint
      ... print Midpoint.X
      ... print Midpoint.Y


      How do I find the correct mid point (not centerline or gravity point of an irregular polyline)?



      enter image description here










      share|improve this question
















      I would like to reach the mid point of a polyline.



      I just tried the centroid and realcentroid properties but I only got a soluction in ArcPy with the code below:



      Midpoint = geometry.positionAlongLine(0.50,True).firstPoint
      ... print Midpoint.X
      ... print Midpoint.Y


      How do I find the correct mid point (not centerline or gravity point of an irregular polyline)?



      enter image description here







      arcgis-javascript-api geometry






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 21 at 20:22









      PolyGeo

      53.7k1781244




      53.7k1781244










      asked Jan 21 at 19:56









      EzequiasEzequias

      13




      13





      bumped to the homepage by Community 3 mins 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 3 mins 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














          Do you have to use esri js? Turf.js has a function called "along" that could be used for this, but you'd need to calculate the length of the line beforehand before halving it and sending that length into the .along() parameters. You could calculate the length in turf as well, or use esri if you prefer.



          If it has to be esri js... have fun. I suppose that I would first get the length of the entire line using a geometry service (if this doesn't all need to be client side). From there, I would probably break the line into segments by iterating over its paths and then running along a those segments, getting the distance of each and keeping track until I found the right segment to finally drop a point with whatever distance I had left at an angle calculated from the segment endpoints.



          Lucky for you, someone else already wrote this and seems to have cut out the step of exploding the geometry for us. How convenient!






          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%2f309418%2fgetting-halfway-point-in-polyline-in-arcgis-api-for-javascript%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














            Do you have to use esri js? Turf.js has a function called "along" that could be used for this, but you'd need to calculate the length of the line beforehand before halving it and sending that length into the .along() parameters. You could calculate the length in turf as well, or use esri if you prefer.



            If it has to be esri js... have fun. I suppose that I would first get the length of the entire line using a geometry service (if this doesn't all need to be client side). From there, I would probably break the line into segments by iterating over its paths and then running along a those segments, getting the distance of each and keeping track until I found the right segment to finally drop a point with whatever distance I had left at an angle calculated from the segment endpoints.



            Lucky for you, someone else already wrote this and seems to have cut out the step of exploding the geometry for us. How convenient!






            share|improve this answer




























              0














              Do you have to use esri js? Turf.js has a function called "along" that could be used for this, but you'd need to calculate the length of the line beforehand before halving it and sending that length into the .along() parameters. You could calculate the length in turf as well, or use esri if you prefer.



              If it has to be esri js... have fun. I suppose that I would first get the length of the entire line using a geometry service (if this doesn't all need to be client side). From there, I would probably break the line into segments by iterating over its paths and then running along a those segments, getting the distance of each and keeping track until I found the right segment to finally drop a point with whatever distance I had left at an angle calculated from the segment endpoints.



              Lucky for you, someone else already wrote this and seems to have cut out the step of exploding the geometry for us. How convenient!






              share|improve this answer


























                0












                0








                0







                Do you have to use esri js? Turf.js has a function called "along" that could be used for this, but you'd need to calculate the length of the line beforehand before halving it and sending that length into the .along() parameters. You could calculate the length in turf as well, or use esri if you prefer.



                If it has to be esri js... have fun. I suppose that I would first get the length of the entire line using a geometry service (if this doesn't all need to be client side). From there, I would probably break the line into segments by iterating over its paths and then running along a those segments, getting the distance of each and keeping track until I found the right segment to finally drop a point with whatever distance I had left at an angle calculated from the segment endpoints.



                Lucky for you, someone else already wrote this and seems to have cut out the step of exploding the geometry for us. How convenient!






                share|improve this answer













                Do you have to use esri js? Turf.js has a function called "along" that could be used for this, but you'd need to calculate the length of the line beforehand before halving it and sending that length into the .along() parameters. You could calculate the length in turf as well, or use esri if you prefer.



                If it has to be esri js... have fun. I suppose that I would first get the length of the entire line using a geometry service (if this doesn't all need to be client side). From there, I would probably break the line into segments by iterating over its paths and then running along a those segments, getting the distance of each and keeping track until I found the right segment to finally drop a point with whatever distance I had left at an angle calculated from the segment endpoints.



                Lucky for you, someone else already wrote this and seems to have cut out the step of exploding the geometry for us. How convenient!







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 19 at 20:31









                ZackZack

                531313




                531313






























                    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%2f309418%2fgetting-halfway-point-in-polyline-in-arcgis-api-for-javascript%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

                    (145452) 2005 RN43 Классификация | Примечания | Ссылки |...

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

                    Энтрерриос (город) Содержание История | Географическое...