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;
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
add a comment |
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
This looks like a bug to me.SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry);
returns true, whileSELECT 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
add a comment |
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
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
postgis
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, whileSELECT 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
add a comment |
This looks like a bug to me.SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry);
returns true, whileSELECT 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
add a comment |
1 Answer
1
active
oldest
votes
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))
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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))
add a comment |
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))
add a comment |
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))
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))
answered 2 days ago
John PowellJohn Powell
10.9k43050
10.9k43050
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
This looks like a bug to me.
SELECT st_isvalid('LINESTRING Z(0 1 1, 0 0 10)'::geometry);
returns true, whileSELECT 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