Create Numerous Independent Shapes from One Colored Map

General discussions about Inkscape.
skea
Posts: 4
Joined: Sat Jan 30, 2010 11:44 am

Create Numerous Independent Shapes from One Colored Map

Postby skea » Sat Jan 30, 2010 12:03 pm

Hi people, i am new to using Inkscape and i need some help.
i have this map file that i exported from a mapping application. It has a number of colors but its one shape. It has polygons that are districts in my country, each having a unique color. I need to create each of them to be shapes of thier own. What i have tried to achieve this result is by using the Dropper(to select the district color), then i click on the select tool(to make sure that no other shape is selected), then i click on the PaintBucket tool and refill the district-color of the corresponding district. This makes this polygon to be an independent shape, HOWEVER, i have so many districts(90+) and the process is tedius. Is there a quicker way of creating these independent shapes?

regards.
Last edited by skea on Sat Jan 30, 2010 12:16 pm, edited 1 time in total.

skea
Posts: 4
Joined: Sat Jan 30, 2010 11:44 am

Re: Create Numerous Independent Shapes from One Colored Map

Postby skea » Sat Jan 30, 2010 12:13 pm

Attached herewith is my png image.
Attachments
image_0.png
image_0.png (45.39 KiB) Viewed 3367 times

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

Re: Create Numerous Independent Shapes from One Colored Map

Postby brynn » Sat Jan 30, 2010 2:06 pm

I think Trace Bitmap, from the Path menu, should do the trick. If it works as I expect, it will leave you with each district being a vector shape, in the same color. Then you can use Fill and Stroke dialog to color them. You would still have to do it individually.....unless you want them to be the same color that they already are. Depending on which settings you use in Trace Bitmap, you may have to do nothing else at all.

skea
Posts: 4
Joined: Sat Jan 30, 2010 11:44 am

Re: Create Numerous Independent Shapes from One Colored Map

Postby skea » Sat Jan 30, 2010 6:40 pm

I cant get this to be done. It doesn't make each shape to be a vector. It only does when i use the Fill and Stroke as i explained earlier.
May you please try this on the image i posted.

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

Re: Create Numerous Independent Shapes from One Colored Map

Postby brynn » Sun Jan 31, 2010 5:35 pm

Well, I don't have a great deal of experience with Trace Bitmap. But when I read your 1st message, that each district was a polygon, I didn't look at the picture, and expected polygons. Now that I see your picture, they aren't really polygons, and I think the process that you have found to work with the Paint Bucket, is probably best.

I can't really follow what you're doing with the dropper tool, then select, then Paint Bucket. But here's what I would do:
- Zoom your image up to maybe 500% (this will make sure that all the detail of each shape is preserved in the smaller districts). Zoom higher if necessary.
- Use the Paint Bucket tool :tool_paintbucket:
- Click on a district. This will color that district whatever you have for your default for the Paint Bucket tool.
- Either open Fill and Stroke dialog, or choose color from palette, or use dropper tool, to make that district the color you want.

The only other thing that I think might be better, is to put the PNG image on a lower layer, and trace out each district on a partially transparent upper layer. It would probably take much longer, but perhaps achieve better detail.

I'm sorry I don't have a less tedious solution. But don't forget to save frequently as you work, so in case of a crash, you won't lose much. All best :D

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: Create Numerous Independent Shapes from One Colored Map

Postby kelan » Mon Feb 01, 2010 11:21 pm

I think the Trace Bitmap tool can get you pretty far, actually. I downloaded your image and got nice results. Try this.

  1. Import your image: File -> Import
  2. It should be selected upon import, but if not, select it.
  3. Path -> Trace Bitmap
  4. In the bottom section of the dialog, choose "Colors".
  5. For "Scans" set 100.
  6. Uncheck the box next to "Smooth".
  7. Uncheck the box next to "Stack scans".
  8. Check the box next to "Remove background".
  9. Switch to the "Options" tab at the top of the dialog.
  10. Uncheck the box next to "Suppress speckles".
  11. Uncheck the box next to "Smooth corners".
  12. Click the OK button to perform the scan.

You'll end up with a group consisting of all the shape objects. Note that the off-white outline will be one of the shapes. In my tests, it was the bottom-most object, so it should be easy to delete. After you ungroup the objects, use the Tab key to move through them and look for the path with thousands of nodes. That'll be the outline, which can be deleted.

So now you should have an object for each district. Note that the really small districts might not show up, so look out for those. The shapes will also be somewhat smoothed, so the shapes might need a bit of tweaking, depending on how accurate you need them.

skea
Posts: 4
Joined: Sat Jan 30, 2010 11:44 am

Re: Create Numerous Independent Shapes from One Colored Map

Postby skea » Wed Feb 03, 2010 10:29 pm

thanks. who would be having Vector Magic full version.

User avatar
syllie
Posts: 48
Joined: Fri Jan 15, 2010 3:51 pm
Location: Sydney, Australia
Contact:

Re: Create Numerous Independent Shapes from One Colored Map

Postby syllie » Thu Feb 04, 2010 9:14 am

Personally I would have cleaned up the PNG in Gimp (or the like) before starting a trace. If you remove the off white outline and despeckle the shapes then the districts should come up perfectly in one go. If with the same ease you fill the total country shape with a single colour in another PNG you have a clean vector shape of that too.
Life is the art of drawing without an eraser. (John W. Gardner)

http://verysimpledesigns.com - graphics resources
http://syllie.com - personal website


Return to “General Discussions”