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?

Why would future John risk sending back a T-800 to save his younger self?

Why can my keyboard only digest 6 keypresses at a time?

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

Russian word for a male zebra

Importance of Building Credit Score?

How to hide an urban landmark?

Does a scale have more than seven chords?

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

How to use memset in c++?

Overlapping String-Blocks

Pathfinder warbow concept review

Is this use of the expression "long past" correct?

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

Thread Pool C++ Implementation

Why didn't Voldemort recognize that Dumbledore was affected by his curse?

How did old MS-DOS games utilize various graphic cards?

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

How can I end combat quickly when the outcome is inevitable?

What is the purpose of the goat for Azazel, as opposed to conventional offerings?

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

Medieval flying castle propulsion

Is it possible to have a wealthy country without a middle class?

How can I get an unreasonable manager to approve time off?

Pre-1972 sci-fi short story or novel: alien(?) tunnel where people try new moves and get destroyed if they're not the correct ones



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

























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

                      ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

                      Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

                      19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу