Problem with street crossings

674
5
12-15-2013 11:23 AM
Maartenvan_Doornik
New Contributor
Hi,

I'm trying to texture streets in my model. I'm using the street data from Open Streetmap. There are different street types (residential, primary, secondary, cycleway, footway etc.) which I want to texture differently. However, at the crossings of the streets I can only apply one way of texturing. So at the moment all of the crossing have an asphalt texture, even at footways and residential streets, which are not textured with asphalt. Is there a way to make the texture of the crossings dependent of the streets? This is the rule that I'm using:



const avgLanewidth = 6
attr highway = ""
attr type = ""
attr shapeType = ""
width = case type == "MAJOR": 4
else : 4
calcLanes(width) = width / ceil(width / avgLanewidth) + 0.1
@StartRule
Street -->
comp(f){ all: StreetPart }

StreetPart -->

case shapeType == "Sidewalk"  && highway == "residential": Sidewalk
case shapeType == "Crossing":Crossing

case highway =="primary" || highway =="primary_link" : setupProjection(0,scope.yx,3.5,3) projectUV(0) texture("Asphalt.png")
case highway =="secondary" || highway =="secondary_link" :setupProjection(0,scope.yx,3.5,3) projectUV(0)  texture("Asphalt.png")
case highway =="tertiary" : setupProjection(0,scope.yx,3.5,3) projectUV(0) texture("Asphalt2.png")
case highway =="path" : setupProjection(0,scope.yx,3.5,3) projectUV(0) texture("Path.png")
case highway =="residential" : setupProjection(0,scope.yx,1,1) projectUV(0) texture("Straatstenen.png")
case highway =="service" : setupProjection(0,scope.yx,1,1) projectUV(0) texture("Straatstenen.png")
case highway =="footway" : setupProjection(0,scope.yx,3,2) projectUV(0) texture("Path.png")
case highway =="cycleway": setupProjection(0,scope.yx,3,2) projectUV(0) texture("Cycleway.png")
case highway =="unclassified": setupProjection(0,scope.yx,1,1) projectUV(0) texture("Straatstenen.png")
case highway =="living_street":setupProjection(0,scope.yx,1,1) projectUV(0) texture("Straatstenen.png")
case highway =="pedestrian":setupProjection(0,scope.yx,3.5,3) projectUV(0) texture("Path.png")
else : case shapeType == "Sidewalk": Sidewalk
   else: NIL



@StartRule
JunctionEntry --> Street

@StartRule
Sidewalk --> extrude (0.2) setupProjection(0,scope.xz,2,2) projectUV(0) texture("Stoep.png")
@StartRule
Junction --> color("#aaaaaa")
@StartRule
Crossing--> setupProjection(0,scope.yx,3.5,3) projectUV(0) texture("Asphalt2.png")
0 Kudos
5 Replies
MatthiasBuehler1
Frequent Contributor
hi,

please also watch my video, it may answer a few questions on the CGA side of things.




are you on CE 2013 already ?

lemme know ..

matt
0 Kudos
Maartenvan_Doornik
New Contributor
No, I'm using CE 2012.1
0 Kudos
MatthiasBuehler1
Frequent Contributor
In general, the answer to your question is no. This is not possible.

For a simple, but logic reason.

Because 1 crossing can be shared by both a huge street and a tiny street. So who 'wins'.

What' I'd do [and that's now better possible in 2013] is use Python to find the 'widest' street on each street node, grab it's type and depending on that type, set the crossing parameters or Start Rule. But this can only done with Python ( or manually of course ).

Note that CE 2013 will work also with you 2012 license. No reason not to update .. 😉 Note though that we strongly recommend to create a new Workspace for 2013 and leave the 2012 workspace. Just migrate the projects over.

Hope this input helps !

Matt
0 Kudos
Maartenvan_Doornik
New Contributor
I think I've already solved the problem. Thanks for your help!

Where can i find the upgrade to CE 2013? 🙂
0 Kudos
MatthiasBuehler1
Frequent Contributor
contact your local distributor from where you got the license or download the new trial.

cheers !

matt
0 Kudos