Converting “type”:“MultiLineString”,“coordinates”:[[[x1,y1],[x2,y2]]] to geography column using PostGIS?Casting a Geography type in PostGISNewbie PostGIS Geometry and Multilinestring ClarificationPostGIS convert geography(Point,4326) to GPSHow to import PostGIS layer with geography type to QGIS?How to get Lon/Lat values from the postgis raster type columnInvalid Input Syntax for Type Double Precision in PostGIS?Postgis How to populate column with geography data from geometric data?Get latitude and longitude of a geography columnLat-Long values get rounded off when stored in a column type Geography in postgresProblem to convert geometry to coordinates of geometry(MultiLineString) data

Why do airports remove/realign runways?

Converting "type":"MultiLineString","coordinates":[[[x1,y1],[x2,y2]]] to geography column using PostGIS?

Deck of Cards with Shuffle and Sort functionality

Write a function

Can Jimmy hang on his rope?

Four ships at the ocean with the same distance

How does one acquire an undead eyeball encased in a gem?

Is it possible for a character at any level to cast all 44 Cantrips in one week without Magic Items?

US citizen traveling with Peruvian passport

Where are the Wazirs?

Gory anime with pink haired girl escaping an asylum

Is this really the Saturn V computer only, or are there other systems here as well?

How do ballistic trajectories work in a ring world?

Moving millions of files to a different directory with specfic name patterns

Category-theoretic treatment of diffs, patches and merging?

How do resistors generate different heat if we make the current fixed and changed the voltage and resistance? Notice the flow of charge is constant

Mtg creature spells, instants, priority?

Chilling water in copper vessel

Was it ever illegal to name a pig "Napoleon" in France?

How can I know how much authority/decision making power etc I have as an employee?

Can a landlord force all residents to use the landlord's in-house debit card accounts?

Appropriate conduit for several data cables underground over 300' run

How do I explain that I don't want to maintain old projects?

Is there a formal/better word than "skyrocket" for the given context?



Converting “type”:“MultiLineString”,“coordinates”:[[[x1,y1],[x2,y2]]] to geography column using PostGIS?


Casting a Geography type in PostGISNewbie PostGIS Geometry and Multilinestring ClarificationPostGIS convert geography(Point,4326) to GPSHow to import PostGIS layer with geography type to QGIS?How to get Lon/Lat values from the postgis raster type columnInvalid Input Syntax for Type Double Precision in PostGIS?Postgis How to populate column with geography data from geometric data?Get latitude and longitude of a geography columnLat-Long values get rounded off when stored in a column type Geography in postgresProblem to convert geometry to coordinates of geometry(MultiLineString) data






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








1















I have a Postgresql table with a text column that has data like the below.



"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]



I have added a new column to the table with type Geography and I would like to move this multilinestring data to the new geography column.



I need to find the centroid of the mulitilinestring in the form of lat/lng so that distance can be calculated from a give address. The table has around 139k rows.










share|improve this question









