Select to view content in your preferred language

Automatically Switch a basemap to NightTime Basemap if it is night?

462
2
02-26-2013 11:49 AM
CarmenDurham
Frequent Contributor
I have a Flex (2.5 API - yes, I know, but that is the way it is) app that the Police are using on their MDTs and they want to have a nighttime basemap for use at night.  We've built the cache.

Instead of Police having to manually switch the basemap, I was wondering if any one has utilized some web service to determine if a location (ie. Greenville, SC) was within daylight hours to automatically switch the basemap on application startup? 

Thanks,
Carmen
Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Carmen,

   You could do this all client side by setting up a timer to fire off every hour and check if it is time to switch the basemap.
0 Kudos
CarmenDurham
Frequent Contributor
Thanks for your reply Robert.  I understand utilizing the timer and that maybe I can see if system time is between say 6am and 6pm,  then switch to night basemap.  But a static time range won't always be good.  In the summer, it isn't dark at 6pm.

So, my question is really whether anyone has already utilized some web service that returns sunrise and sunset to determine whether or not to switch basemaps  -- AND has already posted the code somewhere and I cannot find it. 

I found this web service:   http://www.earthtools.org/webservices.htm#sun

If no one offers up any existing code or a better web service, I will maybe try using the above and write something. I am not asking anyone to write it for me, but if the code is already out there, then it would save some time!

Thanks,
Carmen
0 Kudos