how to show Google-Map as user-specific website background ?

erich37

Well-known member
if you go to this website, it will show a background-image of "Google Maps" which is showing the street-map of your very own city.
So it seems it is somehow pulling the IP of the user and then showing a local map.

How to do something like that ?

http://shpock.com



:)
 
if you go to this website, it will show a background-image of "Google Maps" which is showing the street-map of your very own city.
So it seems it is somehow pulling the IP of the user and then showing a local map.
How to do something like that ?
http://shpock.com
:)
Actually it's not... I went there and it shows that I'm near Dealey Plaza Park in Dallas... and I'm a GOOD 140 miles from there. ;)
I imagine they have a script using GeoIP capability, check the IP of the visitor and then link it to google maps (much like Digital Point User Map).
http://blog.wadehammes.com/post/3837158298
http://blog.teamtreehouse.com/getting-started-with-the-geolocation-api
 
You can download the GeoIP database here
You mean like this? :D
PHP:
#!/bin/sh
 
GEOIP_MIRROR="http://geolite.maxmind.com/download/geoip/database"
GEOIPDIR=/usr/share/GeoIP
#GEOIPDIR=/tmp/geoip
TMPDIR=
 
EMAIL_TO="tdperry@ride-texas.org"
EMAIL_SUBJECT="[WARNING] GeoIP update error"
EMAIL_HEAD="Oh Worthy One,"
EMAIL_CONTENT="There was an error updating the following GeoIP databases:"
EMAIL_FIX="Don't forget to launch a new update manually. No new automatic update will be done until next month!"
EMAIL_FOOT="Your Slave, from Palestine, TX (USA)."
EMAIL_META="VM: server_name - DNS: server_domain.tld - DC: server_datacenter"
EMAIL_BUGGY=""
 
DATABASES="GeoLiteCity GeoLiteCountry/GeoIP"
 
if [ -d "${GEOIPDIR}" ]; then
                cd $GEOIPDIR
 
                if [ -n "${DATABASES}" ]; then
                                TMPDIR=$(mktemp -d geoipupdate.XXXXXXXXXX)
 
                                echo "Updating GeoIP databases..."
 
                                for db in $DATABASES; do
                                                fname=$(basename $db)
 
                                                wget --no-verbose -t 3 -T 60 "${GEOIP_MIRROR}/${db}.dat.gz" -O "${TMPDIR}/${fname}.dat.gz"
 
                                                if [ "$?" = "0" ]; then
                                                                gunzip -fdc "${TMPDIR}/${fname}.dat.gz" > "${TMPDIR}/${fname}.dat"
                                                                mv "${TMPDIR}/GeoLiteCity.dat" "${GEOIPDIR}/GeoIPCity.dat"
                                                                mv "${TMPDIR}/${fname}.dat" "${GEOIPDIR}/${fname}.dat"
                                                                chmod 0644 "${GEOIPDIR}/${fname}.dat"
                                                else
                                                                if [ "${EMAIL_BUGGY}" = "" ]; then
                                                                        EMAIL_BUGGY=$db
                                                                else
                                                                        EMAIL_BUGGY=${EMAIL_BUGGY}", $db"
                                                                fi
                                                fi
                                done
 
                                [ -d "${TMPDIR}" ] && rm -rf $TMPDIR
 
                                if [ "${EMAIL_BUGGY}" != "" ]; then
                                        echo "${EMAIL_HEAD}\n\n${EMAIL_CONTENT} ${EMAIL_BUGGY}\n\n${EMAIL_FIX}\n\n\n${EMAIL_FOOT}\n\n\n${EMAIL_META}" | /usr/bin/mail -s "${EMAIL_SUBJECT}" "${EMAIL_TO}"
                                fi
                fi
fi
 
The drawback is if it can't find you, it doesn't look so nice

(click on thumbnail to enlarge)
 

Attachments

  • Untitled.webp
    Untitled.webp
    53.9 KB · Views: 50
yeah, I saw that as well.
make the screen-size of your browser smaller... then I guess it shows up.
Smaller, bigger, no change...

I think there maybe something preventing it from loading correctly. Going directly to Google maps though and everything loads fine (see attached).

It's a cool trick, but something to be mindful of anyone who tries to repeat it.
 

Attachments

  • Untitled.webp
    Untitled.webp
    144 KB · Views: 35
Back
Top Bottom