PostGIS 3D linestring validity with two different Z coordinatesHow to transform SRID 3035 to SRID 4326?Rewriting query to match two points with linestring in different database table?Postgis poligonize. How to create polygon in postgis from linestringIntersection of 2 Linestrings (not interpolated)Postgis know if point is part of linestringST_Intersects with degenerate LINESTRINGST_IsValidDetail and LINESTRINGPostgis using st_geometry linestring on columnWhy does a LINESTRING change in length after union with a shorter but completely-overlapping LINESTRING?Convert invalid multilinestring to linestring with recursive ST_Union PostGIS

AES: Why is it a good practice to use only the first 16bytes of a hash for encryption?

What does it mean to describe someone as a butt steak?

How to take photos in burst mode, without vibration?

How can I make my BBEG immortal short of making them a Lich or Vampire?

What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?

Infinite Abelian subgroup of infinite non Abelian group example

Can a rocket refuel on Mars from water?

Neighboring nodes in the network

Why do I get two different answers for this counting problem?

What is the PIE reconstruction for word-initial alpha with rough breathing?

Western buddy movie with a supernatural twist where a woman turns into an eagle at the end

Theorems that impeded progress

Did Shadowfax go to Valinor?

Can I ask the recruiters in my resume to put the reason why I am rejected?

How to say in German "enjoying home comforts"

Facing a paradox: Earnshaw's theorem in one dimension

How do conventional missiles fly?

I Accidentally Deleted a Stock Terminal Theme

Has there ever been an airliner design involving reducing generator load by installing solar panels?

What is going on with Captain Marvel's blood colour?

Does casting Light, or a similar spell, have any effect when the caster is swallowed by a monster?

A reference to a well-known characterization of scattered compact spaces

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

What mechanic is there to disable a threat instead of killing it?



PostGIS 3D linestring validity with two different Z coordinates


How to transform SRID 3035 to SRID 4326?Rewriting query to match two points with linestring in different database table?Postgis poligonize. How to create polygon in postgis from linestringIntersection of 2 Linestrings (not interpolated)Postgis know if point is part of linestringST_Intersects with degenerate LINESTRINGST_IsValidDetail and LINESTRINGPostgis using st_geometry linestring on columnWhy does a LINESTRING change in length after union with a shorter but completely-overlapping LINESTRING?Convert invalid multilinestring to linestring with recursive ST_Union PostGIS






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








2















Maybe I missed something in the docs, but why is this not a valid LINESTRING Z and is a POINT Z when calling st_makeValid?



select st_isvalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)'));

st_isvalid
---------------
f


select st_astext(st_makevalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)')));
st_astext
---------------
POINT Z (0 0 0)









share|improve this question






















  • This looks like a bug to me. SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry); returns true, while SELECT st_isvalid('LINESTRING Z(0 0 1, 0 0 10)'::geometry); returns false.

    – John Powell
    2 days ago











  • Interestingly, if you call something like ST_Expand on the invalid Linestring Z, it works as expected. SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1)); returns POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1)). I will have a look at the source code later to see if I can find the bug, but, it looks to me that you can probably ignore the ST_Isvalid error. Also, note that ST_GeomFromText is not necessary to construct a LINESTRING Z.

    – John Powell
    2 days ago






  • 2





    I asked on the Postgis dev IRC channel and ST_IsValid only works in 2D, which explains why 0 0 0, 0 0 10 fails and 0 1 0, 0 0 10 works. sfcgal, on which the 3D extensions are based does have an IsValid function. I have been told to request an ST_3dIsValid function be hooked up to sfcgal and the docs be updated. As I suggested before, you are safe to carry on using LINESTRING Z. I will update this once I have filed the bug/request.

    – John Powell
    2 days ago

















2















Maybe I missed something in the docs, but why is this not a valid LINESTRING Z and is a POINT Z when calling st_makeValid?



select st_isvalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)'));

st_isvalid
---------------
f


select st_astext(st_makevalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)')));
st_astext
---------------
POINT Z (0 0 0)









share|improve this question






















  • This looks like a bug to me. SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry); returns true, while SELECT st_isvalid('LINESTRING Z(0 0 1, 0 0 10)'::geometry); returns false.

    – John Powell
    2 days ago











  • Interestingly, if you call something like ST_Expand on the invalid Linestring Z, it works as expected. SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1)); returns POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1)). I will have a look at the source code later to see if I can find the bug, but, it looks to me that you can probably ignore the ST_Isvalid error. Also, note that ST_GeomFromText is not necessary to construct a LINESTRING Z.

    – John Powell
    2 days ago






  • 2





    I asked on the Postgis dev IRC channel and ST_IsValid only works in 2D, which explains why 0 0 0, 0 0 10 fails and 0 1 0, 0 0 10 works. sfcgal, on which the 3D extensions are based does have an IsValid function. I have been told to request an ST_3dIsValid function be hooked up to sfcgal and the docs be updated. As I suggested before, you are safe to carry on using LINESTRING Z. I will update this once I have filed the bug/request.

    – John Powell
    2 days ago













