Vectorising a map with independent paths

Post questions on how to use or achieve an effect in Inkscape.
rajhanbal
Posts: 2
Joined: Fri May 11, 2012 10:53 pm

Vectorising a map with independent paths

Postby rajhanbal » Sat May 12, 2012 5:39 pm

Dear All,

I need to do some spatial data visualiasation (Choropleth map) of the administrative areas of my location. I thought SVG might be the best bet.
Disclaimer: I am pretty new to Inkscape.

The raster image is pretty bad -

http://imgh.us/dist_tp_gp_bnd_(1).tif


I wanted to do a trace bitmap with multiple scans using colors, but realised that all the labels have to be erased. The labels often run on top of boundaries further complicating matters.
So, I traced the image manually. But, I need every area as an independent closed path to do the visualisation using a python script. How can I do it? I tried the following
-Path operations ( such as duplicating and doing a difference). But can't get beyond a point with this option over such large data.
-Exporting it to bitmap, filling areas and then using tracemap again with multiple scans. But this gets screwed up as I all objects of the same colour are shown as a single object.

This discussion was of some help.
viewtopic.php" onclick="readonly();return false;"postlink" href="http://www.mediafire.com/file/h6u6a24b3k3udav/gp_vector.svg">http://www.mediafire.com/file/h6u6a24b3 ... vector.svg

Any pointers would be deeply appreciated.
Last edited by brynn on Sat May 12, 2012 10:25 pm, edited 2 times in total.
Reason: fixed image links

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vectorising a map with independent paths

Postby brynn » Sat May 12, 2012 10:23 pm

Image
Welcome to InkscapeForum!

Your images weren't showing, and I couldn't manage to fix them. I'm not sure what the problem was. But I removed the tags so we can use the links to view them. I'll reply again once I've had a chance to look at them :D

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vectorising a map with independent paths

Postby brynn » Sat May 12, 2012 11:56 pm

Wow, that's good work!
I noticed that in hand drawing the boundaries, you've placed an enormous quantity of nodes. I'm guessing that happened accidentally by using the Pencil tool with Smoothing set to 0 or very low? Anyway, I wanted to suggest that you might try Path menu > Simplify. It will greatly reduce the number of nodes, and make the file easier to work with. However, it could sacrifice some accuracy. So try it to see what happens. You can probably still work with the file, even with all the nodes.....as long as all you need to do is connect the boundaries and add color.

And another question -- I notice that you have a dot marker at the beginning and end of many paths, but not all. Did you do that on purpose? I only ask because once you start connecting the paths, those dots may disappear. Whether you need to keep them or not will have some bearing on how you proceed.

Just to make sure I understand, what you want to do now is have each area a different color? I can think of 2 ways to do that. One way, is what you've already mentioned, connect the paths so that you have a closed path for each area, then you could simply use Fill to add the color. That will involve what's called node editing, which many people like to avoid at all costs, lol! I actually rather enjoy it.

In general, you would use the Node tool and break paths at the appropriate places ('Break path at selected nodes' button on Node tool control bar). Then when you have the proper segments ready, you would join the segments together ("Join selected end nodes' button on control bar). In many places, you will want to duplicate a path, before you join it to another, because you'll need an identical path for the area adjacent to it. Then when you have a completed closed path, you can add the color using Fill.

The other way to add color would not really require any node editing, if you didn't want to do it. You would just use the Paint Bucket tool to fill the enclosed areas. There are certain areas where the paths don't completely enclose an area, so you might need to tweak a path here and there. Technically, the Paint Bucket tool creates a new path and fills it automatically. Then you will need to change the color (the default color) to the one you want. The path it creates will probably not have the accuracy that your current paths have, and you will certainly have to tweak the new paths here and there, to make them fit well.

So those are your basic choices. If you need to keep the dot markers, you'll probably want to use the Paint Bucket tool. If not, then either way would work. And of course you'd want to weigh any preferences you might have regarding accuracy, or time limitations. The Paint Bucket tool would probably be faster and a little easier.

Let us know if you have any further questions. I can give you more complete details about node editing, if that's what you want to do. :D

User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Re: Vectorising a map with independent paths

Postby Grobe » Sat May 12, 2012 11:59 pm

The map is in tiff-format, and my guess that neither web server or browser allows to view tiff files.

However, tiff images tend to have pretty redicilous file sizes. I easilly reduced the size from 5MB to approx 125kB by using FSIV and saving as 256 colours PNG-file.
:lol:

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vectorising a map with independent paths

Postby brynn » Sun May 13, 2012 2:03 am

Oh, I didn't know that Grobe! Why do you think TIFs are not allowed?

User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Re: Vectorising a map with independent paths

Postby Grobe » Sun May 13, 2012 10:49 am

brynn wrote:Oh, I didn't know that Grobe! Why do you think TIFs are not allowed?

Don't know really. You should rather ask in a web-browser forum as it is a decision made by developers of the web browsers.
:lol:

rajhanbal
Posts: 2
Joined: Fri May 11, 2012 10:53 pm

Re: Vectorising a map with independent paths

Postby rajhanbal » Wed May 16, 2012 7:32 pm

brynn

Sorry for getting back late. Many thanks for the suggestion! It worked.

Simplify made my work a lot easier as I had lesser nodes to work with.

Dotmarker
While tracing, I added them to have a track of the points I have already traced. Don't intend to retain them. Thanks for pointing it out!

I am thinking of going ahead with the node editing. The break path tool does my job! Thanks. But I have two issues with it -

1. I need to use two operations - "Break path at selected nodes" and then "Break Apart". Is there a single operation to do it? Or am I missing something ?

2. When I duplicate a path, I am not able to select the lower object. After some googling I found a solution here -
https://answers.launchpad.net/inkscape/+question/124785
This works, but is there a simpler solution ?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Vectorising a map with independent paths

Postby brynn » Fri May 18, 2012 5:44 am

1. Actually if you have a current version of Inkscape, you might not need to use Break Apart. In the current version, you CAN join nodes of 2 separate paths (could not be done without breaking apart in older versions, I forget specifically which version when this was made possible). However, it may be easier to use Break Apart, and here's why. When you use "Break path at selected nodes" you end up with 2 nodes directly on top of each other. That makes it hard to select the one on the bottom. There are a few ways to select the bottom node, and I'll go over those below.

There's not a single operation for doing this, but I think it would be incredibly useful if there were. Maybe I'll look to see if that feature has ever been requested. I think I will submit a request, or support any that might already exist. Anyway, a lot of people find the keyboard shortcuts helpful, and in this case, would probably save some time. Those shortcuts are shown in the menu items, or Help menu > Keys/Mouse Ref.

The difference between using Break Path with Break Apart, and just using Break Path with some contortions to select the bottom node, is probably not significant. But everyone has their own personal preferences about how to do certain tasks. So here are some ways to select the bottom node of 2 nodes that are on top of each other.

--- simply drag the top node out of the way {pro-easy, con-hard to get the moved node back in precisely the original position}
--- click on the segment containing the bottom node (which selects 2 nodes) hold Shift and click the unwanted node (which deselects that one, leaving only the bottom node selected) {pro-original precision retained, con-laborious}
--- drag selection box around the 2 stacked nodes (which selects both) hold Shift and click on the top node, leaving only the bottom node selected {pro-original precision retained, con-laborious}
--- using the Tab key, you can select consecutive nodes, one at a time, so you can Tab until you have the bottom node selected {perhaps the easiest way, imo)

2. Oh yes, much easier way. That Launchpad Answer doesn't really apply to what you're doing (although I can understand how the terminology used can sound similar....that's one frustrating issue when learning how to use a new program, is learning all the terminology).

Using the Selection tool, click on the top path, then hold Alt key and click once again. Now the bottom one is selected (although you can't tell by looking which one is selected, you just have to pay attention to your clicks.....in other situations different from your project, there might be many objects stacked up, so you Alt + click as many times as you need to get down to the one you want) (there's a new feature request for a better way, long standing, much needed)

You can also use the Node tool and follow the same procedure, but it's a little trickier with the Node tool. You have to position the mouse pointer over a segment, and not over a node. And you have to hold it perfectly still when you do the Alt + click. If you nudge it even the slightest bit, you'll select that segment of the top path (2 nodes) rather then the path below.

It's good that you're trying to find answers on your own, and certainly I would encourage everyone to do so. I just wanted to suggest the info in my forum signature, as some perhaps better places to find instructions. I should probably become more familiar with Launchpad Answers myself. From my limited experience with it, they tend to answer slightly more difficult questions then basic techniques.

Anyway, happy node editing! Let us know if you run into any problems :D


Return to “Help with using Inkscape”