How to expand the raster's extents and add null value into the expansion part?

I have run a hydraulic model and I got a result of depth raster of the sediment (the brown one). I want to sum the sediment raster with the topography raster (the black one) so I will have the elevation of riverbed after the sediment depth is applied.

My goal is to have a cross-profile of the river after the sediment depth is applied onto the initial riverbed elevation. I used to use Stack Profile tool, and use the help of a line shapefile to sign the location of cross-profile. The problem is that the sediment raster's extent is not large enough to cope with the topography raster so when I created a cross-profile of them, both raster did not align correctly.

What steps should I take if I want to expand the sediment raster's extent and put null values in the expansion cells?

Do you have any idea of what I should do in order to get both cross profiles of sediment raster and topography raster on exact place (for example: the pink line)?

If it is an option. Recreate the Sediment raster, but pre-define the processing extent in your tools' (or model) environment as your DEM extent. This sould expand the extent of your output, and overlay its cells to match those of the DEM. However if your Hydrualic model isn't based on arcgis-desktop, you might want to resampling it, using the resample tool. You might want to define processing extent to the extent of your dem as well. Note that resampling alter your data, i.e. of your sediment raster.

I finally found how to do it! My actual problem is that the sediment raster contains "NoData" values so the Stack Profile tool can not read the values. So I simply sum topography raster with sediment raster using Raster Calculator with applying Con(IsNull) function to sediment raster => Con(Isnull("sediment raster"), 0 , "sediment raster").

Soils2026 and digital soil mapping – A foundation for the future of soils information in the United States

Soils2026 will provide a complete, consistent, correct, comprehensive, and current inventory of soils for the US.

Digital soil mapping will produce raster products for interpretation of soil physical, chemical, and biological properties.

Soils2026 products will include continuous soil properties predictions and estimates of uncertainty.

A training curriculum and a mentoring program have been developed to build capacity among DSM practitioners in the US.

Soils2026 will deliver the best available data about soil science to assess resource impacts and guide conservation.

2 Answers 2

It turns out that the issue was that I was setting padding on the TextView in the group header, which was then distorting the image. I found the whole default group header and custom indicator to be extremely cumbersome to work with, you can't really customize the row at all without distorting the image, so I ended up using a custom view for the group header instead.

Set the ExpandableListView's groupIndicator to @null:

Add a custom group header, in my case ListViewGroupHeader.axml:

Set the custom layout in your adapter's GetGroupView method, keying off of the isExpanded property for which image to show:

How can I extend my viewport in openGL to keep printed text clipped properly?

I am using this code to draw a text in openGL with GLUT:

Code (init part) which sets my origin (0,0) into top-left corner and maintains proper screen-resolution based coordination system :

And everything would be perfect if not only the fact that when X and Y starts at negative coordinations (due to the fact that objects with text printed as a tag are partially outside of the view, then the whole text is not being drawn. lets imagine that I have a object with text tag on top of it and it enters the view from left top corner at x = -40, y = 40 :

The text is not being printed until is drawn from exactly X => 0 coordination. Also this problem doesn't exist when text has to be clipped on RIGHT side - then it is printed properly - this is where I I realized that it has to do with initial position of the text.

My question is - how can I EXTEND properly my viewport / screen mapping to :

1) preserve screen coordinations from top-left corner (0,0) to bottom-right (height,width) 2) with internally extended those values just during the printing the text - so the text would get clipped instead of disappearing ?

Although I did my research, I couldn't for 2 days now come to any solution. I tried to play with glViewport and glOrtho but none of changes and approaches I tried (like for example setting glViewport to -x,-y,x*2,y*2) would do the trick - those always mess with my screen coordination system which is essential to keep at window-resolution based.

10.070 How do I draw glBitmap() or glDrawPixels() primitives that have an initial glRasterPos() outside the window's left or bottom edge?

When the raster position is set outside the window, it's often outside the view volume and subsequently marked as invalid. Rendering the glBitmap and glDrawPixels primitives won't occur with an invalid raster position. Because glBitmap/glDrawPixels produce pixels up and to the right of the raster position, it appears impossible to render this type of primitive clipped by the left and/or bottom edges of the window.

