Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > Code Samples
  New Posts New Posts RSS Feed - Inspired by LiveBlues
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedInspired by LiveBlues

 Post Reply Post Reply
Author
Message
wdavidhicks View Drop Down
Newbie
Newbie


Joined: June 01 2004
Location: United States
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote wdavidhicks Quote  Post ReplyReply Direct Link To This Post Topic: Inspired by LiveBlues
    Posted: March 16 2006 at 4:29am
It's kinda nice to receive praise for creating something that soon becomes indispensable.

We're a service company. Some of our customers have sites that don't have a CASS-certified address. We get GPS coordinates for these.

If someone needs a map from an account master there's an option to "get map". If GPS coords are present there's more options...


218 500 *
219   IF D.SM<84> # "" AND D.SM<85> # "" THEN
220   PRINT @(0,23):C.L:@(0,23):'By (G)PS coordinates or (A)ddress? ':
221   INPUT ANSWER:
222     IF ANSWER = 'G' THEN
223     PRINT @(0,23):C.L:@(0,23):'(S)treet map or (T)opographic map? ':
224     INPUT ANSWER:
225       IF ANSWER = 'S' THEN
226       URL = "http://maps.google.com/maps?q={LAT}+{LONG}&spn=0.023688,0.0 50812&hl=en"
227       END ELSE
228       URL = "http://mapper.acme.com/?lat={LAT}&long={LONG}&scale=12"
229 *       URL = "http://www.topozone.com/map.asp?lat={LAT}&lon={LONG}&size=l "
230 *       URL = "http://mapserver.maptech.com/homepage/index.cfm?lat={LAT}&l on={LONG}&scale=40000&type=1&zoom=100"
231       END
232     CALL SWAP(URL,"{LAT}",D.SM<84>,1)
233     CALL SWAP(URL,"{LONG}",D.SM<85>,1)
234     CRT ESC:STX:"<":URL:CR:
235     GOTO 5000
236     END ELSE
237     IF ANSWER # 'A' THEN GOTO 5000
238     END
239   END
240 CALL MAPS.GOOGLE.COM(D.SM<5>,D.SM<7>,D.SM<8>,D. SM<9>)
241 *


D.SM is account master info, attr's 84 & 85 are GPS coords, if present. Attr's 5, 7, 8 & 9 are address, city, state and zip. If there are no GPS coords in the master then you're launching maps.google.com with street address.

As you can see I've tried a few topographical map links. They don't seem to load real fast.

Don't ask me why I made the street map it's own subroutine while embedding the code for GPS maps. I think I felt I'd actually use the street map code someplace else.

Here's the maps.google.com subroutine:


001 SUBROUTINE MAPS.GOOGLE.COM(ADDRESS,CITY,STATE,ZIP)
002 EQU ESC TO CHAR(27), STX TO CHAR(2), CR TO CHAR(13), EM TO CHAR(25)
003 CALL HEX.CONVERT(ADDRESS)
004 CALL HEX.CONVERT(CITY)
005 COMPLETEADDRESS = ADDRESS:',+':CITY:',+':STATE:'+':ZIP
006 URL = "http://maps.google.com/maps?q={COMPLETEADDRESS}&hl=en"
007 CALL SWAP(URL,"{COMPLETEADDRESS}",COMPLETEADDRESS,1)
008 CRT ESC:STX:"<":URL:CR:
009 RETURN


The HEX.CONVERT subroutine below changes the address and city into pieces to make a string that pleases Google maps.


001 SUBROUTINE HEX.CONVERT(STRING)
002 * * * REPLACES MOST SYMBOLS WITH THEIR HEX EQUIVALENTS
003 * * * TO PASS INTO A URL
004 NEW.STRING = ""
005   FOR X = 1 TO LEN(STRING)
006   SLICE = OCONV(STRING[X,1],'MX')
007     BEGIN CASE
008     * * * Is it a space?
009     CASE SLICE = "20"
010     NEW.STRING = NEW.STRING:'+'
011     * * * Is it a hyphen?
012     CASE SLICE = "2D"
013     NEW.STRING = NEW.STRING:'-'
014     * * * Is it a symbol from hex 21 to hex 2F? (char 33 to char 47)
015     CASE SLICE GE "21" AND SLICE LE "2F"
016     NEW.STRING = NEW.STRING:'%':SLICE
017     * * * Is it a symbol from hex 3A to hex 40? (char 58 to char 64)
018     CASE SLICE GE "3A" AND SLICE LE "40"
019     NEW.STRING = NEW.STRING:'%':SLICE
020     * * * Is it a symbol from hex 5B to hex 60? (char 91 to char 96)
021     CASE SLICE GE "5B" AND SLICE LE "60"
022     NEW.STRING = NEW.STRING:'%':SLICE
023     * * * Is it a symbol from hex 7B to hex 7E? (char 123 to char 126)
024     CASE SLICE GE "7B" AND SLICE LE "7E"
025     NEW.STRING = NEW.STRING:'%':SLICE
026     CASE 1
027     NEW.STRING = NEW.STRING:STRING[X,1]
028     END CASE
029   NEXT X
030 STRING = NEW.STRING
031 RETURN

Dave Hicks
Back to Top
LiveBlues View Drop Down
Groupie
Groupie


Joined: February 28 2005
Status: Offline
Points: 93
Post Options Post Options   Thanks (0) Thanks(0)   Quote LiveBlues Quote  Post ReplyReply Direct Link To This Post Posted: March 16 2006 at 2:12pm
Looks good Dave! Thanks for sharing. I don't know if I have a need for something like this right now, but if I do in the future, I know where to find it.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.