Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using 2 maps in netlogo

Tags:

gis

netlogo

Is it possible to use two maps in a netlogo model? If yes, how to combine or to import it to netlogo?

The first map has land use value and the second map has the land price value. So, I need these two attribute to support my model.

Below code is for importing the first map;

to-report read-map[m] 
let raster-map gis:load-dataset m                                         
gis:load-dataset m
gis:set-world-envelope gis:envelope-of raster-map
report raster-map

end

to read-input-maps[m]
let data-source word"data/input/maps/" m
let input-map read-map data-source
gis:apply-raster input-map map-value
ask patches
[set map-value ifelse-value (map-value <= 0 or map-value >= 0)
[map-value]
[-9999]]                                                                         
end

to read-map-attributes[m]
let data-source word "data/input/maps/"m
file-open data-source
set n-cols read-from-string remove "NCOLS"file-read-line
set n-rows read-from-string remove "NROWS" file-read-line
set xll read-from-string remove "XLLCORNER" file-read-line
set yll read-from-string remove "YLLCORNER" file-read-line
set cell-size read-from-string remove "CELLSIZE"file-read-line
file-close
resize-map

end

to resize-map
  resize-world 0 n-cols 0 n-rows
  set-patch-size 50 / cell-size

 end

  to display-map
  ifelse input-file = "turi3400m2.asc"[
  ask patches with[map-value = 1] [ set pcolor orange];Hutan sekunder orange 
  ask patches with[map-value = 2] [ set pcolor orange];Semak/belukar orange
  ask patches with[map-value = 3] [ set pcolor yellow];Permukiman yellow
  ask patches with[map-value = 4] [ set pcolor green];Kebun campuran green
  ask patches with[map-value = 5] [ set pcolor green];Sawah green
  ask patches with[map-value = 6] [ set pcolor orange];Tanah terbuka orange
  ask patches with[map-value = 7] [ set pcolor green];Tegalan/ladang green

   ]
  end

  to setup-function [m]
    read-map-attributes m
    read-input-maps m
    display-map
   end


  to setup
    ca
    setup-function 
    Input-File

Please help to solve this problem.

like image 798
Dudi Pul Avatar asked Aug 23 '26 19:08

Dudi Pul


1 Answers

How about replacing:

patches-own [map-value]

gis:apply-raster input-map map-value

with:

patches-own [map-value-1 map-value-2]

ifelse m = "..."
  [ gis:apply-raster input-map map-value-1 ]
  [ gis:apply-raster input-map map-value-2 ]

This is the simplest possible fix I can think of. Is it adequate for your use case?

like image 71
Seth Tisue Avatar answered Aug 26 '26 23:08

Seth Tisue



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!