However, here's an often-used trick: Set the raster position to a valid value inside the view volume. Then make the following call:

This tells OpenGL to render a no-op bitmap, but move the current raster position by (xMove,yMove). Your application will supply (xMove,yMove) values that place the raster position outside the view volume. Follow this call with the glBitmap() or glDrawPixels() to do the rendering you desire.

Sadly - I can't put this advice in work - and once I use it - the text is completely missing.


Large carnivores have historically been decreasing worldwide, often as a result of human-carnivore conflicts. However, large carnivores are recovering throughout Europe, and European management scenarios can provide important insights into broad issues related to human-large carnivore existence. After becoming almost extinct in Sweden during the mid-19th century the Swedish grey wolf (Canis lupus) population has now recovered. Current national wolf management aims to promote distribution shifts from the current areas in central Sweden, potentially also into a previously exempt reindeer husbandry area. Prior wolf re-introductions have highlighted the necessity of pro-active management for colonization success. Identification of likely range expansion areas could therefore be paramount for a successful Swedish wolf management. We characterized the demographic and spatial progression of Swedish wolves during 2001–2015 and used a MaxEnt approach to species distribution models to identify potential range expansion areas. The Swedish wolf population had expanded from 10 to almost 60 reproductions or territorial pairs, and increased in both range size and density. Our distribution models suggested that Swedish wolf management may face trade-offs between costs of hosting wolves in densely populated areas in southern Sweden with cattle and sheep and the costs of allowing wolves to expand into reindeer husbandry areas with associated cultural and economic consequences. Spatially explicit data on the economic, social and cultural factors associated with wolf conflict and acceptance may be paramount for developing optimal management strategies in the face of such a trade-off.

ArcGIS Pro edit raster values by changing a specific amount of pixels into another unique value class (expand function)

I have a landuse map that consists of raster data. I have 10 landuse classes (unique values). I want to expand one class by a specified amount of pixels. I already tried to use the Geoprocessing function expand, but with that function I can only add zones with an integer greater than 0. So I can only expand the zone value class by adding 1 (or any other integer) more pixel for each existing zone. As I can't use decimal I can not expand my class by a specific amount of pixels. Do you know about any other function to help with this issue? I also tried the pixel editor, but with that I have to mark every pixel that I want to change. Is there any automatic function to use?

Edit: This covers the most likely interpretation, in my opinion, of "[not] null or empty" as inferred from the question, including it's pseudo-code and my own early experience with XSLT. I.e., "What is the equivalent of the following Java?":

For more details e.g., distinctly identifying null vs. empty, see johnvey's answer below and/or the XSLT 'fiddle' I've adapted from that answer, which includes the option in Michael Kay's comment as well as the sixth possible interpretation.

Absent of any other information, I'll assume the following XML:

A sample use case would look like:

To test if the value of a certain node is empty

It depends on what you mean by empty.

  • Contains no child nodes: not(node())
  • Contains no text content: not(string(.))
  • Contains no text other than whitespace: not(normalize-space(.))
  • Contains nothing except comments: not(node()[not(self::comment())])

First two deal with null value and second two deal with empty string.

In some cases, you might want to know when the value is specifically null, which is particularly necessary when using XML which has been serialized from .NET objects. While the accepted answer works for this, it also returns the same result when the string is blank or empty, i.e. '', so you can't differentiate.

So you can simply test the attribute.

Sometimes it's necessary to know the exact state and you can't simply check if CategoryName is instantiated, because unlike say Javascript

Will return true for a null element.

How can I check if a value is null or empty with XSL?

For example, if categoryName is empty?

This is probably the simplest XPath expression (the one in accepted answer provides a test for the opposite, and would be longer, if negated):


The argument to the not() function above is false() exactly when there is no categoryName child ("null") of the context item, or the (single such) categoryName child has string value -- the empty string.

I'm using a when choosing construct.

For example:

In XSLT 2.0 use:

Here is a complete example:

When this transformation is applied on the following XML document:

the wanted, correct result is produced:

When applied on this XML document:

the correct result is produced:

Similarly, use this XSLT 1.0 transformation:

Do note: No conditionals are used at all. Learn more about the importance of avoiding conditional constructs in this nice Pluralsight course:

I know this question is old, but between all the answers, I miss one that is a common approach for this use-case in XSLT development.

I am imagining that the missing code from the OP looks something like this:

And that the input looks something like this:

I.e., I assume there can be zero, empty, single or multiple categoryName elements. To deal with all these cases using xsl:choose -style constructs, or in other words, imperatively, is quickly getting messy (even more so if elements can be at different levels!). A typical programming idiom in XSLT is using templates (hence the T in XSLT), which is declarative programming, not imperative (you don't tell the processor what to do, you just tell what you want output if certain conditions are met). For this use-case, that can look something like the following:

This works (with any XSLT version), because the first one above has a higher precedence (it has a predicate). The "fall-through" matching template, the second one, catches anything that is not valid. The third one then takes care of outputting the categoryName value in a proper way.

Note that in this scenario there is no need to specifially match categories or category , because the processor will automatically process all children, unless we tell it otherwise (in this example, the second and third template do not further process the children, because there is no xsl:apply-templates in them).

This approach is more easily extendible then the imperative approach, because it automically deals with multiple categories and it can be expanded for other elements or exceptions by just adding another matching template. Programming without if-branches.

Note: there is no such thing as null in XML. There is xsi:nil, but that is rarely used, especially rarely in untyped scenarios without a schema of some sort.

33 Answers 33

I see that this question became popular so I post my actual solution. The main advantage is that you don't have to know the expanded height to apply the animation and once the view is expanded, it adapts height if content changes. It works great for me.

As mentioned by @Jefferson in the comments, you can obtain a smoother animation by changing the duration (and hence the speed) of the animation. Currently, it has been set at a speed of 1dp/ms

I stumbled over the same problem today and I guess the real solution to this question is this

You will have to set this property for all topmost layouts, which are involved in the shift. If you now set the visibility of one layout to GONE, the other will take the space as the disappearing one is releasing it. There will be a default animation which is some kind of "fading out", but I think you can change this - but the last one I have not tested, for now.

I was trying to do what I believe was a very similar animation and found an elegant solution. This code assumes that you are always going from 0->h or h->0 (h being the maximum height). The three constructor parameters are view = the view to be animated (in my case, a webview), targetHeight = the maximum height of the view, and down = a boolean which specifies the direction (true = expanding, false = collapsing).

I took @LenaYan 's solution that didn't work properly to me (because it was transforming the View to a 0 height view before collapsing and/or expanding) and made some changes.

Now it works great, by taking the View's previous height and start expanding with this size. Collapsing is the same.

You can simply copy and paste the code below:

Easy enough!

Thanks LenaYan for the initial code!

An alternative is to use a scale animation with the following scaling factors for expanding:

@Tom Esterez's answer, but updated to use view.measure() properly per Android getMeasuredHeight returns wrong values !

Ok, I just found a VERY ugly solution :

If you don't want to expand or collapse all the way - here is a simple HeightAnimation -

I adapted the currently accepted answer by Tom Esterez, which worked but had a choppy and not very smooth animation. My solution basically replaces the Animation with a ValueAnimator , which can be fitted with an Interpolator of your choice to achieve various effects such as overshoot, bounce, accelerate, etc.

This solution works great with views that have a dynamic height (i.e. using WRAP_CONTENT ), as it first measures the actual required height and then animates to that height.

You then simply call expand( myView ) or collapse( myView ) .

Making use of Kotlin Extension Functions this is tested and shortest answer

Just call animateVisibility(expand/collapse) on any View.

Adding to Tom Esterez's excellent answer and Erik B's excellent update to it, I thought I'd post my own take, compacting the expand and contract methods into one. This way, you could for example have an action like this.

. which calls the method below and letting it figure out what to do after each onClick().

For Smooth animation please use Handler with run method. And Enjoy Expand /Collapse animation

I would like to add something to the very helpful answer above. If you don't know the height you'll end up with since your views .getHeight() returns 0 you can do the following to get the height:

Where DUMMY_HIGH_DIMENSIONS is the width/height (in pixels) your view is constrained to . having this a huge number is reasonable when the view is encapsulated with a ScrollView.

This is a snippet that I used to resize the width of a view (LinearLayout) with animation.

The code is supposed to do expand or shrink according the target size. If you want a fill_parent width, you will have to pass the parent .getMeasuredWidth as target width while setting the flag to true.

Hope it helps some of you.

Yes, I agreed with the above comments. And indeed, it does seem like the right (or at least the easiest?) thing to do is to specify (in XML) an initial layout height of "0px" -- and then you can pass in another argument for "toHeight" (i.e. the "final height") to the constructor of your custom Animation sub-class, e.g. in the example above, it would look something like so:

combined solutions from @Tom Esterez and @Geraldo Neto

Here is my solution. I think it is simpler. It only expands the view but can easy be extended.

I think the easiest solution is to set android:animateLayoutChanges="true" to your LinearLayout and then just show/hide view by seting its visibility. Works like a charm, but you have no controll on the animation duration

You are on the right track. Make sure you have v1 set to have a layout height of zero right before the animation starts. You want to initialize your setup to look like the first frame of the animation before starting the animation.

This was my solution, my ImageView grows from 100% to 200% and return to his original size, using two animation files inside res/anim/ folder



Send an ImageView to my method setAnimationGrowShrink()

This is a proper working solution, I have tested it:

View v is the view to be animated, PARENT_VIEW is the container view containing the view.

You can use Transition or Animator that changes visibility of section to be expanded/collapsed, or ConstraintSet with different layouts.

Easiest one is to use motionLayout with 2 different layouts and constraintSets to change from one layout to another on button click. You can change between layouts with

With Transition api

I created the one in gif using Transitions api that change rotationX.

create xml file that targets expand button

And set up visibility of items to collapse or expand

And start transition with

I created animation and transitions samples including the one on the gif, you can check them out there.


This overview was supported by the Coastal Oregon Marine Experimental Station (COMES) project no. ASF501, the Living Marine Resource Cooperative Science Center (LMRCSC) and NOAA Educational Partnership Program with Minority Serving Institutions Graduate Research and Training Scholarship Program. We thank Kathryn Ronnenberg for the creation of figures used throughout the manuscript. We are also grateful to the two reviewers who provided insightful comments that helped to improve the manuscript.


Major landscape transformations have occurred in the northern Mediterranean over the last decades, including urbanization, agricultural intensification and land abandonment, which, in turn, increase the risk of the propagation of fire. We used repeated-count surveys conducted at 369 sites in France and Spain to jointly model the effects of environmental covariates on the abundance, occupancy and detection of Hermann’s tortoise, a long-lived and endangered species, using a novel zero-inflated approach. We also employed a large dataset of presence-only data collected in Provence to model environmental influences on occurrence probability using maximum entropy models. In both France and Spain, sites that experienced wildfires over the last 50 years hosted 31% fewer individuals than unburned sites. In Provence, higher wildfire frequency decreased this species’ occurrence probability, from 50% when 0–1 fire had occurred over the last 50 years, to 7% in areas that had burned at least 3 times. We also showed that abundance required a long recovery time (more than 25 years) after wildfires. In Provence, the highest occurrence probability for this species was found in patchy landscapes and scrub and/or herbaceous vegetation. The lowest species occurrence was found in extensive artificial areas, vineyards and arable lands. These results suggest a high risk of population extinction in the future if these types of habitats continue to expand in plains and coastal areas to the detriment of scrublands. Higher wildfire frequency predicted by climate change scenarios in the Mediterranean is also likely to increase the risk of extinction for some populations.

Watch the video: How to calculate area in ArcGIS from attribute table (October 2021).