New answers tagged

0

Following the clues given in @RomaH's answer, I've got what I wanted, using a subquery: with cte as (select m.utmcode utm, c.code_18 code, round(Sum(st_area(st_intersection(m.geom,c.geom)))/10000) area from public.malla m left join public.clc18 c on st_intersects(m.geom,c.geom) group by utm, code) select utm, MAX (CASE WHEN code = '111' THEN "area&...


2

I think what you are wanting can be accomplished by a pivot. This SO post question covers it quite well. https://stackoverflow.com/questions/69263964/how-to-pivot-in-postgresql This can be accomplished through your select statement by specifying a filter for each Corine types you want to see. As the statement is executed each record is checked against the ...


0

This is an old post/question but still seems relevant. If I understand the question correctly, this can be easily done using the Cell Statistics tool within the Imagery Analyst tool set. out_raster = arcpy.ia.CellStatistics("NameOfyourInputRaster", "SUM", "DATA", "SINGLE_BAND", 90, "AUTO_DETECT"); out_raster....


2

The issue is that you're referencing a field that you just created and named. You'll need to use a CTE or subquery to use the ha field in your query: with cte as (select m.utmcode , cast(st_area(m.geom)/10000 as integer) ha from malla_p m join pen_bal c on st_within(m.geom, c.geom) group by m.utmcode, m.geom) select * from cte where ha <...


0

It is possible to use the Field Calculator within the Graphical Modeler, if one makes use of the input vector field. Consider a vector layer, that is the output of a dissolve and multipart to singleparts operation, resulting in wrong values of Shape_Area: Here, it is called Layer_for_calculating_area, and the field to be recalculated is Shape_Area. 1. ...


3

Use the following expression in the Field Calculator of layer 1: $area - array_sum(overlay_contains('layer_2', "area")) Explanation: With overlay_contains(), you get all the polygons from layer 2 that are inside the current feature of layer 1. With "area", you refer to the attribute with this name. The result is an array, thus to add all ...


1

If you want to divide polygon before it's published to the web, you can use GIS tools, such as for example ArcGIS Pro (see https://pro.arcgis.com/en/pro-app/latest/help/editing/divide-a-polygon-by-a-value.htm) or QGIS with the Polygon Divider plugin (see https://github.com/jonnyhuck/RFCL-PolygonDivider). I'm not aware of any JS library than could do this on ...


1

Probably long after the OP needs this, but here is an answer I think should be more straightforward than the existing ones. This uses QGIS 3.16. Dissolve the coral reef layer (Vector > Geoprocessing Tools > Dissolve) Run the Intersection tool (Vector > Geoprocessing Tools > Intersection) Input layer = dissolved coral reef layer from step 1 ...


3

I think you make things a bit complicated, because there is a very useful module called geopandas.overlay(). Let's assume there are two polygon layers 'grid' (comparable with your 'Small_polygon') and 'layer' (comparable with your 'Polygons'), see the image below. Using the following code: import geopandas as gpd _layer = "C:/Documents/Python Scripts/...


7

Use GeoPandas Overlay polygons = gpd.read_file("Polygons.shp") small_polygon = gpd.read_file("Small_polygon.shp") Intersection of the two GeoDataFrames: result = gpd.overlay(polygons,small_polygon, how='intersection') Result Areas of the intersection polygons result['area'] =result.apply(lambda row: row.geometry.area,axis=1)


4

You're looking for a "Set Overlay" operation. Here's the way to do it in geopandas: poly_intersections = Polygons.overlay(Small_polygon, how='intersection') Here's some more documentation on how to work with it: https://geopandas.org/en/stable/docs/user_guide/set_operations.html Then you can get the area of the new cut/split polygons by doing this:...


5

I don't use geopandas but in any GIS system what you are describing is a Union or Intersect style operation. This you can apply at the dataset level and I suspect would be far more efficient than looping over individual geometries as you are doing now. It appears that geopandas offers up such geoprocessing using overlay().


4

Another option is using the "Display" through RMC > Properties > Display. Paste the following expression format_number($area,2,'de') into the 'Display Name' and press Apply. Note: I made it in very intuitive way, more sophisticated output can be achieved via the 'HTML Map Tip'. After hover over the feature and get the output


7

I personally find the identify tool sometimes too clunky. Here another approach: To show the area for a polygon without using an additional field, you can just use a formula for a label with the $area function, e.g.: round($area/10000,1) will give you the area of the features in hectares. As you just want to see the area when pointing/clicking, you could ...


3

Also possible by means of PyQGIS. def feature_area(selected, _, __): n = len(selected) if n == 1: g = iface.activeLayer().selectedFeatures()[0].geometry() print("The area of selected feature is " + '{:0,.2f}'.format(g.area()) + " m²") elif n > 1: print("Select only one feature"...


2

Try using the "Identify Features" tool (Ctrl+Shift+I) from the Attributes Toolbar. There will be two attributes: "Area (Cartesian)" and "Area (Ellipsoidal - EPSG:7019)" Before starting, make sure that the Hide Derived Attributes from Results option is unchecked.


9

Create a label with the expressin $area (I should have used round($area)):


10

The identify tool does offer you this information. Click any feature, then expand the topmost dropdown menu. Here all basic geometric information is hidden, incl. the area and circumfence.


0

This is a tricky aspect of GEE, what you are doing is that you are mixing client-side objects (i.e. "pure" JavaScript language, in this case your "if" loop) with server-side objects (i.e. Earth Engine objects, in this case "n" since you calculated it using the "divide" function) (check out this guide) A quick ...


Top 50 recent answers are included