PostGIS ST_Within ST_intersects differing SRIDs The Next CEO of Stack OverflowHow to route between lat/lon pairs in pgRouting?PostGIS: ST_Transform function conversion problemPostgis | Problems Reprojecting a Point from UTM ED50 to GEOGRAPHIC ETRS89PostGis: Geometry from UTM textHelp using ST_Buffer for pointsAdd SRID to Pointtransform longitude and latitude to postgis geometry failed: exceeded limits(-14)ST_Area and SRID 4326'UPDATE 0' results for ST_Within query - locating points within polygonsArcGIS vs QGIS vs PostGIS projection issue
How to be diplomatic in refusing to write code that breaches the privacy of our users
Visit to the USA with ESTA approved before trip to Iran
Horror movie/show or scene where a horse creature opens its mouth really wide and devours a man in a stables
How to safely derail a train during transit?
How does practicing restraint and performing actions of merit purify the mind?
Does it take more energy to get to Venus or to Mars?
If the heap is initialized for security, then why is the stack uninitialized?
Text adventure game code
Unreliable Magic - Is it worth it?
Need some help with wall behind rangetop
Is it okay to store user locations?
Why is there a PLL in CPU?
Why didn't Khan get resurrected in the Genesis Explosion?
Natural language into sentence logic
Can a single photon have an energy density?
When Does an Atlas Uniquely Define a Manifold?
Are there languages with no euphemisms?
Why did we only see the N-1 starfighters in one film?
What's the point of interval inversion?
How long to clear the 'suck zone' of a turbofan after start is initiated?
How do I go from 300 unfinished/half written blog posts, to published posts?
Whats the best way to handle refactoring a big file?
% symbol leads to superlong (forever?) compilations
Robert Sheckley short story about vacation spots being overwhelmed
PostGIS ST_Within ST_intersects differing SRIDs
The Next CEO of Stack OverflowHow to route between lat/lon pairs in pgRouting?PostGIS: ST_Transform function conversion problemPostgis | Problems Reprojecting a Point from UTM ED50 to GEOGRAPHIC ETRS89PostGis: Geometry from UTM textHelp using ST_Buffer for pointsAdd SRID to Pointtransform longitude and latitude to postgis geometry failed: exceeded limits(-14)ST_Area and SRID 4326'UPDATE 0' results for ST_Within query - locating points within polygonsArcGIS vs QGIS vs PostGIS projection issue
I have a layer of points and want to join some data from polygons where the two coincide. I might have several points in one poly.
The points were generated from a CSV as;
UPDATE t_osab_with_voa_ndr SET geom_point_4258 = ST_SetSrid(ST_MakePoint(longitude, latitude),4258);
Where they are stated as being ETRS89 projection which is SRID 4258
I'm running into problems as the points have SRID 4258 and the Polys are 27700 I've tried using ;
ALTER TABLE t_osab_with_voa_ndr
ALTER COLUMN geom_point_4258 TYPE geometry(point,27700)
USING ST_Transform(geom_point_4258,27700);
When I look in QGIS I see this;
But when I run;
create or replace view v_spatialjoin_northeast_st_within1 as
select * from t_osab_with_voa_ndr , d_geom_northeast where st_within(t_osab_with_voa_ndr.geom_point, d_geom_northeast.geom);
I get no results when I can see I should
Question 1.
Can i combine the ST_Within / ST_Interects and specify the SRID in the process or am i better transforming the points first?
EDIT:
Reason for my blanks was SQL problem with ST_Within, but still interested to know if you can set SRID or what is the fastest way to execute this
postgis postgresql
|
show 5 more comments
I have a layer of points and want to join some data from polygons where the two coincide. I might have several points in one poly.
The points were generated from a CSV as;
UPDATE t_osab_with_voa_ndr SET geom_point_4258 = ST_SetSrid(ST_MakePoint(longitude, latitude),4258);
Where they are stated as being ETRS89 projection which is SRID 4258
I'm running into problems as the points have SRID 4258 and the Polys are 27700 I've tried using ;
ALTER TABLE t_osab_with_voa_ndr
ALTER COLUMN geom_point_4258 TYPE geometry(point,27700)
USING ST_Transform(geom_point_4258,27700);
When I look in QGIS I see this;
But when I run;
create or replace view v_spatialjoin_northeast_st_within1 as
select * from t_osab_with_voa_ndr , d_geom_northeast where st_within(t_osab_with_voa_ndr.geom_point, d_geom_northeast.geom);
I get no results when I can see I should
Question 1.
Can i combine the ST_Within / ST_Interects and specify the SRID in the process or am i better transforming the points first?
EDIT:
Reason for my blanks was SQL problem with ST_Within, but still interested to know if you can set SRID or what is the fastest way to execute this
postgis postgresql
shouldn't you transform geom_point_4258?
– Ian Turton♦
Apr 26 '18 at 10:16
@IanTurton Apologies i'd been chopping and changing in postgres to look for a fix, yes i should and have. Same error
– mapping dom
Apr 26 '18 at 10:20
@ThingumaBob good spot but still get no results
– mapping dom
Apr 26 '18 at 10:30
You can use ST_SetSRID/ST_Transform within the query, however, if the query uses a spatial index, this will likely prevent it from being used, as it becomes non SARGABLE. If you have to do a full table scan on the points anyway, then there is no harm, but you would certainly want an index on the polygon table.
– John Powell
Apr 26 '18 at 10:48
@JohnPowellakaBarça That sounds like the answer to the originally posed question, can you add it. Although i know realise my error was from elsewhere
– mapping dom
Apr 26 '18 at 10:50
|
show 5 more comments
I have a layer of points and want to join some data from polygons where the two coincide. I might have several points in one poly.
The points were generated from a CSV as;
UPDATE t_osab_with_voa_ndr SET geom_point_4258 = ST_SetSrid(ST_MakePoint(longitude, latitude),4258);
Where they are stated as being ETRS89 projection which is SRID 4258
I'm running into problems as the points have SRID 4258 and the Polys are 27700 I've tried using ;
ALTER TABLE t_osab_with_voa_ndr
ALTER COLUMN geom_point_4258 TYPE geometry(point,27700)
USING ST_Transform(geom_point_4258,27700);
When I look in QGIS I see this;
But when I run;
create or replace view v_spatialjoin_northeast_st_within1 as
select * from t_osab_with_voa_ndr , d_geom_northeast where st_within(t_osab_with_voa_ndr.geom_point, d_geom_northeast.geom);
I get no results when I can see I should
Question 1.
Can i combine the ST_Within / ST_Interects and specify the SRID in the process or am i better transforming the points first?
EDIT:
Reason for my blanks was SQL problem with ST_Within, but still interested to know if you can set SRID or what is the fastest way to execute this
postgis postgresql
I have a layer of points and want to join some data from polygons where the two coincide. I might have several points in one poly.
The points were generated from a CSV as;
UPDATE t_osab_with_voa_ndr SET geom_point_4258 = ST_SetSrid(ST_MakePoint(longitude, latitude),4258);
Where they are stated as being ETRS89 projection which is SRID 4258
I'm running into problems as the points have SRID 4258 and the Polys are 27700 I've tried using ;
ALTER TABLE t_osab_with_voa_ndr
ALTER COLUMN geom_point_4258 TYPE geometry(point,27700)
USING ST_Transform(geom_point_4258,27700);
When I look in QGIS I see this;
But when I run;
create or replace view v_spatialjoin_northeast_st_within1 as
select * from t_osab_with_voa_ndr , d_geom_northeast where st_within(t_osab_with_voa_ndr.geom_point, d_geom_northeast.geom);
I get no results when I can see I should
Question 1.
Can i combine the ST_Within / ST_Interects and specify the SRID in the process or am i better transforming the points first?
EDIT:
Reason for my blanks was SQL problem with ST_Within, but still interested to know if you can set SRID or what is the fastest way to execute this
postgis postgresql
postgis postgresql
edited Nov 24 '18 at 17:21
Vince
14.8k32749
14.8k32749
asked Apr 26 '18 at 10:04
mapping dommapping dom
698513
698513
shouldn't you transform geom_point_4258?
– Ian Turton♦
Apr 26 '18 at 10:16
@IanTurton Apologies i'd been chopping and changing in postgres to look for a fix, yes i should and have. Same error
– mapping dom
Apr 26 '18 at 10:20
@ThingumaBob good spot but still get no results
– mapping dom
Apr 26 '18 at 10:30
You can use ST_SetSRID/ST_Transform within the query, however, if the query uses a spatial index, this will likely prevent it from being used, as it becomes non SARGABLE. If you have to do a full table scan on the points anyway, then there is no harm, but you would certainly want an index on the polygon table.
– John Powell
Apr 26 '18 at 10:48
@JohnPowellakaBarça That sounds like the answer to the originally posed question, can you add it. Although i know realise my error was from elsewhere
– mapping dom
Apr 26 '18 at 10:50
|
show 5 more comments
shouldn't you transform geom_point_4258?
– Ian Turton♦
Apr 26 '18 at 10:16
@IanTurton Apologies i'd been chopping and changing in postgres to look for a fix, yes i should and have. Same error
– mapping dom
Apr 26 '18 at 10:20
@ThingumaBob good spot but still get no results
– mapping dom
Apr 26 '18 at 10:30
You can use ST_SetSRID/ST_Transform within the query, however, if the query uses a spatial index, this will likely prevent it from being used, as it becomes non SARGABLE. If you have to do a full table scan on the points anyway, then there is no harm, but you would certainly want an index on the polygon table.
– John Powell
Apr 26 '18 at 10:48
@JohnPowellakaBarça That sounds like the answer to the originally posed question, can you add it. Although i know realise my error was from elsewhere
– mapping dom
Apr 26 '18 at 10:50
shouldn't you transform geom_point_4258?
– Ian Turton♦
Apr 26 '18 at 10:16
shouldn't you transform geom_point_4258?
– Ian Turton♦
Apr 26 '18 at 10:16
@IanTurton Apologies i'd been chopping and changing in postgres to look for a fix, yes i should and have. Same error
– mapping dom
Apr 26 '18 at 10:20
@IanTurton Apologies i'd been chopping and changing in postgres to look for a fix, yes i should and have. Same error
– mapping dom
Apr 26 '18 at 10:20
@ThingumaBob good spot but still get no results
– mapping dom
Apr 26 '18 at 10:30
@ThingumaBob good spot but still get no results
– mapping dom
Apr 26 '18 at 10:30
You can use ST_SetSRID/ST_Transform within the query, however, if the query uses a spatial index, this will likely prevent it from being used, as it becomes non SARGABLE. If you have to do a full table scan on the points anyway, then there is no harm, but you would certainly want an index on the polygon table.
– John Powell
Apr 26 '18 at 10:48
You can use ST_SetSRID/ST_Transform within the query, however, if the query uses a spatial index, this will likely prevent it from being used, as it becomes non SARGABLE. If you have to do a full table scan on the points anyway, then there is no harm, but you would certainly want an index on the polygon table.
– John Powell
Apr 26 '18 at 10:48
@JohnPowellakaBarça That sounds like the answer to the originally posed question, can you add it. Although i know realise my error was from elsewhere
– mapping dom
Apr 26 '18 at 10:50
@JohnPowellakaBarça That sounds like the answer to the originally posed question, can you add it. Although i know realise my error was from elsewhere
– mapping dom
Apr 26 '18 at 10:50
|
show 5 more comments
2 Answers
2
active
oldest
votes
The reason for the blanks in this instance was due to my query, what worked was rewriting this as below, code taken from good blog post here
SELECT pts.*, blocks.inspireid as inspire_poly_id
FROM t_osab_with_voa_ndr AS pts
INNER JOIN d_geom_northeast AS blocks
ON st_within(pts.geom_point, blocks.geom);
...actually, that's weird since, although the(INNER) JOIN ... ON ...
should be faster here than (and the preferred style in general in favour to) aCROSS JOIN ... WHERE ...
, in the end it should give the same reuslts...
– ThingumaBob
Apr 26 '18 at 11:12
I'm running the same process in QGIS to double check my code..
– mapping dom
Apr 26 '18 at 12:14
add a comment |
For me what works is to use the ST_transforn instead of ST_Set SRID in order to change the SPATIAL REFERENCE SYSTEM. After that the SPATIAL query wtih INNER JOIN or the other one works perfectly.
Here is the
explanation.
New contributor
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%2f280905%2fpostgis-st-within-st-intersects-differing-srids%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The reason for the blanks in this instance was due to my query, what worked was rewriting this as below, code taken from good blog post here
SELECT pts.*, blocks.inspireid as inspire_poly_id
FROM t_osab_with_voa_ndr AS pts
INNER JOIN d_geom_northeast AS blocks
ON st_within(pts.geom_point, blocks.geom);
...actually, that's weird since, although the(INNER) JOIN ... ON ...
should be faster here than (and the preferred style in general in favour to) aCROSS JOIN ... WHERE ...
, in the end it should give the same reuslts...
– ThingumaBob
Apr 26 '18 at 11:12
I'm running the same process in QGIS to double check my code..
– mapping dom
Apr 26 '18 at 12:14
add a comment |
The reason for the blanks in this instance was due to my query, what worked was rewriting this as below, code taken from good blog post here
SELECT pts.*, blocks.inspireid as inspire_poly_id
FROM t_osab_with_voa_ndr AS pts
INNER JOIN d_geom_northeast AS blocks
ON st_within(pts.geom_point, blocks.geom);
...actually, that's weird since, although the(INNER) JOIN ... ON ...
should be faster here than (and the preferred style in general in favour to) aCROSS JOIN ... WHERE ...
, in the end it should give the same reuslts...
– ThingumaBob
Apr 26 '18 at 11:12
I'm running the same process in QGIS to double check my code..
– mapping dom
Apr 26 '18 at 12:14
add a comment |
The reason for the blanks in this instance was due to my query, what worked was rewriting this as below, code taken from good blog post here
SELECT pts.*, blocks.inspireid as inspire_poly_id
FROM t_osab_with_voa_ndr AS pts
INNER JOIN d_geom_northeast AS blocks
ON st_within(pts.geom_point, blocks.geom);
The reason for the blanks in this instance was due to my query, what worked was rewriting this as below, code taken from good blog post here
SELECT pts.*, blocks.inspireid as inspire_poly_id
FROM t_osab_with_voa_ndr AS pts
INNER JOIN d_geom_northeast AS blocks
ON st_within(pts.geom_point, blocks.geom);
answered Apr 26 '18 at 10:52
mapping dommapping dom
698513
698513
...actually, that's weird since, although the(INNER) JOIN ... ON ...
should be faster here than (and the preferred style in general in favour to) aCROSS JOIN ... WHERE ...
, in the end it should give the same reuslts...
– ThingumaBob
Apr 26 '18 at 11:12
I'm running the same process in QGIS to double check my code..
– mapping dom
Apr 26 '18 at 12:14
add a comment |
...actually, that's weird since, although the(INNER) JOIN ... ON ...
should be faster here than (and the preferred style in general in favour to) aCROSS JOIN ... WHERE ...
, in the end it should give the same reuslts...
– ThingumaBob
Apr 26 '18 at 11:12
I'm running the same process in QGIS to double check my code..
– mapping dom
Apr 26 '18 at 12:14
...actually, that's weird since, although the
(INNER) JOIN ... ON ...
should be faster here than (and the preferred style in general in favour to) a CROSS JOIN ... WHERE ...
, in the end it should give the same reuslts...– ThingumaBob
Apr 26 '18 at 11:12
...actually, that's weird since, although the
(INNER) JOIN ... ON ...
should be faster here than (and the preferred style in general in favour to) a CROSS JOIN ... WHERE ...
, in the end it should give the same reuslts...– ThingumaBob
Apr 26 '18 at 11:12
I'm running the same process in QGIS to double check my code..
– mapping dom
Apr 26 '18 at 12:14
I'm running the same process in QGIS to double check my code..
– mapping dom
Apr 26 '18 at 12:14
add a comment |
For me what works is to use the ST_transforn instead of ST_Set SRID in order to change the SPATIAL REFERENCE SYSTEM. After that the SPATIAL query wtih INNER JOIN or the other one works perfectly.
Here is the
explanation.
New contributor
add a comment |
For me what works is to use the ST_transforn instead of ST_Set SRID in order to change the SPATIAL REFERENCE SYSTEM. After that the SPATIAL query wtih INNER JOIN or the other one works perfectly.
Here is the
explanation.
New contributor
add a comment |
For me what works is to use the ST_transforn instead of ST_Set SRID in order to change the SPATIAL REFERENCE SYSTEM. After that the SPATIAL query wtih INNER JOIN or the other one works perfectly.
Here is the
explanation.
New contributor
For me what works is to use the ST_transforn instead of ST_Set SRID in order to change the SPATIAL REFERENCE SYSTEM. After that the SPATIAL query wtih INNER JOIN or the other one works perfectly.
Here is the
explanation.
New contributor
edited 21 hours ago
Mat
709417
709417
New contributor
answered yesterday
Marcelo zentenoMarcelo zenteno
1
1
New contributor
New contributor
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%2f280905%2fpostgis-st-within-st-intersects-differing-srids%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
shouldn't you transform geom_point_4258?
– Ian Turton♦
Apr 26 '18 at 10:16
@IanTurton Apologies i'd been chopping and changing in postgres to look for a fix, yes i should and have. Same error
– mapping dom
Apr 26 '18 at 10:20
@ThingumaBob good spot but still get no results
– mapping dom
Apr 26 '18 at 10:30
You can use ST_SetSRID/ST_Transform within the query, however, if the query uses a spatial index, this will likely prevent it from being used, as it becomes non SARGABLE. If you have to do a full table scan on the points anyway, then there is no harm, but you would certainly want an index on the polygon table.
– John Powell
Apr 26 '18 at 10:48
@JohnPowellakaBarça That sounds like the answer to the originally posed question, can you add it. Although i know realise my error was from elsewhere
– mapping dom
Apr 26 '18 at 10:50