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










0















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;



enter image description here



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










share|improve this question
























  • 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















0















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;



enter image description here



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










share|improve this question
























  • 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













0












0








0








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;



enter image description here



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










share|improve this question
















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;



enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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










2 Answers
2






active

oldest

votes


















0














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






share|improve this answer























  • ...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


















0














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.






share|improve this answer










New contributor




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




















    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%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









    0














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






    share|improve this answer























    • ...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















    0














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






    share|improve this answer























    • ...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













    0












    0








    0







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






    share|improve this answer













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







    share|improve this answer












    share|improve this answer



    share|improve this answer










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

















    • ...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
















    ...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













    0














    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.






    share|improve this answer










    New contributor




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
























      0














      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.






      share|improve this answer










      New contributor




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






















        0












        0








        0







        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.






        share|improve this answer










        New contributor




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










        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.







        share|improve this answer










        New contributor




        Marcelo zenteno 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 answer



        share|improve this answer








        edited 21 hours ago









        Mat

        709417




        709417






        New contributor




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









        answered yesterday









        Marcelo zentenoMarcelo zenteno

        1




        1




        New contributor




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





        New contributor





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






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



























            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%2f280905%2fpostgis-st-within-st-intersects-differing-srids%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

            រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

            QGIS export composer to PDF scale the map [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Print Composer QGIS 2.6, how to export image?QGIS 2.8.1 print composer won't export all OpenCycleMap base layer tilesSave Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?Export QGIS Print Composer PDF with searchable text labelsQGIS Print Composer does not change from landscape to portrait orientation?How can I avoid map size and scale changes in print composer?Fuzzy PDF export in QGIS running on macSierra OSExport the legend into its 100% size using Print ComposerScale-dependent rendering in QGIS PDF output

            PDF-ში გადმოწერა სანავიგაციო მენიუproject page