cant get a dem right

39 views
Skip to first unread message

Srirama Bhamidipati

unread,
Mar 14, 2014, 12:42:25 PM3/14/14
to gama-p...@googlegroups.com
Hi,

I am trying to create a dem from ArcGIS exported 8bit png file, with the following code. But it looks very weird. Can somebody suggest if I am missing something or may be there is a proper procedure to export a .png (attached is a png)


model study_dem

global {
/** Insert the global definitions, variables and actions here */
file dem <- file("../includes/ASCIITo_asc11.png");
file gridFile <- file("../dempositive20x20.asc");
}

experiment study_dem type: gui {
/** Insert here the definition of the input and output of the model */
output {
display DEM  type: opengl ambient_light:255 {
graphics 'GraphicPrimitive' {
draw dem(dem, dem);
}
}
}
}
ASCIITo_asc11.png

Srirama Bhamidipati

unread,
Mar 14, 2014, 12:44:55 PM3/14/14
to gama-p...@googlegroups.com
Q1. Is the png itself not carrying enough/ correct information ?

Q2.  is there some scaling factor that can be used to make it look right ?

Arnaud Grignard

unread,
Mar 15, 2014, 12:45:30 AM3/15/14
to gama-platform
Srirama,

Can you send the model with the .png AND the. asc file

Arnaud


On Fri, Mar 14, 2014 at 11:44 PM, Srirama Bhamidipati <b.sr...@gmail.com> wrote:
Q1. Is the png itself not carrying enough/ correct information ?

Q2.  is there some scaling factor that can be used to make it look right ?

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.



--
http://arnoi69.tumblr.com/

Srirama Bhamidipati

unread,
Mar 15, 2014, 5:43:30 AM3/15/14
to gama-p...@googlegroups.com
I use dem twice as arguments of dem function, because mostly I do not have a texture file (satellite image) and I could not know if the second argument can be optional in that statement???

Arnaud Grignard

unread,
Mar 15, 2014, 5:59:54 AM3/15/14
to gama-platform
can you try this:


model study_dem

global {
    /** Insert the global definitions, variables and actions here */
    file dem <- file("../includes/ASCIITo_asc11.png");
    file gridFile <- file("../includes/dempositive20x20.asc");
    geometry shape <- rectangle(2360,2120);

   
}

experiment study_dem type: gui {
    /** Insert here the definition of the input and output of the model */
    output {
        display DEM  type: opengl ambient_light:255 {
            graphics 'GraphicPrimitive' {
                draw dem(dem, dem);
            }
        }
    }
}

by default the size of the env is the size of the image (so here 236,212) as the altitude value are store as rgb value between 0 and 255 in a 236x212 environment 255 is very high but in a environment 10 time bigger (geometry shape <- rectangle(2360,2120); )it looks ok and even smaller in env 100 times bigger geometry shape <- rectangle(23600,21200);


Concerning the drawing from asc file there is a problem is the current version of Gama that we need to fix http://code.google.com/p/gama-platform/issues/detail?id=837

On Sat, Mar 15, 2014 at 4:43 PM, Srirama Bhamidipati <b.sr...@gmail.com> wrote:
I use dem twice as arguments of dem function, because mostly I do not have a texture file (satellite image) and I could not know if the second argument can be optional in that statement???

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Srirama Bhamidipati

unread,
Mar 15, 2014, 7:20:29 AM3/15/14
to gama-p...@googlegroups.com
Yes, It seems to work. But when we increase the size of the environment what is being stretched ? The whole picture is my study area and I am afraid that if I increase the size of the environment will it cause problems to my .asc dem ? I will be using the dem to model flood as a grid. This grid comes from the .asc , So does changing the environment effect the grid coming from that .asc ?

regards.
Srirama

Arnaud Grignard

unread,
Mar 15, 2014, 7:42:07 AM3/15/14
to gama-platform
Sorry I actually the size of the environment by default is 100x100 (whatever the size of the image)

To have a better rendering without changing the size of the environment you can apply a z_factor (by default 1 but you will decrease the z by 10 if you pout dem(dem,0.1)

I've commited the 2 following operators
dem(dem)
and
dem(dem,z_facotr)

and updated the doc and the model
code.google.com/p/gama-platform/wiki/Gama3DCurrent?ts=1394883525&updated=Gama3DCurrent#From_PNG_FILE




--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Srirama Bhamidipati

unread,
Mar 15, 2014, 8:49:57 AM3/15/14
to gama-p...@googlegroups.com
Thank you. It is working now and I can control the display.

Srirama Bhamidipati

unread,
Mar 15, 2014, 11:06:50 AM3/15/14
to gama-p...@googlegroups.com
Hi Arnaud,

when you say "as the altitude value are store as rgb value between 0 and 255 " , I have the following question: In my case I have  negative values in the dem because my area is a delta region below sea level, does that mean that values of my dem are normalized to fit within 0 to 255 ?

thanks
srirama

Arnaud Grignard

unread,
Mar 15, 2014, 11:46:37 AM3/15/14
to gama-platform
If you draw it from a png yes the value can only be betwenn 0 and 255 (if in 8 bits) so ArcGis must normalize it.

From an asc file I've never test but it "should" work with negative value


--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages