import svg as polygon?

Hi everyone,

So I’m a new guy around here with many questions on my mind. I’ve singled one out to start with as it would save lots of time. I managed to import a svg 1.1 file as a layout but only as a path. Is it possible to get a polygon? I’m working with Illustartor to trace my png map, single out the big continent shape and save as svg. Any help would be very welcome.

And hi to Monk and his great ME DEM Project. Read alot about it over at the CG forum.

THX in advance,

Troedel

p.s.: I looked up svg structure and checked if illustrator set the closepath command z. It did.

1 Like

Hi there,

Good to hear from ya.

World Machine’s determination of if a shape is a path or a polygon is actually not related to whether the path is closed; instead for SVG it decides based upon the shapes fill and stroke properties. A shape will default to a path unless it has a non-empty fill or an empty stroke. This should be the info you need to get an import working!

Thanks for the fast reply. I had tried it with a fill but left the stroke empty. I will check this out tomorrow.

I love the mystery of Worldmachine. It´s like chess. The single pieces are “easy” to learn, problem is learning how they work together. Iwould like to see more finished renders with the underlying device structure.

Thx,

Troedel

Am I getting it right:

shape will be a path with empty fill or empty stroke
polygon with non empty fill and stroke

I´m not able to work this thing out properly. Can my svg contain multiple paths? Is there an upper limit of anchor points?
Here is my svg in .txt format as an attachment, if someone wants to have a look.

Until now I worked with a bitmap mask which gave good results but did not enable me to use a falloff to get nice underwater coastal areas. I think there are ways to to it but a mask would be nice. tracing by hand is a no go for me :wink: I painted it in the first place…

THX for the help!

Troedel

Ok, made some progress this morning. Figured out that it seems to need straight lines to form a mask. I removed all anchors with handles and changed them to corners, after that the resulting svg resulted in masks. Holes within a polygon result in a pretty meshed up result. Isolating those “inner seas” and reproducing them with a different file and changing to “substract” will do the trick. Perhaps I will do a little tutorial on tracing in Illustrator and importing to worldmachine. It seems to me that there are some things to consider…

In investigating there’s actually an edge case bug in the way WM detects path vs filled path. For now, the 100% reliable way is to assign a fill but no stroke to a shape. The way the rules SHOULD work is that as long as a fill is applied, it is a polygon rather than a line.

I think I finally got what I want.

Things to respect in Illustrator :

  1. Change a compound path back to a path
  2. Be sure to have just one path before exporting to svg ( tracing creates 2 paths, one for the inner one for the outer shape )
  3. Set the correct fills and strokes, see above
  4. Simplify the path to just straight lines

Things to respect in WM

  1. No paths within the boundaries of other paths, it will mesh things up
  2. Create a second svg for “inner” shapes import them and set them to substract

Those are the bumpers I ran into so perhaps it can be avoided in the future. I certainly got WM to the limits of my machine with this one. I hope my rig will hold together for the rest of the project :wink: And a bug was spoted on the way. Certainly worth the effort.

THX for the help I got so far.

Troedel

Hi Troedel, thanks for the greets and compliment. Not been on here properly for a wee while. I don’t even know what’s on the CG boards…long time ago that! :slight_smile:

A tutorial on Illustrator to WM workflow would be very welcome. When we were testing WM 2 we made a start on this when Stephen introduced the vector format support. The i/o has not really been advanced since then though and imo it could be tested more and improved. The vector support struck me as not quite to where I wanted it to be for full use as a workflow. Setting per vertex z would have been really useful but I don’t think the svg and ai format supported that…? But, I’m hoping you can explore and advance it.
I would really like to see .shp file support (that supports per vertex z) and also georef and projection information preserved in file i/o, but not necessarily a spherical viewer or generator! that’s a way off I think… One could envisage a smooth WM workflow between GIS and Game/modelling applications. Not sure come to think of it what WM does with the georef info in files that have them.

You pmed me regarding reproducing my approach…I think I’m right in saying that? Well, it took me a long time to try this and that out. As you can say, you can reproduce easily enough the patching in mountains. Regards accurate water flow, that’s a different matter. It can’t be done while using real terrain from satellite data. Accurate hydrology is something you have to sacrifice. However, I use a two layered approach to the model which helps a bit. The bottom layer controls the flow of the water but only at the macro level. You cannot specify with any certainty whatsoever water flow within say small watersheds. The only way as far as I know to create accurate water flow over a large dem is to create the entire dem via contours and then interpolate them using software. That’s how I did it. And you will probably have to create a really big contour map to get any benefit from using contours at all, otherwise you will not get accurate flow at any useful level of detail. You’ve got to make it as big as you can for it to be worth your while. Unfortunately, you also have to create your contours to as high a resolution as you can too because while many areas of the map will allow for widely spaced contours you always have to have extremely closely spaced contours in some areas (1 pixel separation). So you will need 1 px wide contours. You could go the vector route of course too. I preferred the raster one because Photoshop at that time was the only app to support large file sizes- we’re talking a few years ago now!
You might be able to do it in photoshop via discrete greyscales and then blur it but you will need to mask out the rivers, probably feather it too. You’ll need to do the greyscales at very large res though…or…blur- upscale-blur-upscale, etc. The problem with that approach though is that you always get an even blur over the raster, whereas you really need a blur which is different in differnt areas. You could end up with just a mush. There may be other approaches but I don’t think any of them will be significantly easier than any other. It’s just a bit of a b**** to do.

monks

That sounds like I have got to sacrifice accurate hydrology because it’s not necessary for my intended use of maps. Perhaps I try the “eye” approach to create something not totally unbelievable, taking real elevation maps as guidelines.

Regarding the Illustrator files there isn’t really much to say other than stated above. Once I got the proper routine I imported the svg´s as layouts which worked fine after eliminating to first difficulties ( hours… ). What happend was me getting stranded with Layouts that had thousands of anchor points and WM2 breaking down to a crawl. So perhaps I’ve got to say that handling layouts via Illustrator isn’t really necessary as the basic handling options are present in WM2. The GUI for doing that could be a little bit more elaborated ( different tools for object selection, anchor point selection and a clear button for deselection of everything ). By the way it was/is a 30day trial of CS6 and I won’t spend the money just for creating layouts in wm2. Inkscape perhaps.

So I switched back to Photoshop ( I own that one at least :wink: ) for creating masks ( which is overkill ) and they worked fine. Disadvantage are the missing (?) falloff controlls a layout generator gives you. But the reload for every worldbuild is nice as I can open PS, work on the mask, hit build and get an almost immediate update in wm2. Neat.

Thanks for your reply regarding waterways. Is it possible to fill up basins in wm2 as it is possible in wilbur? I would say it is but I haven’t figured it out. In wilbur it is a one button action which is nice. Macro Project? Perhaps that could be a way to avoid larger sinkholes after designing the first terrain draft.

Good night everyone, its late :wink:

Troedel

Edit: Couldn´t sleep. Isn´t somthing like .shp implemented in wm2? The layouts have z info stored within their vertices. So .shp for layout should be a possibilty. As I´m a “noob” regarding this I wonder what other programs you would like to use to generate these files and why. Always remember that mine is a more “artistic” approach with little knowledge in realworld topology. Please forgive me I know it´s worth a read for this kind of terrain modelling :wink:

I was advised by Wilbur’s author to use basin fill but you can’t really control it very well because it tends to make major changes to large area so I ended up not using it. BUt, our problems may not be alike. I’m working quite cloesly to a topo map reference, where rivers are strictly marked, but, if you had a bit more flexibility in your map, you might fair better with that approach.
One limiting factor with Wilbur is map size. It doesn’t use tiling so you’re limited by your system much more. I’ve used 10K terrains fine, but I think (with 6GB) I could probalby get up to may 12K if I pushed it.
World Machine has probably the best erosion tools around but they work best on small to medium scales. You might turn your sediment carry right up and thinking about it, I do that to solve the same problem- it fills in basins created by the channelling erosion. But they are very localised. I doubt very much if it will extend to large basins. Geologic time enhancment produces some great eorsion but it’s pretty destructive and unpredictable.

