Drawing Patches from Map

381 views
Skip to first unread message

D. K.

unread,
Mar 8, 2021, 4:42:21 PM3/8/21
to netlogo-users
Hi!

I am trying to model an environment that is based on a fairly complex map. Are there any tools that allow someone to draw the initial state for patches, or create them from an image?

Thanks!

Aaron Andre Brandes

unread,
Mar 11, 2021, 12:26:48 PM3/11/21
to D. K., netlogo-users

Hi,

Thanks for your interest in NetLogo.

 

If you have an image file such as a jpeg or png, you can use the bitmap extension

 

The following code will let you choose an image file and use it to set the patches so that each one represents a pixel from the image.

I have attached a map of Evanston IL, the location of the Center for Connected Learning and Computer-Based Modeling, which brings you NetLogo.

 

 

extensions[bitmap]

 

to setup

  ca

  let image-file user-file

  let image bitmap:import image-file

  let height bitmap:height image

  let width bitmap:width image

  type "height: " print height

  type "width: " print width

  resize-world 0 width - 1 0 height - 1

  set-patch-size 1

  import-pcolors-rgb image-file

end

 

For large or high resolution images the large number of patches may require more memory than is practical for your computer.

For information on model size and increasing memory see this.

 

 

If you have access to GIS data for your map you could try the GIS Extension

You can find examples by going to the Models Library  NetLogo Menu Files->Models Library.

Type gis in the searchbox in the lower left and you will see two models above which you can double click on and explore – “GIS General Examples” and “GIS Gradient Examples”

 

Please contact the list again if you have more questions.

 

Aaron

-- 

Aaron Brandes, Software Developer

Center for Connected Learning and Computer-Based Modeling

--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/2ca4f563-50b3-4c1a-95b9-41a08d2a0d52n%40googlegroups.com.

Evanston.png

Daniel Klingman

unread,
Mar 18, 2021, 1:12:36 PM3/18/21
to netlogo-users
Thanks, This is very helpful!
Reply all
Reply to author
Forward
0 new messages