joeshanak Posted November 18, 2008 Share Posted November 18, 2008 Im writing a voting program to designed around how a presidential election goes about. It's for a class (U.S. Government) project. The Idea I have is that youll be able to register and vote for a candidate. Then it will find the winning party in each state and tally up the electoral votes. In the end I want it to generate a color coded map of the U.S. Where each state is color coded for each parties color. How would I go about generating an Image like this in GD. Link to comment https://forums.phpfreaks.com/topic/133149-gd-colorcoded-map-generator/ Share on other sites More sharing options...
ratcateme Posted November 18, 2008 Share Posted November 18, 2008 i would do it by first taking a map separating it into one image per state then making it 2 images per state one red and one blue then when the results are in get it to past the images onto a map to make a complete with different colored states. Scott. Link to comment https://forums.phpfreaks.com/topic/133149-gd-colorcoded-map-generator/#findComment-692501 Share on other sites More sharing options...
cooldude832 Posted November 18, 2008 Share Posted November 18, 2008 Build`100 images 2 of each state red/blue (yes square images) the non state parts (the borders) needs to be a single off color like a orange or purple as this color will be a transparent color that will be colored. Then use the transparent color function in the gd library to remove the outlines of the states as you build an image (placing each sub image on a larger image) I don't have the exact code but once set up all you need to do is set up little controls for the source file of each state's started image. You also need to carefully rebuild the whole mpa by positioning each sub unit properly. To do this I suggest you build the map as 1 image and then partition off each state 1 by 1 making the transparent bg and note its original X/Y in the whole image. Then use those X/Y back into the gd positioning in php Link to comment https://forums.phpfreaks.com/topic/133149-gd-colorcoded-map-generator/#findComment-692509 Share on other sites More sharing options...
joeshanak Posted November 18, 2008 Author Share Posted November 18, 2008 Umm... I was thinking more of a way in which I could flood fill a state with a color. because I don't necessarily want just republican and democrat candidates. Each candidate is going to be assigned a color. I have a starter map that is just white and black. just basic lines. Link to comment https://forums.phpfreaks.com/topic/133149-gd-colorcoded-map-generator/#findComment-692514 Share on other sites More sharing options...
cooldude832 Posted November 18, 2008 Share Posted November 18, 2008 You need to partition it because you can not reproduce the polygons of each shape very easily. The transparent color transition makes it easier Link to comment https://forums.phpfreaks.com/topic/133149-gd-colorcoded-map-generator/#findComment-692524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.