2












2








2








Maybe I missed something in the docs, but why is this not a valid LINESTRING Z and is a POINT Z when calling st_makeValid?



select st_isvalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)'));

st_isvalid
---------------
f


select st_astext(st_makevalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)')));
st_astext
---------------
POINT Z (0 0 0)









share|improve this question














Maybe I missed something in the docs, but why is this not a valid LINESTRING Z and is a POINT Z when calling st_makeValid?



select st_isvalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)'));

st_isvalid
---------------
f


select st_astext(st_makevalid(st_geomfromtext('LINESTRING Z (0 0 0,0 0 10)')));
st_astext
---------------
POINT Z (0 0 0)






postgis






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 days ago









NovotmikeNovotmike

323




323












  • This looks like a bug to me. SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry); returns true, while SELECT st_isvalid('LINESTRING Z(0 0 1, 0 0 10)'::geometry); returns false.

    – John Powell
    2 days ago











  • Interestingly, if you call something like ST_Expand on the invalid Linestring Z, it works as expected. SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1)); returns POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1)). I will have a look at the source code later to see if I can find the bug, but, it looks to me that you can probably ignore the ST_Isvalid error. Also, note that ST_GeomFromText is not necessary to construct a LINESTRING Z.

    – John Powell
    2 days ago






  • 2





    I asked on the Postgis dev IRC channel and ST_IsValid only works in 2D, which explains why 0 0 0, 0 0 10 fails and 0 1 0, 0 0 10 works. sfcgal, on which the 3D extensions are based does have an IsValid function. I have been told to request an ST_3dIsValid function be hooked up to sfcgal and the docs be updated. As I suggested before, you are safe to carry on using LINESTRING Z. I will update this once I have filed the bug/request.

    – John Powell
    2 days ago

















  • This looks like a bug to me. SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry); returns true, while SELECT st_isvalid('LINESTRING Z(0 0 1, 0 0 10)'::geometry); returns false.

    – John Powell
    2 days ago











  • Interestingly, if you call something like ST_Expand on the invalid Linestring Z, it works as expected. SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1)); returns POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1)). I will have a look at the source code later to see if I can find the bug, but, it looks to me that you can probably ignore the ST_Isvalid error. Also, note that ST_GeomFromText is not necessary to construct a LINESTRING Z.

    – John Powell
    2 days ago






  • 2





    I asked on the Postgis dev IRC channel and ST_IsValid only works in 2D, which explains why 0 0 0, 0 0 10 fails and 0 1 0, 0 0 10 works. sfcgal, on which the 3D extensions are based does have an IsValid function. I have been told to request an ST_3dIsValid function be hooked up to sfcgal and the docs be updated. As I suggested before, you are safe to carry on using LINESTRING Z. I will update this once I have filed the bug/request.

    – John Powell
    2 days ago
















This looks like a bug to me. SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry); returns true, while SELECT st_isvalid('LINESTRING Z(0 0 1, 0 0 10)'::geometry); returns false.

– John Powell
2 days ago





This looks like a bug to me. SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry); returns true, while SELECT st_isvalid('LINESTRING Z(0 0 1, 0 0 10)'::geometry); returns false.

– John Powell
2 days ago













Interestingly, if you call something like ST_Expand on the invalid Linestring Z, it works as expected. SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1)); returns POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1)). I will have a look at the source code later to see if I can find the bug, but, it looks to me that you can probably ignore the ST_Isvalid error. Also, note that ST_GeomFromText is not necessary to construct a LINESTRING Z.

– John Powell
2 days ago





Interestingly, if you call something like ST_Expand on the invalid Linestring Z, it works as expected. SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1)); returns POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1)). I will have a look at the source code later to see if I can find the bug, but, it looks to me that you can probably ignore the ST_Isvalid error. Also, note that ST_GeomFromText is not necessary to construct a LINESTRING Z.

– John Powell
2 days ago




2




2





I asked on the Postgis dev IRC channel and ST_IsValid only works in 2D, which explains why 0 0 0, 0 0 10 fails and 0 1 0, 0 0 10 works. sfcgal, on which the 3D extensions are based does have an IsValid function. I have been told to request an ST_3dIsValid function be hooked up to sfcgal and the docs be updated. As I suggested before, you are safe to carry on using LINESTRING Z. I will update this once I have filed the bug/request.

– John Powell
2 days ago





I asked on the Postgis dev IRC channel and ST_IsValid only works in 2D, which explains why 0 0 0, 0 0 10 fails and 0 1 0, 0 0 10 works. sfcgal, on which the 3D extensions are based does have an IsValid function. I have been told to request an ST_3dIsValid function be hooked up to sfcgal and the docs be updated. As I suggested before, you are safe to carry on using LINESTRING Z. I will update this once I have filed the bug/request.

