netlogo / gis-extension Goto Github PK
View Code? Open in Web Editor NEWthe GIS (Geographic Information Systems) extension bundled with NetLogo
License: Other
the GIS (Geographic Information Systems) extension bundled with NetLogo
License: Other
From the ccl-gis mailing list
I think there is a bug in the GIS-extension: when using "gis:link-dataset" together with a link-set built from a user-defined "undirected-link-breed" with additional properties, the model crashes.
It's not a problem when either the links are not of a own breed or when they don't own additional properties, but in combination of both it doesn't work.
The error was as follows:
Extension exception: null
error while edge 0 1 running GIS:LINK-DATASET
called by procedure TEST
called by Button 'test'
org.nlogo.nvm.EngineException: Extension exception: null
at org.nlogo.agent.World.breedsOwnNameAt(World.java:1036)
at org.myworldgis.netlogo.LinkDataset.reportInternal(LinkDataset.java:68)
at org.myworldgis.netlogo.GISExtension$Reporter.report(GISExtension.java:40)
at org.nlogo.prim._externreport.report(_externreport.java:50)
at org.nlogo.prim._let.perform(_let.java:28)
at org.nlogo.nvm.Context.runExclusive(Context.java:119)
at org.nlogo.nvm.ExclusiveJob.run(ExclusiveJob.java:57)
at org.nlogo.nvm.Context.runExclusiveJob(Context.java:162)
at org.nlogo.prim._asm_proceduretest_ask_0.perform(:1)
at org.nlogo.nvm.Context.stepConcurrent(Context.java:91)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.java:82)
at org.nlogo.job.JobThread.org$nlogo$job$JobThread$$runPrimaryJobs(JobThread.scala:143)
at org.nlogo.job.JobThread$$anonfun$run$1.apply$mcV$sp(JobThread.scala:78)
at org.nlogo.job.JobThread$$anonfun$run$1.apply(JobThread.scala:76)
at org.nlogo.job.JobThread$$anonfun$run$1.apply(JobThread.scala:76)
at scala.util.control.Exception$Catch.apply(Exception.scala:88)
at org.nlogo.util.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:75)
NetLogo 5.3
main: org.nlogo.app.AppFrame
thread: JobThread
Java HotSpot(TM) 64-Bit Server VM 1.8.0_65 (Oracle Corporation; 1.8.0_65-b17)
operating system: Windows 10 10.0 (amd64 processor)
Scala version 2.9.2
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: link_dataset_issue
01:28:31.892 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0
01:28:31.890 RuntimeErrorEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:28:31.887 OutputEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:28:31.887 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
01:28:31.823 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
01:28:31.820 PeriodicUpdateEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:28:31.619 PeriodicUpdateEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:28:31.418 JobRemovedEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) JobThread
01:28:31.417 PeriodicUpdateEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:28:31.417 TickStateChangeEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) JobThread
The model that generated is available here.
Requested by a user. The gis:get-turtles-inside-polygon
would return an agentset of the turtles whose coordinates are inside a polygon given as an argument.
How to Enable GIS Extension to Support Gaussian Projection
Multi-part features, a fairly common occurrence in the GIS world, are not mentioned in the documentation at all. You can certainly draw them, but it is unclear how they behave in other situations.
Perhaps we should add more explicit support for operations with them, but at the very least we should make reference to them in the documentation so that people are not flying blind.
Tina Balke reports:
Dear Netlogo Team, I came across a possible bug in Netlogo
concerning the min and max methods in combination with is-number?
when using the GIS extension. In the simulation I use population
figures as patch variable (the name of this variable is
"population"). I've loaded GIS raster information into Netlogo
and used "gis:apply-raster gis:load-dataset
"data/sez_01_rer_grid.asc" population" to match the GIS data with
the patch variable.
When querying the max value of population using "show max [
population ] of patches with [is-number? population]" I get NaN
as a result, despite the is-number? statement. Using "show max [
population ] of patches with [population >= 0]" instead works.
It looks like that if the ".asc" file includes data with scientific e notation, like 0.3e2, the module fails to parse it correctly and instead will read 0.3.
In the GIS General Examples model the download-background-image
fails when calling gis:import-wms-drawing
with the following error message:
Extension exception: Unable to fetch wms image:
http result code 500 (Internal Server Error) (URL: https://ows.terrestris.de/osm/service?Format=image/jpeg&Transparent=TRUE&Version=1.1.1&SRS=EPSG:4326&BBOX=-180,-90,62069,180,90,62069&Request=GetMap&Service=wms&Height=292&Layers=OSM-WMS&Width=580&Styles=)
error while observer running GIS:IMPORT-WMS-DRAWING
called by procedure DOWNLOAD-BACKGROUND-IMAGE
called by Button 'download-background-image'
In this example this code is executed:
to download-background-image
if-else projection = "WGS_84_Geographic" [
gis:import-wms-drawing "https://ows.terrestris.de/osm/service?" "EPSG:4326" "OSM-WMS" 0
] [
show "Only WGS_84_Geographic projections are supported. Please Change to WGS_84_Geographic in the top left drop-down."
]
end
And here is the full error message with internal details:
Extension exception: Unable to fetch wms image:
http result code 500 (Internal Server Error) (URL: https://ows.terrestris.de/osm/service?Format=image/jpeg&Transparent=TRUE&Version=1.1.1&SRS=EPSG:4326&BBOX=-180,-90,62069,180,90,62069&Request=GetMap&Service=wms&Height=292&Layers=OSM-WMS&Width=580&Styles=)
error while observer running GIS:IMPORT-WMS-DRAWING
called by procedure DOWNLOAD-BACKGROUND-IMAGE
called by Button 'download-background-image'
org.nlogo.nvm.WrappedExtensionException: Extension exception: Unable to fetch wms image:
http result code 500 (Internal Server Error) (URL: https://ows.terrestris.de/osm/service?Format=image/jpeg&Transparent=TRUE&Version=1.1.1&SRS=EPSG:4326&BBOX=-180,-90,62069,180,90,62069&Request=GetMap&Service=wms&Height=292&Layers=OSM-WMS&Width=580&Styles=)
at org.nlogo.prim._extern.perform(_extern.java:40)
at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.util.control.Exception$Catch.apply(Exception.scala:228)
at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:66)
Caused by: org.nlogo.api.ExtensionException: Unable to fetch wms image:
http result code 500 (Internal Server Error) (URL: https://ows.terrestris.de/osm/service?Format=image/jpeg&Transparent=TRUE&Version=1.1.1&SRS=EPSG:4326&BBOX=-180,-90,62069,180,90,62069&Request=GetMap&Service=wms&Height=292&Layers=OSM-WMS&Width=580&Styles=)
at org.myworldgis.netlogo.LoadWMSImage.performInternal(LoadWMSImage.java:76)
at org.myworldgis.netlogo.GISExtension$Command.perform(GISExtension.java:61)
at org.nlogo.prim._extern.perform(_extern.java:36)
... 8 more
NetLogo 6.3.0
main: org.nlogo.app.AppFrame
thread: JobThread
OpenJDK 64-Bit Server VM 17.0.3 (BellSoft; 17.0.3+7-LTS)
operating system: Windows 11 10.0 (amd64 processor)
Scala version 2.12.16
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: GIS General Examples
02:38:59.465 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0
02:38:59.461 RuntimeErrorEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:38:59.461 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0
02:38:59.461 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0
02:38:59.461 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0
02:38:59.461 InterfaceGlobalEvent (org.nlogo.app.interfacetab.InterfacePanel$$anon$1 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
02:38:59.461 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:38:59.380 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
02:38:59.304 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
02:38:59.248 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0
It could have to do with an API change in the ows.terrestris.de service, but I'm not sure.
Hello,
I am trying to create an applet to incorporate in my blog. The model utilises the GIS extension and I seem to have a few issues. I believe that this is not my problem because I have the exactly same problem as when I run this:
http://ccl.northwestern.edu/netlogo/5.0.3/applet/gis.html
The error I get is:
Extension exception: points must form a closed linestring
error while observer running GIS:LOAD-DATASET
called by procedure SETUP
called by Button 'setup'
Anyone have any idea why this is occuring? Any help is appreciated!
Thanks a lot,
George
Steps to Reproduce:
gis:set-world-envelope gis:envelope-of <the_fire_stations_dataset>
gis:create-turtles-from-points fire_stations_dataset turtles []
Tried to create turtle outside GIS envelope at: (-85.04320641132607, 41.60757853756865, NaN). Try setting your GIS world envelope with gis:set-world-envelope (gis:envelope-union-of (gis:envelope-of your-first-dataset) (gis:envelope-of your-second-dataset) etc.))
show gis:world-envelope
and observe the output [-85.35946191554375 -84.99406832484011 41.607578537568656 41.97297212827229]
The desired behavior should be for the turtle to be placed within the NetLogo world, even if it has to get nudged just a tiny bit to not be on the edge of the envelope
Should we add gis:min-xcor
, gis:min-ycor
, etc... so you don't have to unpack gis:world-envelope
using item
? It would make some code a lot more readable.
I'm not sure whose error this (Netlogo vs the extension)- and forgive me if I'm missing something obvious.
In my model which works in 5.3 I create a map to export with:
let output-map gis:patch-dataset arrival-date
arrival-date is a patch variable. This works great (Thanks for creating and maintaining this extension) in 5.3.
In version 6 of Netlogo I now receive an error because I'm trying to access a patch variable from an observer context. I can't seem to run this one piece of code without the editor flagging it - no matter where I put it.
Thanks!
Sean Bergin
I think I found a bug in gis:apply-raster. I'm using NetLogo v5.2.1
For a long time I have been having trouble aligning my raster data and my shape files in NetLogo using the GIS extension. When I import the raster and assign values using gis:apply-raster, I usually end up with a border along the bottom and right side of the view filled with NaN. My rasters are displaced (upward and to the left) by this same margin when compared to my vectors. (the *.shp and *.asc files align perfectly in QGIS).
However, when I cycle gis:raster-sample across each patch in view, the entire raster shifts down and to the right, filling the NaN margins and aligning perfectly with the shape files.
Tom
Note: I know enough to review the source code and track down the possible issue. But I am not setup to code, build, and test any changes. So that is why I am not submitting a Pull Request. I would really appreciate anyone who can address this issue.
NetLogo 6.3.0- Windows 11 64 bit
GIS Extension - bundled with 6.3.0
Problem: my code below creates a feature List that includes "I- 35" but also "I- 35A Bus" and "I-35 N"
let i35-roads gis:find-features texas-roads-dataset "FULLNAME" "I- 35"
I believe the issue is in the matches function of StringUtils.WildvardMatcher class. Lines 32-44 of the current StringUtils.java file.
public boolean matches (String str) {
int lastIndex = 0;
for (int i = 0; i < _subpatterns.length; i += 1) {
int index = str.indexOf(_subpatterns[i], lastIndex);
if (index < lastIndex) {
return false;
} else {
lastIndex = index + _subpatterns[i].length();
}
}
return true;
}
In this example _subpatterns would be set to a single value array ["I- 35"] due to the class instantiation call from line 91 of VectorDataSearch.java
StringUtils.WildcardMatcher matcher = new StringUtils.WildcardMatcher(args[2].getString());
Example: the str input parameter to the matches function noted above is "I- 35A Bus"
This should NOT match but it does.
Because _subpatterns is a single member array, the for loop on _subpatterns will iterate only once.
The str.indexOf line will return 0, because the match pattern "I- 35" is found at index 0 of "I- 35A Bus"
And since index = 0 and lastIndex = 0, the if statement will NOT return false, the loop will terminate after 1 iteration allowing the function to terminate on the "return true;" call.
In effect, the matches function will behave as a "contains" operation rather than an exact match operation.
I'm using the gis:create-turtles-inside-polygon
function with the GIS Extension of NetLogo 6.3.0. I follow the example listed in the docs, with a few lines of code added to place each agent in the center of that polygon. That also prevents all agents outside my world envelope from being created.
to setup-spots
;; For each parking space, determine the centroid, convert to x,y coordinates (list with 2 elements),
;; and create a turtle in the center of that polygon
foreach gis:feature-list-of parking-dataset [ this-vector-feature ->
let center gis:centroid-of this-vector-feature
let loc gis:location-of center
if length loc >= 2 [
gis:create-turtles-inside-polygon this-vector-feature spots 1 [setxy item 0 loc item 1 loc]
]
]
end
However, it fails with a weird error: Extension exception: Index 0 out of bounds for length 0
. I tried about everything, but it just keeps failing. Could it be my data source?
@JamesHovet, since you wrote this function, do you have any idea what's going on? Or @LaCuneta?
Here are my model and data: NetLogo-GIS-test.zip
extensions [gis]
globals [parking-dataset projection]
breed [spots spot]
spots-own [AMENITY]
to setup
clear-all
load
draw
setup-spots
end
to load
set projection "WGS_84_Geographic"
set parking-dataset gis:load-dataset "export2.geojson"
gis:set-world-envelope (list 5.671533 5.684606 52.026888 52.019735)
end
to setup-spots
;; For each parking space, determine the centroid, convert to x,y coordinates (list with 2 elements),
;; and create a turtle in the center of that polygon
foreach gis:feature-list-of parking-dataset [ this-vector-feature ->
let center gis:centroid-of this-vector-feature
let loc gis:location-of center
if length loc >= 2 [
gis:create-turtles-inside-polygon this-vector-feature spots 1;; [setxy item 0 loc item 1 loc]
]
]
end
to draw
gis:set-drawing-color red
gis:fill parking-dataset 0
end
to clear
clear-all
end
Extension exception: Index 0 out of bounds for length 0
error while observer running GIS:CREATE-TURTLES-INSIDE-POLYGON
called by (anonymous command: [ this-vector-feature -> let center gis:centroid-of this-vector-feature let loc gis:location-of center if length loc >= 2 [ gis:create-turtles-inside-polygon this-vector-feature spots 1 ] ])
called by procedure SETUP-SPOTS
called by procedure SETUP
called by Button 'setup'org.nlogo.nvm.WrappedExtensionException: Extension exception: Index 0 out of bounds for length 0
at org.nlogo.nvm.AnonymousCommand.perform(AnonymousProcedure.scala:212)
at org.nlogo.nvm.AnonymousCommand.perform(AnonymousProcedure.scala:184)
at org.nlogo.prim.etc._foreach.perform(_foreach.scala:38)
at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.util.control.Exception$Catch.apply(Exception.scala:228)
at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:66)
Caused by: org.nlogo.api.ExtensionException: Index 0 out of bounds for length 0
at com.vividsolutions.jts.geom.GeometryCollection.getGeometryN(GeometryCollection.java:138)
at org.myworldgis.netlogo.VectorFeature.getRandomTriangleWeightedByArea(VectorFeature.java:347)
at org.myworldgis.netlogo.VectorFeature.getRandomPointInsidePolygon(VectorFeature.java:359)
at org.myworldgis.netlogo.CreateTurtlesInsidePolygon$TurtlesInsidePolygon.performInternal(CreateTurtlesInsidePolygon.java:63)
at org.myworldgis.netlogo.CreateTurtlesInsidePolygon$TurtlesInsidePolygonAutomatic.performInternal(CreateTurtlesInsidePolygon.java:83)
at org.myworldgis.netlogo.GISExtension$Command.perform(GISExtension.java:61)
at org.nlogo.prim._extern.perform(_extern.java:36)
at org.nlogo.nvm.Context.runExclusive(Context.java:133)
at org.nlogo.nvm.AnonymousCommand.perform(AnonymousProcedure.scala:206)
... 10 moreNetLogo 6.3.0
main: org.nlogo.app.AppFrame
thread: JobThread
OpenJDK 64-Bit Server VM 17.0.3 (BellSoft; 17.0.3+7-LTS)
operating system: Windows 11 10.0 (amd64 processor)
Scala version 2.12.16
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: GIS_test01:17:21.163 RuntimeErrorEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:17:21.147 JobRemovedEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
01:17:21.147 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:17:21.139 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:17:21.139 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
01:17:21.139 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:17:21.139 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
01:17:21.089 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
01:17:21.038 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
01:17:20.823 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
Hello, I am new to NetLogo, so I apologize if this is the wrong forum. I am trying to reproduce the following: https://github.com/YangZhouCSS/Pedestrian_Model_Krasnow. I know when I load the .nlogo it warns me that it was produced in 5.2 and I am using 6.3 so I may have to make changes for it to work. But, I am not sure what changes to make.
The error I get is:
math operation produced a non-number error while patch -25 -58 running + called by procedure GO called by Button 'go'
It comes from the following line in the code:
let target min-one-of neighbors [ elevation + ( count turtles-here * 9999999) ]
Which is in the to go section:
`to go
if count turtles > 0 [set move-speed count turtles with [moved? = true] / count turtles]
if count turtles = 0 [stop]
ask patches with [exit = 1] [ask turtles-here[die]]
ask turtles [
set moved? false
let target min-one-of neighbors [ elevation + ( count turtles-here * 9999999) ]
if [elevation + (count turtles-here * 9999999)] of target < [elevation] of patch-here
[ face target
move-to target
set moved? true
ask target [set path path + 1]]
]
if Show_path? [ask patches with [elevation < 9999999][let thecolor (9.9 - (path * 0.15)) if thecolor < 0.001 [set thecolor 0.001] set pcolor thecolor]]
tick
end
`
I am looking at the .asc files and I see that the NAN value is -9999. I am thinking that the error arises because one of the neighbors is -9999. But, in the to setup section, I would have thought the "set-world-envelope" would prevent that.
I know this is not a bug so apologize again if this is the improper place to ask this question. I posted in StackOverflow here: https://stackoverflow.com/questions/74977284/netlogo-let-target-min-one-of-neighbors-math-operation-produced-a-non-number/74985127#74985127
I am trying to get this project to work as it is similar to something else I am trying to do.
Would be nice to have primitives to transform coordinates GIS->NetLogo and NetLogo->GIS
the following prints when running nightly.sh on monk2.ccl.northwestern.edu.
perhaps we could modify this code:
http://jsexton0.blogspot.com/2007/09/cure-for-common-jai-exception.html
so it checks the message in the exception and only ignores our error in particular
...............Error: Could not find mediaLib accelerator wrapper classes. Continuing in pure Java mode.
Occurs in: com.sun.media.jai.mlib.MediaLibAccessor
java.lang.NoClassDefFoundError: com/sun/medialib/mlib/Image
at com.sun.media.jai.mlib.MediaLibAccessor$1.run(MediaLibAccessor.java:248)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.media.jai.mlib.MediaLibAccessor.setUseMlib(MediaLibAccessor.java:245)
at com.sun.media.jai.mlib.MediaLibAccessor.useMlib(MediaLibAccessor.java:177)
at com.sun.media.jai.mlib.MediaLibAccessor.isMediaLibCompatible(MediaLibAccessor.java:357)
at com.sun.media.jai.mlib.MediaLibAccessor.isMediaLibCompatible(MediaLibAccessor.java:315)
at com.sun.media.jai.mlib.MlibConvolveRIF.create(MlibConvolveRIF.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122)
at javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674)
at javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473)
at javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332)
at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819)
at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867)
at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179)
at org.myworldgis.netlogo.RasterDataset.convolve(RasterDataset.java:602)
at org.myworldgis.netlogo.RasterDatasetMath$Convolve.reportInternal(RasterDatasetMath.java:194)
at org.myworldgis.netlogo.GISExtension$Reporter.report(GISExtension.java:40)
at org.nlogo.prim._externreport.report(_externreport.java:56)
at org.nlogo.prim._asm_setup_setprocedurevariable_4.perform()
at org.nlogo.nvm.Context.stepConcurrent(Context.java:95)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.java:99)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.java:194)
at org.nlogo.job.JobThread.run(JobThread.java:117)
Caused by: java.lang.ClassNotFoundException: com.sun.medialib.mlib.Image
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:627)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 27 more
Hello,
I'm trying to set up my NetLogo world with a raster (.asc) and a shapefile (.shp). The shapefile seems to work fine but when I try to load the raster I get a parsing error:
Extension exception: error parsing number
error while observer running GIS:LOAD-DATASET
called by procedure SETUP
called by Button 'setup'
org.nlogo.nvm.WrappedExtensionException: Extension exception: error parsing number
at org.nlogo.prim._externreport.report(_externreport.java:35)
at org.nlogo.prim._asm_proceduresetup_setobservervariable_1.perform()
at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.util.control.Exception$Catch.apply(Exception.scala:228)
at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:66)
Caused by: org.nlogo.api.ExtensionException: error parsing number
at org.myworldgis.io.asciigrid.AsciiGridFileReader.(AsciiGridFileReader.java:105)
at org.myworldgis.netlogo.LoadDataset.loadAsciiGrid(LoadDataset.java:135)
at org.myworldgis.netlogo.LoadDataset.reportInternal(LoadDataset.java:193)
at org.myworldgis.netlogo.GISExtension$Reporter.report(GISExtension.java:38)
at org.nlogo.prim._externreport.report(_externreport.java:31)
... 9 more
NetLogo 6.2.0
main: org.nlogo.app.AppFrame
thread: JobThread
OpenJDK 64-Bit Server VM 1.8.0_275 (BellSoft; 1.8.0_275-b01)
operating system: Windows 10 10.0 (amd64 processor)
Scala version 2.12.12
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: setup_gis_abm
10:24:14.602 RuntimeErrorEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
10:24:14.602 JobRemovedEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
10:24:14.602 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
10:24:14.602 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
10:24:14.602 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
10:24:14.602 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
10:24:14.595 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
10:24:14.595 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
10:24:14.517 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
10:24:14.395 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
As I'm rather new to NetLogo and programming, I don't really understand what is going wrong and I couldn't find a solution on online forums. I assume it's just something simple. I also tried to attach the .asc file as txt, but this didn't seem to work. Therefore, here are the first few lines of the file:
ncols 9366
nrows 5141
xllcorner 31,272916666667
yllcorner 36,867361109969
cellsize 0,000277777778
NODATA_value -9999
1586 1591 1597 1599 1598 1596 1591 1588 1587 1582 1576 1569 1561 1554 1546 1541 1540 1543 1546 1551 1556 1567 1583 1598 1611 1623 1633 1643 1651 1657 1661 1665 1667 1672 1677 1684 1691 1698 1705 1712 1719 1733 1741 1749 1758 1768 1776 1779 1780 1777 1774 1775 1775 1779 1783 1789 1796 1804 1814 1829 1841 1851 1860 1868 1877 1886 1888 1891 1895 1898 1899 1902 1907 1908 1908 1908 1906 1905 1906 1905 1908 1911 1916 1922 1929 1938 1948 1957 1965 1973 1979 1985 1990 1993 1989 1982 1974 1967 1958 1949 1940 1931 1922 1915 1911 1910 1910 1914 1918 1923 1930 1937 1943 1954 1963 1972 1980 1988 2001 2013 2024 2031 2039 2047 2055 2065 2074 2081 2089 2097 2104 2109 2111 2114 2113 2111 2110 2110 2110 2110 2109 2107 2102 2097 2090 2082 2071 2063 2052 2039 2026 2015 2008 2001 1994 1987 1984 1982 1983 1981 1977 1974 1976 1975 1970 1963 1957 1949 1939 1935 1937 1944 1952 1963 1972 1978 1981 1978 1972 1965 1959 1954 1949 1947 1946 1944 1940 1936 1930 1923 1915 1909 1903 1895 1888 1879 1870 1863 1852 1844 1837 1831 1825 1820 1816 1808 1804 1802 1804 1806 181
Many thanks,
Deborah
I am trying to use project-lat-lon primitive but I am getting an error. Isn't it released yet? If not, when are you planning to roll out this primitive? @JamesHovet
Thanks in advance...
jscience.jar is out, ngunits is in, but additionalJars method didn't get updated
as a result, the applet HTML doesn't have the right archive= line and the ngunits classes aren't found
sometimes it works, but there are intermittent failures, with all sorts of different error messages (sometimes a heap space error even if you're running with a ton of heap). it seems that when the extension reads data files their contents may intermittently be corrupted?
example of one of the errors you can get:
java.io.IOException: unsupported shape type
at org.myworldgis.io.shapefile.ESRIShapeBuffer.getESRIRecord(ESRIShapeBuffer.java:132)
at org.myworldgis.io.shapefile.ESRIShapefileReader.getNextShape(ESRIShapefileReader.java:87)
at org.myworldgis.netlogo.LoadDataset.loadShapefile(LoadDataset.java:101)
at org.myworldgis.netlogo.LoadDataset.reportInternal(LoadDataset.java:189)
at org.myworldgis.netlogo.GISExtension$Reporter.report(GISExtension.java:40)
at org.nlogo.prim._externreport.report(_externreport.java:56)
at org.nlogo.prim._setobservervariable.perform(_setobservervariable.java:38)
at org.nlogo.nvm.Context.stepConcurrent(Context.java:99)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.java:90)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.java:181)
at org.nlogo.job.JobThread.run(JobThread.java:105)
Eric Russell writes:
Upon closer investigation, it looks like it's actually some kind of
timing bug that results in a buffer underflow while reading from the
stream returned by URL.openStream. The stream reports that 8 bytes were
successfully read, but returns garbage values. Putting a
Thread.sleep(1000) between reading the header and reading the shape
records makes the problem go away, but it's not really a reliable
workaround. I'll have to look at the JDK source to see if I can figure
out what the root cause is [...]
On NetLogo 6.1.1 with GIS extension 1.2.0, this code runs perfectly fine
extensions [ gis ]
to setup
clear-all
gis:set-world-envelope (list -180 180 -90 90)
end
to draw-background-image
gis:import-wms-drawing "https://ows.terrestris.de/osm/service?" "EPSG:4326" "OSM-WMS" 128
end
On 6.2.0 with GIS extension 1.2.0, it throws this exception
Extension exception: com/sun/image/codec/jpeg/ImageFormatException
error while observer running GIS:IMPORT-WMS-DRAWING
called by procedure DRAW-BACKGROUND-IMAGE
called by Button 'draw-background-image'
org.nlogo.nvm.WrappedExtensionException: Extension exception: com/sun/image/codec/jpeg/ImageFormatException
at org.nlogo.prim._extern.perform(_extern.java:40)
at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.util.control.Exception$Catch.apply(Exception.scala:228)
at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:66)
Caused by: org.nlogo.api.ExtensionException: com/sun/image/codec/jpeg/ImageFormatException
at com.sun.media.jai.codecimpl.JPEGImageDecoder.decodeAsRenderedImage(JPEGImageDecoder.java:46)
at com.sun.media.jai.codec.ImageDecoderImpl.decodeAsRenderedImage(ImageDecoderImpl.java:140)
at org.myworldgis.netlogo.LoadWMSImage.performInternal(LoadWMSImage.java:86)
at org.myworldgis.netlogo.GISExtension$Command.perform(GISExtension.java:61)
at org.nlogo.prim._extern.perform(_extern.java:36)
... 8 more
NetLogo 6.2.0
main: org.nlogo.app.AppFrame
thread: JobThread
OpenJDK 64-Bit Server VM 1.8.0_275 (BellSoft; 1.8.0_275-b01)
operating system: Mac OS X 10.16 (x86_64 processor)
Scala version 2.12.12
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: wms_regression
02:28:29.751 RuntimeErrorEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:28:28.796 AddJobEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
02:28:28.751 InputBoxLoseFocusEvent (org.nlogo.window.ButtonWidget) AWT-EventQueue-0
02:28:28.727 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:28:28.525 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:28:28.320 JobRemovedEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
02:28:28.319 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
02:28:28.304 PeriodicUpdateEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:28:28.253 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
02:28:28.248 TickStateChangeEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) JobThread
GIS extension needs to support more grid data formats,such as *.tif , although asc is very useful
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.