How do I solve this? (state markers)

edited March 2016 in Python Mode

You are a member of a team developing Google Maps applications. You are given the task of creating marker strings your team will use to produce a map showing a various cities. But wait! The tourism development boards of various states have filed a lawsuit demanding that all markers placed on Google maps be colored with the Official State ColorTM of the state containing the marker. You think this infringes your free speech rights but the boss says you’d better comply ... To keep you in your place, your boss adds another constraint. She requires that markers be of three different sizes, reflecting the population of the corresponding cities. Cities with populations of 1500 or less should have small markers, cities with more than 1500 but not more than 20000 people should have medium markers, and cities with more than 100000 people should have large markers.

Write generateMarkerStrings(citiesToMark, cityInfoDict, officialColorsDict) where the inputs are:

citiesToMark : a list of city names for which to generate marker strings. E.g. ["Diagonal", "Wahoo", "Franklin", "Uncertain"]

cityInfoDict : a dictionary with cities as keys and two-element dictionaries as values. The value dictionaries contain two keys, population and state. E.g. {"Wahoo" : {"state" : "Nebraska", "population" : 4508}, "Uncertain" : {"state" : "Texas", "population" : 150}, Franklin" : {"state" : "Iowa", "population" : 67862}}

officialColorsDict : a dictionary with state names as keys and colors as values. E.g. {"Iowa" : "yellow", "Arizona" : "blue", "Nebraska" : "red"}

The output should be a list of marker strings of the form: "markers=color:colori|size:sizei|lati,loni" where colori is the state color for the relevant city, and sizei is one of ”small”, ”medium”, or ”large”.

You may assume that the function, getLatLon(cityName, stateName), is available, and that it returns the appropriate [lat, lon] list.

def generateMarkerStrings(citiesToMark, cityInfoDict, officialColorsDict):

Answers

  • Sounds like homework. What have you got so far? Are you really doing this in Processing?

  • The message is tagged with Python, so I suppose the author just choose the first forum he found with "Programming Questions" in it (I moved it to General Discussion...).

Sign In or Register to comment.