– John Powell
2 days ago










1 Answer
1






active

oldest

votes


















3














This is expected behaviour as the existing Postgis/GEOS codebase only checks 2D coordinates, ie, it ignores the z coordinate.



If you run,



SELECT ST_IsValid('LINESTRING Z(0 1 0, 0 0 10)'::geometry);


it returns true, as you now have a valid 2D LINESTRING.



I was advised on the Postgis developers irc channel to file a feature request, to request a ST_3dIsValid function that would hook into the existing sfcgal IsValid function and, also, a request to update the docs for ST_IsValid.



Note, for now, you can ignore ST_IsValid with LINESTRING Z, as the underlying functionality appears to be correct, eg,



SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1));


returns:




POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1))







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%2f317453%2fpostgis-3d-linestring-validity-with-two-different-z-coordinates%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









    3














    This is expected behaviour as the existing Postgis/GEOS codebase only checks 2D coordinates, ie, it ignores the z coordinate.



    If you run,



    SELECT ST_IsValid('LINESTRING Z(0 1 0, 0 0 10)'::geometry);


    it returns true, as you now have a valid 2D LINESTRING.



    I was advised on the Postgis developers irc channel to file a feature request, to request a ST_3dIsValid function that would hook into the existing sfcgal IsValid function and, also, a request to update the docs for ST_IsValid.



    Note, for now, you can ignore ST_IsValid with LINESTRING Z, as the underlying functionality appears to be correct, eg,



    SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1));


    returns:




    POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1))







    share|improve this answer



























      3














      This is expected behaviour as the existing Postgis/GEOS codebase only checks 2D coordinates, ie, it ignores the z coordinate.



      If you run,



      SELECT ST_IsValid('LINESTRING Z(0 1 0, 0 0 10)'::geometry);


      it returns true, as you now have a valid 2D LINESTRING.



      I was advised on the Postgis developers irc channel to file a feature request, to request a ST_3dIsValid function that would hook into the existing sfcgal IsValid function and, also, a request to update the docs for ST_IsValid.



      Note, for now, you can ignore ST_IsValid with LINESTRING Z, as the underlying functionality appears to be correct, eg,



      SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1));


      returns:




      POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1))







      share|improve this answer

























        3












        3








        3







        This is expected behaviour as the existing Postgis/GEOS codebase only checks 2D coordinates, ie, it ignores the z coordinate.



        If you run,



        SELECT ST_IsValid('LINESTRING Z(0 1 0, 0 0 10)'::geometry);


        it returns true, as you now have a valid 2D LINESTRING.



        I was advised on the Postgis developers irc channel to file a feature request, to request a ST_3dIsValid function that would hook into the existing sfcgal IsValid function and, also, a request to update the docs for ST_IsValid.



        Note, for now, you can ignore ST_IsValid with LINESTRING Z, as the underlying functionality appears to be correct, eg,



        SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1));


        returns:




        POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1))







        share|improve this answer













        This is expected behaviour as the existing Postgis/GEOS codebase only checks 2D coordinates, ie, it ignores the z coordinate.



        If you run,



        SELECT ST_IsValid('LINESTRING Z(0 1 0, 0 0 10)'::geometry);


        it returns true, as you now have a valid 2D LINESTRING.



        I was advised on the Postgis developers irc channel to file a feature request, to request a ST_3dIsValid function that would hook into the existing sfcgal IsValid function and, also, a request to update the docs for ST_IsValid.



        Note, for now, you can ignore ST_IsValid with LINESTRING Z, as the underlying functionality appears to be correct, eg,



        SELECT ST_Astext(ST_Expand('LINESTRING Z(0 0 0, 0 0 10)'::geometry, 1, 1, 1));


        returns:




        POLYGON Z ((-1 -1 -1,-1 1 -1,1 1 11,1 -1 11,-1 -1 -1))








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        John PowellJohn Powell

        10.9k43050




        10.9k43050



























            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%2f317453%2fpostgis-3d-linestring-validity-with-two-different-z-coordinates%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

            getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

            Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

            NetworkManager fails with “Could not find source connection”Trouble connecting to VPN using network-manager, while command line worksHow can I be notified about state changes to a VPN adapterBacktrack 5 R3 - Refuses to connect to VPNFeed all traffic through OpenVPN for a specific network namespace onlyRun daemon on startup in Debian once openvpn connection establishedpfsense tcp connection between openvpn and lan is brokenInternet connection problem with web browsers onlyWhy does NetworkManager explicitly support tun/tap devices?Browser issues with VPNTwo IP addresses assigned to the same network card - OpenVPN issues?Cannot connect to WiFi with nmcli, although secrets are provided