Hi Sara,

Which version of NetLogo are you using?

It looks like you’re using the old ? task syntax in your foreachs. In 6.0,
we replaced the ? syntax with the -> syntax. So your code would change as
follows:

to make-road-network
  clear-links
  let first-node nobody
  let previous-node nobody
  foreach gis:feature-list-of roads [ polyline ->
    foreach gis:vertex-lists-of polyline [ segment ->
      foreach segment [ coordinate ->
        let location gis:location-of coordinate
        if not empty? location [ ; some coordinates are empty []
          create-nodes 1 [
            set color green
            set size 1
            set xcor item 0 location
            set ycor item 1 location
            set hidden? true
            if first-node = nobody [
              set first-node self
            ]
            if previous-node != nobody [
              create-link-with previous-node
            ]
            set previous-node self
          ]
        ]
      ]
      set previous-node nobody
    ]
  ]
end

You can read about the transition to the -> syntax here:
https://ccl.northwestern.edu/netlogo/docs/transition.html#changes-for-netlogo-60

You can read about the -> and anonymous procedures in general here:
https://ccl.northwestern.edu/netlogo/docs/programming.html#anonymous-procedures

Hope that helps!
Bryan
​

On Tue, Apr 3, 2018 at 8:32 AM Sara Alonso Vicario <
saralonsovica...@gmail.com> wrote:

> I am using this code to create my roadnetwork in Netlogo from a shapefile.
> However, I got an error in *foreach gis:vertex-lists-of ?* because *?* is
> not recognised as VectorFeature in my VectorDataSet roads.
>
>
> How can I solve this issue?
>
> here is my code!
>
> to make-road-network
>   clear-links
>   let first-node nobody
>   let previous-node nobody
>   foreach gis:feature-list-of roads [ ; each polyline
>     foreach gis:vertex-lists-of ? [ ; each polyline segment / coordinate pair
>       foreach ? [ ; each coordinate
>         let location gis:location-of ?
>         if not empty? location [ ; some coordinates are empty []
>           create-nodes 1 [
>             set color green
>             set size 1
>             set xcor item 0 location
>             set ycor item 1 location
>             set hidden? true
>             if first-node = nobody [
>               set first-node self
>             ]
>             if previous-node != nobody [
>               create-link-with previous-node
>             ]
>             set previous-node self
>           ]
>         ]
>       ]
>       set previous-node nobody
>     ]
>   ]
>
>
> end
>
> --
> You received this message because you are subscribed to the Google Groups
> "netlogo-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to netlogo-devel+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to netlogo-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to