1

In QGIS I want to know how can I find the scale of a map. I have state boundaries with me, and when I calculate the length of the boundary, it comes out to be something like 245.854.

This most definitely cannot be a state perimeter because states have very large boundaries.

How can I know what is the scale to which if I multiply 245.854, I would get the actual geographic value?

This is my line file, I want to know the actual geographical length according to the map, for example, if I am getting my total as 245 units, to what factor should I multiply it to know its actual conversion into the real world?

The data is Located in India, and here is the file: https://drive.google.com/drive/folders/1deA7GxeNK54hXrOGBp910-v7gMYsjEQg?usp=sharing, the data I uploaded was ESPG 4326, but I converted it to ESPG 3857 so that I can make buffers around line and I get meters in the buffer window

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Varin Anand
  • 119
  • 7
  • 3
    245.854 sounds like the totally correct geographic value. But since this is degrees, it is a useless value. So, since your data probably is in CRS EPSG 4326, you need to transform/reproject it first, to a CRS using m as unit of measurement. – Erik Jun 18 '21 at 04:49
  • No, my data is in CRS EPSG 3857 which uses 'm' as unit of measurement, my shp file is a line file and I am using $length to calculate the length of total lines. – Varin Anand Jun 18 '21 at 04:56
  • 1
    What state is this? Can you include a picture of your map? – PolyGeo Jun 18 '21 at 05:17
  • 4
    Perhaps see https://gis.stackexchange.com/questions/242545/how-can-epsg3857-be-in-meters on the wisdom of using epsg:3857 for distance measurement. – nmtoken Jun 18 '21 at 05:28
  • Measurements in QGIS are in CRS units and thus independent of scale. As mentioned, the only thing is to find an appropriate CRS: neither 4326 nor 3857 are of any use. – Babel Jun 18 '21 at 06:11
  • My main idea is, I just want to know to which factor can i multiply my values to know the geographical values in the real word, because to me that 245 units is useless until I know the real perimeter of that boundary, like obviously, a state boundary cannot be 245 meters, it has to be in thousands of kms. I just wanna know the factor – Varin Anand Jun 18 '21 at 08:17
  • 2
    Whatever factor you use: based on CRS 4326 or 3857, results will be always wrong. Only way to get accurate results is to use a correct CRS. No need of any factor to multiply. QGIS does not consider scale for measurements, this is a visualization thing only that has no connection to how measurements are calculated. As long as you don't tell us more details, it's difficult to give more advice. Can you provide your data for testing? Probably they are in the wrong CRS, that's why you get wrong measurements. To get help, tell us what CRS your data is in and where on Earth they are located. – Babel Jun 18 '21 at 08:40

1 Answers1

6

The solution

You have defined a wrong CRS. To solve the problem: Right-click your layer, set CRS back to EPSG:4326. Now it is in the correct place: Always load a basemap in the background to check if your data is in the right place!

Now re-project your layer to an appropriate CRS (e.g. EPSG:7755, but there might be better ones) with one of these two solutions:

  1. right click on your layer / Export / Safe features as... and select the CRS you want to reproject to
  2. Menu Processing / Toolbox / Reproject layer and select the CRS you want to reproject to

Now you can use $length to get length in meters, $length/1000 to get length in km.

The problem

The data you provided come with a wrong CRS definition: if I load your data and add a basemap, they are in the Atlantic, nearby the intersection of the equator with the prime meridian (0° E/W). The CRS of your data is set to EPSG:3857, but in fact the coordinate values are saved in EPSG:4326 or lat/lon format: this leads to a wrong interpretation and localization.

You probably changed the layer CRS: never do that, see here (you probably did what is described in point 2): https://gis.stackexchange.com/a/383437/88814

Screenshot: drag-and-drop a XYZ-Tile like OpenStreetMap from the Browser-Panel to the layer panel. Make sure your lines are correctly located. Otherwise, follow the steps above: set CRS back to EPSG:4326 enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
  • If i am using a plugin how can I know which CRS to choose to get the correct values? – Varin Anand Jun 18 '21 at 15:42
  • What plugin do you want to use? It does not depend on plugin or not. You should select an appropriate CRS for the area of your interest. See more https://docs.qgis.org/3.16/en/docs/gentle_gis_introduction/coordinate_reference_systems.html?#map-projections-with-equal-distance and here https://docs.qgis.org/3.16/en/docs/user_manual/introduction/general_tools.html#measuring – Babel Jun 18 '21 at 15:54
  • Local UTM zone could be a good choice in your case - look for the one where your area fits in. See also here, section "which coordinate system should you use for the measurement?": https://www.esri.com/arcgis-blog/products/js-api-arcgis/mapping/measuring-distances-and-areas-when-your-map-uses-the-mercator-projection/?rmedium=blogs_esri_com&rsource=/esri/arcgis/2010/03/05/measuring-distances-and-areas-when-your-map-uses-the-mercator-projection/ – Babel Jun 18 '21 at 15:55
  • My problem here is I am making a plugin using Python which takes a map file shp and returns the length of lines, i.e the perimeter. Now i want to know how can we know the actual geographic values that were there from the values that I am getting. I got why ESPG 7757 was chosen, because it the Indian Location, but even after choosing 7757, My total perimeter is coming out to be 282.23 which obviously cannot be right since a perimeter of 5 indian states cannot be 282.33. I wanna know the factor to which I multiply my calculation value to know my actual length – Varin Anand Jun 18 '21 at 17:32
  • Also, can you please explain what is a basemap, how can we load it? – Varin Anand Jun 18 '21 at 17:37
  • 3
    If you get a length of 282.23, it means you did not follow the steps from my answer: 1.) set CRS back to EPSG:4326 2.) re-project, 3) add a basemap for control. If you don't follow this procedure, you will never get any meaningful values. I repeat for the 3rd time: YOU DON'T NEED A FACTOR TO MULTIPLY! Before starting to program a plugin, I would advice to make yourself comfortable with the basic concepts of GIS/QGIS. To add a basemap, see: https://gis.stackexchange.com/a/217670/88814 - If your line-layer does not fall in the right place (India), you know something is wrong. – Babel Jun 18 '21 at 20:49
  • I am really sorry I annoyed you, It is working perfectly fine now, I am getting a Value of 3.01 x 10^7 meters which definitely makes sense. I really would have rewarded you If I could in anyway. Thanks for all the help, Bless You! – Varin Anand Jun 19 '21 at 04:20
  • Like in the given shp file, I knew that it is India and so it might be ESPG 7757, but for example I am making a plugin, How would I know which area does the data belongs to? Also, If I reproject my data from 4326 to 3857 and not 7757, still it is completely aligned with the OSM, so does that mean that 3857 is also a correct CRS? – Varin Anand Jun 19 '21 at 05:13
  • 2
    You're welcome, you already awarded my effort by accepting the answer: thats how this site works. You reward answers by accepting and/or upvoting. You always should select the CRS manually, so the plugin should have an option to select the CRS. For details, post a new question here as comments are not for extended discussions. – Babel Jun 19 '21 at 08:51