tag:blogger.com,1999:blog-4136549864035170205.post2820992362726834989..comments2008-01-28T10:55:48.223-08:00Comments on cosmotron: Generating HTML Image MapsAlexhttp://www.blogger.com/profile/08423296523921081149noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-4136549864035170205.post-43620815188098032902008-01-28T10:55:00.000-08:002008-01-28T10:55:00.000-08:002008-01-28T10:55:00.000-08:00Hey Tim,I wrote a python script that searches thro...Hey Tim,<BR/><BR/>I wrote a python script that searches through the forecast directories and builds a list of zones that need highlighting. I have a “mask” image for each zone that I generated from the same multicolored PNG that I used to generate the HTML. These masks are used to create colored overlays for the zones that need them. The overlays are layered on top of the basemap. It's only a few commands for each overlay with imagemagick. I put this script on a cron job, and it's been running every fifteen minutes for over at least a year and a half now.<BR/><BR/>–AlexAlexhttp://www.blogger.com/profile/08423296523921081149noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-58814401551667591362008-01-28T08:31:00.000-08:002008-01-28T08:31:00.000-08:002008-01-28T08:31:00.000-08:00Even cooler to me is the fact that you can update ...Even cooler to me is the fact that you can update them every 15 minutes (and you're not even there anymore, right?) I'd love to be able to update maps every week with new values -- I don't have a map server though, just ArcView 9.2 ... mind if I ask you how managed it?<BR/>thanks again,<BR/>--timTimhttp://www.blogger.com/profile/08483371752073283066noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-33493353658824595902008-01-27T16:41:00.000-08:002008-01-27T16:41:00.000-08:002008-01-27T16:41:00.000-08:00Tim,That's exactly why. The color-themed image's ...Tim,<BR/><BR/>That's exactly why. The color-themed image's only purpose is to generate the HTML image map. Once the image map has been generated you can use any image that you like. In fact, the image on the production page is being regenerated at 15 minute intervals so that the weather hazards are always up to date.<BR/><BR/>–AlexAlexhttp://www.blogger.com/profile/08423296523921081149noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-46950922419370361812008-01-27T13:15:00.000-08:002008-01-27T13:15:00.000-08:002008-01-27T13:15:00.000-08:00I notice your production version does not have uni...I notice your production version does not have unique colors for each area -- is that because you produce the same size image with a different theme, so the original image map still works? --timTimhttp://www.blogger.com/profile/08483371752073283066noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-84774454991441825322007-10-26T22:22:00.000-07:002007-10-26T22:22:00.000-07:002007-10-26T22:22:00.000-07:00Hey Roland.I wrote a VBA script for ArcMap to gene...Hey Roland.<BR/><BR/>I wrote a VBA script for ArcMap to generate a CSV text file in the required format for the python script. I don't have this VBA script on hand... I no longer work for the company that I was working for and this file is probably lost.Alexhttp://www.blogger.com/profile/08423296523921081149noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-70385579565223748372007-10-20T17:13:00.000-07:002007-10-20T17:13:00.000-07:002007-10-20T17:13:00.000-07:00Hi Michael,Thanks for your changes. They fixed it...Hi Michael,<BR/><BR/>Thanks for your changes. They fixed it.<BR/><BR/>Alex,<BR/><BR/>Still curious how you are getting your integer values out of ArcMap.<BR/><BR/>Thanks Again For Sharing,<BR/>RolandRoland Duhaimehttp://www.blogger.com/profile/09485652807645651508noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-23211209058784028412007-10-16T18:33:00.000-07:002007-10-16T18:33:00.000-07:002007-10-16T18:33:00.000-07:00micheal,thanks for catching these bugs. i've upda...micheal,<BR/><BR/>thanks for catching these bugs. i've updated the post with a patched version of the file and a credit to you in the file comments.<BR/><BR/>roland,<BR/><BR/>does it work with these changes?Alexhttp://www.blogger.com/profile/08423296523921081149noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-44369021147522361282007-10-15T08:48:00.000-07:002007-10-15T08:48:00.000-07:002007-10-15T08:48:00.000-07:00the algorithm that converts hex to int values has ...the algorithm that converts hex to int values has a bug, should be color[i:i+2], that's why the low values. Also the html it generates is invalid - here's a diff for the fixes i made <A HREF="http://pastie.textmate.org/107371" REL="nofollow">minor fixes</A><BR/><BR/>I also added a check for PIL version because this a nasty problem to figure out - the script dies and doesn't give any hint why that is ;)<BR/><BR/>Very cool software, thanks a lot for sharing it.Michaelhttp://www.blogger.com/profile/12503431663072975447noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-1705656526686188142007-10-06T18:31:00.000-07:002007-10-06T18:31:00.000-07:002007-10-06T18:31:00.000-07:00Hi Alex,To help reduce the variables with this que...Hi Alex,<BR/><BR/>To help reduce the variables with this question, I have downloaded the file alaska.png from this page. I performed a identify -verbose in imagemagick to determine the list of colors in the file. This is a snippet of the listing:<BR/><BR/> 5473: (184,107,191) #B86BBF rgb(184,107,191)<BR/> 4230: (176,128,186) #B080BA rgb(176,128,186)<BR/>...<BR/><BR/>Next, using the imagemagick results I changed your integer values to these HEX values in your example .csv file above. This allowed me to run the tool using hex values instead of the integer values. These are the first two rows of the results. All masks returned as black:<BR/><BR/>convert alaska.png -transparent "rgb(9, 2, 11)" -fx "a" +matte -negate masks/AKZ<BR/>215.png<BR/>convert alaska.png -transparent "rgb(12, 5, 13)" -fx "a" +matte -negate masks/AK<BR/>Z219.png<BR/><BR/>These results are similar to my previous results, where the rgb values seem low.<BR/><BR/>Thanks Again,<BR/>RolandRoland Duhaimehttp://www.blogger.com/profile/09485652807645651508noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-40645444190049871172007-10-06T14:12:00.000-07:002007-10-06T14:12:00.000-07:002007-10-06T14:12:00.000-07:00Hi Alex,I too have access to ArcMap. However, I d...Hi Alex,<BR/><BR/>I too have access to ArcMap. However, I don't see how you may be getting the integer values with out-of-the-box ArcMap. I notice that when I run the Python Script that the following hex values get converted to the list of RGB values below. However, these RGB values are different from other converters.<BR/><BR/>color<BR/>C41F54<BR/>ED7740<BR/><BR/>color<BR/>rgb(7, 12, 8)<BR/>rgb(12, 1, 5)<BR/><BR/>I believe I have eliminated any dithering in the image.<BR/><BR/>Thanks,<BR/>RolandRoland Duhaimehttp://www.blogger.com/profile/09485652807645651508noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-28299044115519540762007-10-03T22:01:00.000-07:002007-10-03T22:01:00.000-07:002007-10-03T22:01:00.000-07:00Roland,Yes. A true color PNG should work. In your...Roland,<BR/><BR/>Yes. A true color PNG should work. In your CSV file, you can specify the colors in hex. Note that dithering will prevent the algorithm from working, as it depends on regions being the same integer color. There shouldn't be any aliasing between regions either, that also will confuse the algorithm.<BR/><BR/>If you link an image you are having trouble with, I'll be glad to look into why it might not be working.<BR/><BR/>The integer color values are generated by the ArcMap GIS software... I haven't run into any other systems that use them.<BR/><BR/>AlexAlexhttp://www.blogger.com/profile/08423296523921081149noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-16699367346446381522007-09-12T17:01:00.000-07:002007-09-12T17:01:00.000-07:002007-09-12T17:01:00.000-07:00Thanks for the great tool Alex. I have the tool r...Thanks for the great tool Alex. I have the tool running my my "mask" png files are all black. I was wondering if you could highlight the steps you use when generating the color values. For example, will a true-color PNG file work? If I reduce the colors down then the colors dither... so reducing the colors doesn't appear to be an option in my case. For the true-color PNG I am using hex color values in the form: c41f54 as displayed in GIMP. Is this the format of the color that I should be using? What tool will give you the integer color values that you refer to? Thanks for your help with this.<BR/><BR/>RolandRoland Duhaimehttp://www.blogger.com/profile/09485652807645651508noreply@blogger.comtag:blogger.com,1999:blog-4136549864035170205.post-6661080612884256242007-04-04T11:13:00.000-07:002007-04-04T11:13:00.000-07:002007-04-04T11:13:00.000-07:00Hey AJ, this is pretty cool! I remember you telli...Hey AJ, this is pretty cool! I remember you telling me about working on something like this for the weather service, but I didn't know you generalized it all nice like that. Maybe I can take advantage for my website at some point... I've wanted to include some location information so people can look up say recycling and see the recycling centers in their area since the conception of the site. Anyways, I look forward to seeing more tricks you come up with.Tealehttp://www.blogger.com/profile/10886649754068625501noreply@blogger.com