Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEALast week's solution can be found HERE!
For this challenge that is taking place on Valentine's Day 2017, build and an app that can find the nearest candy and flower stores near a user-given location. As a result, the application should be able to do the following:
1) Take a map input of a user's location
2) Allow the user to choose between 'florists' and 'confectionaries'
3) Choose if the user wants to find closest distance or drivetime
4) Based on #4, allow the user to input how many minutes or miles are the willing to travel
5) On the output of a map report, allow the user to specify a header
6) Allow the user to specify the directory they want to save the report to
Hint: If the Primary SIC starts with '51' it's a confectionary, if it starts with '59', it's a florist. Be aware that these are Colorado stores only.
For anybody who solves the challenge on or before February 15th, we will be awarded this special badge! If you could not figure out the solution, you can earn the following badge by attending THIS live training, where you can watch how the solution for this challenge was built.
Ok! I'll rearrange my calendar and solve this one. I <3 the challenge. If anyone wants to work with me via webex, PM me. I'll be starting this soon.
Cheers,
Mark
Getting in Early. I think I have this right but I'm never sure if I'm missing something with rendering the output directly to the web browser when running an app from the server.
My solution:
Hi @JoeM,
I am working the solution now. I have clarification questions to ask:
Cheers,
Mark
1) Yes, since not everyone has the data, raw miles will be fine, DriveTime is a bonus :)
2) Yes, I should have mentioned that the intention should be that it works for anyone in Colorado, since the stores are all Colorado based. For the purpose of the solution, assume you live anywhere you desire in Colorado. If you have access to the D&B analytical file, you can use that as well!
I've solved the problem, but had some difficulties.
1. Header macro wasn't found for export.
2. I couldn't figure out how to throw an error message when a pin isn't dropped onto the map input tool.
Here's my take on the output.
Looks good @MarqueeCrew! Your report header macro is showing up just fine when I look at your solution. The one thing your map is missing is the colorado shape file from your map input interface tool. What a very interesting question about error messaging for the map input (which I had not built into the solution). To get it to error appropriately, I used Alteryx to generate an expression to go within the error tool. I dropped 4 points on a map around Colorado and used a workflow to generate a universe for my error tool:
ST_CreatePolygon(st_createpoint(-109.281006,41.087632),st_createpoint(-101.90918,41.104191),st_createpoint(-101.887207,36.791691),st_createpoint(-109.302979,36.712467))
From there I wrote a RegEx to parse the result of the map tool for my target coordinates :
ST_CreatePoint( tonumber(REGEX_Replace([#1], '.+Coordinates":\[(.+),.+\].+', "$1")), tonumber(REGEX_Replace([#1], '.+Coordinates":\[.+,(.+)\].+', "$1"))) )
Finally, I used the error tools nested the universe and target logic from above into a contains to have my error work accordingly:
!( ST_Contains( //Universe from below workflow ST_CreatePolygon(st_createpoint(-109.281006,41.087632),st_createpoint(-101.90918,41.104191),st_createpoint(-101.887207,36.791691),st_createpoint(-109.302979,36.712467)), //Target ST_CreatePoint( tonumber(REGEX_Replace([#1], '.+Coordinates":\[(.+),.+\].+', "$1")), tonumber(REGEX_Replace([#1], '.+Coordinates":\[.+,(.+)\].+', "$1"))) ) )
WHEW! I'd be interested to see if any spatial gurus step in and have a better way than I do.
Thank you for this challenge, it is really a great way to stay aware about all tools available. I rarely use the spacial tools.
My solution does not work regarding the 'drivetime' option since I don't have the data-sets, except that I think it does the work.
Happy valentine's day ;)
Hi Joe,
Thanks for this challenge. It was fun to work on. Sorry it took a while as I got distracted with other engagements.
Here is my stab at the solution.
I have taken a slight deviation to add more value and perspective to this solution.
I found that the output as asked for, did not give the user their location. This makes it hard to spatially recognize the store location in terms of directions and distance. So I added the user's location to the map.
Once I did this, and it showed only the closest result, my label for the user location was completely or partially missing from the map depending on where the closest store was. So I took the liberty to add a question for 'How many stores would you like?' This on most occasions resulted in the user's location clearly being marked.
So finally this is my solution. Hope I have met the requirements.