Geopandas and QGIS Calulating Different Polygon Area Values?Projecting shp from GK3 to UTM32 with BeTA2007How...

Geopandas and QGIS Calulating Different Polygon Area Values?

How come the nude protesters were not arrested?

Cascading Switches. Will it affect performance?

How do governments keep track of their issued currency?

Is using haveibeenpwned to validate password strength rational?

How do I prevent employees from either switching to competitors or opening their own business?

Active low-pass filters --- good to what frequencies?

Generate basis elements of the Steenrod algebra

What is the actual quality of machine translations?

Russian word for a male zebra

What makes Ada the language of choice for the ISS's safety-critical systems?

Binomial to Poisson Approximation : Why does p have to be small

How to safely destroy (a large quantity of) valid checks?

How to use memset in c++?

Does the Long March-11 increase its thrust after clearing the launch tower?

Is it possible to have the age of the universe be unknown?

What to do when surprise and a high initiative roll conflict with the narrative?

Is an entry level DSLR going to shoot nice portrait pictures?

Fixing obscure 8080 emulator bug?

Determining fair price for profitable mobile app business

Soft question: Examples where lack of mathematical rigour cause security breaches?

Which languages would be most useful in Europe at the end of the 19th century?

Has there been a multiethnic Star Trek character?

What ways have you found to get edits from non-LaTeX users?



Geopandas and QGIS Calulating Different Polygon Area Values?


Projecting shp from GK3 to UTM32 with BeTA2007How do I make this into a working CRS in ArcGIS?QGIS doesn't create the correct projections when creating new shp filesClipping a shapefile in QGIS that has user defined projectionsMatching projected tiles from carto with a another tile serviceQGIS NetCDF raster and shape vector not overlapping in EPSG: 27700Scaling two rasters to same elevation scale in QGIS?VN2000 Vietnam QGIS not workingUsing azimuthal equidistant projection with buffers in QGIS?Transforming map with “custom” CRS to WGS84?






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







4















I am just trying to understand why Geopandas and QGIS might calculate areas differently despite using exactly the same shapefiles and exactly the same projections.



Both shapefiles are using EPSG:53032 - Sphere Azimuthal Equidistant. Proj4 string is:




+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs




Despite this both have returned similar, but substantially different results.



QGIS Results:



QGIS Results



Geopandas Results:



Geopandas Results



FYI:




  • QGIS results were calculated using the $area function in the field calculator

  • Shapefiles are accessible here if you want to play with them.

  • Geopandas code is below:


import pandas as pd
import geopandas as gpd

# Import Shapefiles from Google Drive
gdf = gpd.read_file('https://drive.google.com/uc?export=download&id=1RnniXEYTJAfazYKQBMIRphj_gloK9uSm')

# Update CRS
newcrs = "+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs"

gdf = gdf.to_crs(newcrs)
gdf["area"] = (((gdf['geometry'].area)/1000)/1000) # Divited by 1000 to convert into metres

gdf.sort_values(['area'], ascending = False)









share|improve this question









New contributor



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




















  • Why are you converting your shapefile to 'newcrs' when it's already in that CRS? [If it's not in that CRS, are you re-projecting it in QGIS as well?]

    – Jon
    10 hours ago











  • What QGIS version are you using?

    – GreyHippo
    10 hours ago


















4















I am just trying to understand why Geopandas and QGIS might calculate areas differently despite using exactly the same shapefiles and exactly the same projections.



Both shapefiles are using EPSG:53032 - Sphere Azimuthal Equidistant. Proj4 string is:




+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs




Despite this both have returned similar, but substantially different results.



QGIS Results:



QGIS Results



Geopandas Results:



Geopandas Results



FYI:




  • QGIS results were calculated using the $area function in the field calculator

  • Shapefiles are accessible here if you want to play with them.

  • Geopandas code is below:


import pandas as pd
import geopandas as gpd

# Import Shapefiles from Google Drive
gdf = gpd.read_file('https://drive.google.com/uc?export=download&id=1RnniXEYTJAfazYKQBMIRphj_gloK9uSm')

# Update CRS
newcrs = "+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs"

gdf = gdf.to_crs(newcrs)
gdf["area"] = (((gdf['geometry'].area)/1000)/1000) # Divited by 1000 to convert into metres

gdf.sort_values(['area'], ascending = False)









share|improve this question









New contributor



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




















  • Why are you converting your shapefile to 'newcrs' when it's already in that CRS? [If it's not in that CRS, are you re-projecting it in QGIS as well?]

    – Jon
    10 hours ago











  • What QGIS version are you using?

    – GreyHippo
    10 hours ago














4












4








4








I am just trying to understand why Geopandas and QGIS might calculate areas differently despite using exactly the same shapefiles and exactly the same projections.



Both shapefiles are using EPSG:53032 - Sphere Azimuthal Equidistant. Proj4 string is:




+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs




Despite this both have returned similar, but substantially different results.



QGIS Results:



QGIS Results



Geopandas Results:



Geopandas Results



FYI:




  • QGIS results were calculated using the $area function in the field calculator

  • Shapefiles are accessible here if you want to play with them.

  • Geopandas code is below:


import pandas as pd
import geopandas as gpd

# Import Shapefiles from Google Drive
gdf = gpd.read_file('https://drive.google.com/uc?export=download&id=1RnniXEYTJAfazYKQBMIRphj_gloK9uSm')

# Update CRS
newcrs = "+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs"

gdf = gdf.to_crs(newcrs)
gdf["area"] = (((gdf['geometry'].area)/1000)/1000) # Divited by 1000 to convert into metres

gdf.sort_values(['area'], ascending = False)









share|improve this question









New contributor



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











I am just trying to understand why Geopandas and QGIS might calculate areas differently despite using exactly the same shapefiles and exactly the same projections.



Both shapefiles are using EPSG:53032 - Sphere Azimuthal Equidistant. Proj4 string is:




+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs




Despite this both have returned similar, but substantially different results.



QGIS Results:



QGIS Results



Geopandas Results:



Geopandas Results



FYI:




  • QGIS results were calculated using the $area function in the field calculator

  • Shapefiles are accessible here if you want to play with them.

  • Geopandas code is below:


import pandas as pd
import geopandas as gpd

# Import Shapefiles from Google Drive
gdf = gpd.read_file('https://drive.google.com/uc?export=download&id=1RnniXEYTJAfazYKQBMIRphj_gloK9uSm')

# Update CRS
newcrs = "+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs"

gdf = gdf.to_crs(newcrs)
gdf["area"] = (((gdf['geometry'].area)/1000)/1000) # Divited by 1000 to convert into metres

gdf.sort_values(['area'], ascending = False)






qgis coordinate-system geopandas






share|improve this question









New contributor



Daniel Thomas 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



Daniel Thomas 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 5 hours ago









PolyGeo

54.3k1783252




54.3k1783252






New contributor



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








asked 10 hours ago









Daniel ThomasDaniel Thomas

211




211




New contributor



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




New contributor




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















  • Why are you converting your shapefile to 'newcrs' when it's already in that CRS? [If it's not in that CRS, are you re-projecting it in QGIS as well?]

    – Jon
    10 hours ago











  • What QGIS version are you using?

    – GreyHippo
    10 hours ago



















  • Why are you converting your shapefile to 'newcrs' when it's already in that CRS? [If it's not in that CRS, are you re-projecting it in QGIS as well?]

    – Jon
    10 hours ago











  • What QGIS version are you using?

    – GreyHippo
    10 hours ago

















Why are you converting your shapefile to 'newcrs' when it's already in that CRS? [If it's not in that CRS, are you re-projecting it in QGIS as well?]

– Jon
10 hours ago





Why are you converting your shapefile to 'newcrs' when it's already in that CRS? [If it's not in that CRS, are you re-projecting it in QGIS as well?]

– Jon
10 hours ago













What QGIS version are you using?

– GreyHippo
10 hours ago





What QGIS version are you using?

– GreyHippo
10 hours ago










2 Answers
2






active

oldest

votes


















3














Change your QGIS map projection to match your custom CRS:
enter image description here



Then re-compute your areas and you should get
enter image description here



I am not sure why this matters, but clearly QGIS gets some information for computing area from the canvas's CRS (which seems dumb). One way to avoid this is to re-project and save your shapefile, so when you pull it into a fresh map canvas it will automatically set the canvas to the same CRS.



EDIT: the area tool description states:




The area calculated by this function respects both the current
project's ellipsoid setting and area unit settings. For example, if an
ellipsoid has been set for the project then the calculated area will
be ellipsoidal, and if no ellipsoid is set then the calculated area
will be planimetric.




When you re-project your shapefile, the project's ellipsoid setting (specified by EPSG:4326 or whatever your map CRS is set to) does not change, so you need to manually change it to ensure the same ellipsoid as your new shapefile CRS.






share|improve this answer

































    1














    QGIS has two different area functions. One respects the project settings, while the other uses the layer's spatial reference system. To see identical results to the GeoPandas area calculation, use area($geometry) of the $area.





    • $area




      The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.





    • area()




      Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the $area function, which will perform ellipsoidal calculations based on the project's ellipsoid and area unit settings.









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


      }
      });






      Daniel Thomas 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%2f324921%2fgeopandas-and-qgis-calulating-different-polygon-area-values%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









      3














      Change your QGIS map projection to match your custom CRS:
      enter image description here



      Then re-compute your areas and you should get
      enter image description here



      I am not sure why this matters, but clearly QGIS gets some information for computing area from the canvas's CRS (which seems dumb). One way to avoid this is to re-project and save your shapefile, so when you pull it into a fresh map canvas it will automatically set the canvas to the same CRS.



      EDIT: the area tool description states:




      The area calculated by this function respects both the current
      project's ellipsoid setting and area unit settings. For example, if an
      ellipsoid has been set for the project then the calculated area will
      be ellipsoidal, and if no ellipsoid is set then the calculated area
      will be planimetric.




      When you re-project your shapefile, the project's ellipsoid setting (specified by EPSG:4326 or whatever your map CRS is set to) does not change, so you need to manually change it to ensure the same ellipsoid as your new shapefile CRS.






      share|improve this answer






























        3














        Change your QGIS map projection to match your custom CRS:
        enter image description here



        Then re-compute your areas and you should get
        enter image description here



        I am not sure why this matters, but clearly QGIS gets some information for computing area from the canvas's CRS (which seems dumb). One way to avoid this is to re-project and save your shapefile, so when you pull it into a fresh map canvas it will automatically set the canvas to the same CRS.



        EDIT: the area tool description states:




        The area calculated by this function respects both the current
        project's ellipsoid setting and area unit settings. For example, if an
        ellipsoid has been set for the project then the calculated area will
        be ellipsoidal, and if no ellipsoid is set then the calculated area
        will be planimetric.




        When you re-project your shapefile, the project's ellipsoid setting (specified by EPSG:4326 or whatever your map CRS is set to) does not change, so you need to manually change it to ensure the same ellipsoid as your new shapefile CRS.






        share|improve this answer




























          3












          3








          3







          Change your QGIS map projection to match your custom CRS:
          enter image description here



          Then re-compute your areas and you should get
          enter image description here



          I am not sure why this matters, but clearly QGIS gets some information for computing area from the canvas's CRS (which seems dumb). One way to avoid this is to re-project and save your shapefile, so when you pull it into a fresh map canvas it will automatically set the canvas to the same CRS.



          EDIT: the area tool description states:




          The area calculated by this function respects both the current
          project's ellipsoid setting and area unit settings. For example, if an
          ellipsoid has been set for the project then the calculated area will
          be ellipsoidal, and if no ellipsoid is set then the calculated area
          will be planimetric.




          When you re-project your shapefile, the project's ellipsoid setting (specified by EPSG:4326 or whatever your map CRS is set to) does not change, so you need to manually change it to ensure the same ellipsoid as your new shapefile CRS.






          share|improve this answer















          Change your QGIS map projection to match your custom CRS:
          enter image description here



          Then re-compute your areas and you should get
          enter image description here



          I am not sure why this matters, but clearly QGIS gets some information for computing area from the canvas's CRS (which seems dumb). One way to avoid this is to re-project and save your shapefile, so when you pull it into a fresh map canvas it will automatically set the canvas to the same CRS.



          EDIT: the area tool description states:




          The area calculated by this function respects both the current
          project's ellipsoid setting and area unit settings. For example, if an
          ellipsoid has been set for the project then the calculated area will
          be ellipsoidal, and if no ellipsoid is set then the calculated area
          will be planimetric.




          When you re-project your shapefile, the project's ellipsoid setting (specified by EPSG:4326 or whatever your map CRS is set to) does not change, so you need to manually change it to ensure the same ellipsoid as your new shapefile CRS.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 9 hours ago

























          answered 9 hours ago









          JonJon

          1,5371422




          1,5371422

























              1














              QGIS has two different area functions. One respects the project settings, while the other uses the layer's spatial reference system. To see identical results to the GeoPandas area calculation, use area($geometry) of the $area.





              • $area




                The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.





              • area()




                Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the $area function, which will perform ellipsoidal calculations based on the project's ellipsoid and area unit settings.









              share|improve this answer




























                1














                QGIS has two different area functions. One respects the project settings, while the other uses the layer's spatial reference system. To see identical results to the GeoPandas area calculation, use area($geometry) of the $area.





                • $area




                  The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.





                • area()




                  Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the $area function, which will perform ellipsoidal calculations based on the project's ellipsoid and area unit settings.









                share|improve this answer


























                  1












                  1








                  1







                  QGIS has two different area functions. One respects the project settings, while the other uses the layer's spatial reference system. To see identical results to the GeoPandas area calculation, use area($geometry) of the $area.





                  • $area




                    The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.





                  • area()




                    Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the $area function, which will perform ellipsoidal calculations based on the project's ellipsoid and area unit settings.









                  share|improve this answer













                  QGIS has two different area functions. One respects the project settings, while the other uses the layer's spatial reference system. To see identical results to the GeoPandas area calculation, use area($geometry) of the $area.





                  • $area




                    The area calculated by this function respects both the current project's ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.





                  • area()




                    Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the $area function, which will perform ellipsoidal calculations based on the project's ellipsoid and area unit settings.










                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 8 hours ago









                  cskcsk

                  11.6k1337




                  11.6k1337






















                      Daniel Thomas is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      Daniel Thomas is a new contributor. Be nice, and check out our Code of Conduct.













                      Daniel Thomas is a new contributor. Be nice, and check out our Code of Conduct.












                      Daniel Thomas 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%2f324921%2fgeopandas-and-qgis-calulating-different-polygon-area-values%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

                      Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                      Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                      Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...