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?

How is water heavier than petrol, even though its molecular weight is less than petrol?

Can Rydberg constant be in joules?

Zeros of the Hadamard product of holomorphic functions

Union with anonymous struct with flexible array member

Generate basis elements of the Steenrod algebra

How to hide rifle during medieval town entrance inspection?

How do governments keep track of their issued currency?

1980s live-action movie where individually-coloured nations on clouds fight

Check if three arrays contains the same element

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

What's up with this leaf?

Why doesn't Adrian Toomes give up Spider-Man's identity?

Importance of Building Credit Score?

Certain search in list

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

A IP can traceroute to it, but can not ping

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

How does an ordinary object become radioactive?

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

Is White controlling this game?

Second (easy access) account in case my bank screws up

Extreme flexible working hours: how to control people and activities?

Using "subway" as name for London Underground?

Implement Own Vector Class in C++



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
    8 hours ago











  • What QGIS version are you using?

    – GreyHippo
    8 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
    8 hours ago











  • What QGIS version are you using?

    – GreyHippo
    8 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 4 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 8 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
    8 hours ago











  • What QGIS version are you using?

    – GreyHippo
    8 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
    8 hours ago











  • What QGIS version are you using?

    – GreyHippo
    8 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
8 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
8 hours ago













What QGIS version are you using?

– GreyHippo
8 hours ago





What QGIS version are you using?

– GreyHippo
8 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 8 hours ago

























          answered 8 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 7 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

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її