Regards rivers, this is what I’d advise you to do. The single most important thing about large landscapes is rivers. If you are not going to be seeing the landscape from a great height, then ignore this, but if you can see it, then this is what I’d do.
You need to create a river mask whether the rivers are real or not. What I’m saying is you need the eye to see them, but they might not necessarily have accurate hydrology (if you ran a physics sim over them). The eye doesn’t see the rivers (not the smaller ones) but it sees the terrain implying them. So you need to get as many good long flow networks from your initial river mask + the incise flows feature in Wilbur. Incidentally there are only 3 programs (as far as I know) that can give you long river flows: Wilbur, GeoControl, GTS (search
Viewing Dale). (GeoControl produces great rivers but is limited to 4096 as it’s still 32 bit).
Create upland areas where water can flow from (a hills mask) in WM. Doesn’t have to be complex terrain even. Build, export. Cut channels into the terrain in Wilbur along your initial river mask to encourage flow along and into them. Noise the terrain a bit still masking. Then run incise flows and precipiton repeatedly. Once you have results you’re hapy with, generate a river mask. Then take your new river mask, combine it with your original river mask to patch any holes, and apply that to the original hills mask in order to break the hilly areas up (ie, generate the hills around the new mask). You could repeat that cycle. I think if you did it enough times you’d have great looking flows- but you may end up changing the coastline too much with the Wilbur erosion. I think it could be done though by using a mask on the erosion step which reduced the erosion towards the coastline. Another thing is, you might not even use the output terrain from Wilbur since you can use the river mask for both terrain placement and cutting channels along rivers to the original (pre-Wilbur) terrain.
Another approach is to just use real terrain in your initial hills mask, then run that through Wilbur to gen your rivers mask. Not tried that one yet but I think I’ll be trying that in future- it may or may not work that well.
As you can see I’ve still go a few things I’d like to try. :smiley:

Re .shp. Yes, they have z info but I don’t think each vertex can have a different z value. They all have to be the same. I don’t know. That’s one for Stephen! .shp is the industry standard GIS (Geographic Information Systems) vector format. It’s used in applications like Google Earth, WorldWind.
Me too with the artistic approach, what I know is just stuff I’ve picked up over the years. I think all of the big challenges will have to be tackled by programmers :slight_smile:

monks

O.K. I did some experiments and discovered that lines in WM have individual z info for each vertex. If you right click the line you can edit the lofting curve which gives you precise control over all vertices z value. In addition you can see the height value of the underlying terrain currently selected as output. Right now I´m working on a cut through my mountain establishing a downhill path by adjusting the line used as a mask for a simple transform set to glaciate and canyonize a bit. Results are promising although it´s tedious work fiddling around with different height settings. There is an option to drop the curve to the surface heights, perhaps I can capitalize on this. More work ahead. If I´m a little bit satisfied I´ll post some pictures :wink: ?

Hi Troedel, what I meant is that the vertices within Illustrator don’t have z values so you can’t use it for impot of complex 3D shapes and you can’t use it in a workflow which has per vertex z. World Machine itself supports them. The ideal workflow for that would be via .shp file import, but if you don’t need that then it’s not an issue. Yes, you can always set them once you get them into WM but if you have a lot of vertices it takes ages to set them all. It’s possible but can be VERY time consuming.
I used to use the drop to terrain and then set them from there to create the which I see you’ve done :slight_smile: My problem was getting stream and ridge info from Global Mapper into WM preserving the per vertex z. I found it was best to mark out your main river beds manually in WM and then run a deep channeling erosion on them either in Wilbur via Incise flows or just within World Machine. That way you can generate procedurally the many tributaries flowing into the rivers you’ve marked out by hand rather than having to create them all by hand.

monks

just one quick point to add is that the latest beta of 2.3b4 can import DXF spline paths with full Z elevations intact. You’ll probably need to be using something more than just a spline based illustration package to export them, but WM can now use them!

That’s great news! In the middle of a system upgrade so unable to test b4 as of yet. Dxf will be useful. :wink:

monks

1 Like

Is there any way of specifying a different folder to install the beta to? I need a copy of 2.2 installed and the beta is installing over it.
I did try out the dxf import btw but WM hung with a small size file around 150 KB. It was from Global Mapper. If I can install to a diff folder I can look into it more.

monks