New contributor



Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    1















    I have a Postgresql table with a text column that has data like the below.



    "type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]



    I have added a new column to the table with type Geography and I would like to move this multilinestring data to the new geography column.



    I need to find the centroid of the mulitilinestring in the form of lat/lng so that distance can be calculated from a give address. The table has around 139k rows.










    share|improve this question









    New contributor



    Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      1












      1








      1








      I have a Postgresql table with a text column that has data like the below.



      "type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]



      I have added a new column to the table with type Geography and I would like to move this multilinestring data to the new geography column.



      I need to find the centroid of the mulitilinestring in the form of lat/lng so that distance can be calculated from a give address. The table has around 139k rows.










      share|improve this question









      New contributor



      Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have a Postgresql table with a text column that has data like the below.



      "type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]



      I have added a new column to the table with type Geography and I would like to move this multilinestring data to the new geography column.



      I need to find the centroid of the mulitilinestring in the form of lat/lng so that distance can be calculated from a give address. The table has around 139k rows.







      postgis






      share|improve this question









      New contributor



      Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question









      New contributor



      Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question








      edited 4 hours ago









      PolyGeo

      54.5k17 gold badges84 silver badges255 bronze badges




      54.5k17 gold badges84 silver badges255 bronze badges






      New contributor



      Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 8 hours ago









      Venkat PolisettiVenkat Polisetti

      83 bronze badges




      83 bronze badges




      New contributor



      Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Venkat Polisetti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          2














          You can use ST_FromGeoJson to convert the text to a geometry, then you would cast the result to the desired geography format. At last, you can use ST_Centroid



          ex:



          select st_AsText(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]'));
          st_astext
          ------------------------------------------------------------------------------------
          MULTILINESTRING((-122.995882414 44.0576694170001,-122.998182101 44.0576887840001))


          with the cast:



          select st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography;


          ... and the centroid



          select st_centroid(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography);


          From a column:



          SELECT st_centroid(st_geomFromGeoJson(my_geoJson_column)::geography)
          FROM myTable;





          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
            );



            );






            Venkat Polisetti is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f328020%2fconverting-typemultilinestring-coordinatesx1-y1-x2-y2-to-geogr%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









            2














            You can use ST_FromGeoJson to convert the text to a geometry, then you would cast the result to the desired geography format. At last, you can use ST_Centroid



            ex:



            select st_AsText(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]'));
            st_astext
            ------------------------------------------------------------------------------------
            MULTILINESTRING((-122.995882414 44.0576694170001,-122.998182101 44.0576887840001))


            with the cast:



            select st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography;


            ... and the centroid



            select st_centroid(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography);


            From a column:



            SELECT st_centroid(st_geomFromGeoJson(my_geoJson_column)::geography)
            FROM myTable;





            share|improve this answer



























              2














              You can use ST_FromGeoJson to convert the text to a geometry, then you would cast the result to the desired geography format. At last, you can use ST_Centroid



              ex:



              select st_AsText(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]'));
              st_astext
              ------------------------------------------------------------------------------------
              MULTILINESTRING((-122.995882414 44.0576694170001,-122.998182101 44.0576887840001))


              with the cast:



              select st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography;


              ... and the centroid



              select st_centroid(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography);


              From a column:



              SELECT st_centroid(st_geomFromGeoJson(my_geoJson_column)::geography)
              FROM myTable;





              share|improve this answer

























                2












                2








                2







                You can use ST_FromGeoJson to convert the text to a geometry, then you would cast the result to the desired geography format. At last, you can use ST_Centroid



                ex:



                select st_AsText(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]'));
                st_astext
                ------------------------------------------------------------------------------------
                MULTILINESTRING((-122.995882414 44.0576694170001,-122.998182101 44.0576887840001))


                with the cast:



                select st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography;


                ... and the centroid



                select st_centroid(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography);


                From a column:



                SELECT st_centroid(st_geomFromGeoJson(my_geoJson_column)::geography)
                FROM myTable;





                share|improve this answer













                You can use ST_FromGeoJson to convert the text to a geometry, then you would cast the result to the desired geography format. At last, you can use ST_Centroid



                ex:



                select st_AsText(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]'));
                st_astext
                ------------------------------------------------------------------------------------
                MULTILINESTRING((-122.995882414 44.0576694170001,-122.998182101 44.0576887840001))


                with the cast:



                select st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography;


                ... and the centroid



                select st_centroid(st_geomFromGeoJson('"type":"MultiLineString","coordinates":[[[-122.995882414,44.05766941700006],[-122.99818210099994,44.05768878400005]]]')::geography);


                From a column:



                SELECT st_centroid(st_geomFromGeoJson(my_geoJson_column)::geography)
                FROM myTable;






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 7 hours ago









                JGHJGH

                15k2 gold badges14 silver badges39 bronze badges




                15k2 gold badges14 silver badges39 bronze badges




















                    Venkat Polisetti is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    Venkat Polisetti is a new contributor. Be nice, and check out our Code of Conduct.












                    Venkat Polisetti is a new contributor. Be nice, and check out our Code of Conduct.











                    Venkat Polisetti is a new contributor. Be nice, and check out our Code of Conduct.














                    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%2f328020%2fconverting-typemultilinestring-coordinatesx1-y1-x2-y2-to-geogr%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

                    ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

                    Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

                    19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу