Created by Kyle Johnson
locplot is a programming language built upon the Google Maps Javascript API. locplot allows you to easily geocode and map locations, calculate routes, distances and travel times, all via simple commands. Default values can also be overwritten for the following:
-
style = "roadmap" | "satellite" | "hybrid" | "terrain"
-
mode = "driving" | "bicycling" | "transit" | "walking"
-
units = "imperial" | "metric"
-
red = 0-255
-
green = 0-255
-
blue = 0-255
program
: statement* (ERROR|EOF)
statement
: MAP expr
| DESCRIBE expr expr*
| CONNECT expr expr*
| ROUTE expr expr*
| DISTANCE expr expr*
| TIME expr expr*
| FILL expr expr expr*
| CIRCLE expr expr
| PRINT expr
| IDENTIFIER ASSIGN expr
| IF expr statement* ELSE statement* END
| WHILE expr statement* END
| GO IDENTIFIER LEFT_PARENTHESIS IDENTIFIER* RIGHT_PARENTHESIS statement* END
| IDENTIFIER LEFT_PARENTHESIS expr* RIGHT_PARENTHESIS
expr
: INTEGER
| expr (ASTERISK|DIVIDE|MOD) expr
| expr (PLUS|MINUS) expr
| expr (MORE|MORE_OR_EQUAL|LESS|LESS_OR_EQUAL|EQUAL|NOT_EQUAL) expr
: DOUBLE
| expr (ASTERISK|DIVIDE|MOD) expr
| expr (PLUS|MINUS) expr
| expr (MORE|MORE_OR_EQUAL|LESS|LESS_OR_EQUAL|EQUAL|NOT_EQUAL) expr
: QUOTE STRING QUOTE
| expr PLUS expr
: LOCATION_ID
Run locplot by opening up the index.html file and typing your commands into the text area on the left.
Statement | Description | Example |
---|---|---|
MAP |
geocode an expression and mark its location on the map | map "235 lake st, eau claire" |
DESCRIBE |
add additional info to an assigned location ID | describe 1 "The Estate" |
CONNECT |
connect two or more locations via polylines | connect 1 2 3 |
ROUTE |
calculate the best route between two or more locations | route 4 5 |
DISTANCE |
return the total distance between two or more locations | distance 4 5 |
TIME |
return the travel time of a defined route | time 4 5 |
FILL |
fill the area between three or more locations | fill 1 2 3 4 |
CIRCLE |
display a circle over a location at a set radius | circle 1 50 |
PRINT |
print an expression, integer or string | print "locplot rocks!" |