Skip to content

Commit 5bf63f1

Browse files
committed
phpGPS 1.0
The initial commit of phpGPS code to Github, v1.0 of the web app for creating and administering gps entries. Includes readme with example add gps entry get command Includes admin user system to control entries and related info Draws markers and lines on a google map with accuracy circles
1 parent de11854 commit 5bf63f1

31 files changed

+2776
-0
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
11
# phpGPS
22
A php based webservice for GPS tracking with Google Maps integration
3+
========
4+
5+
Version 1.0
6+
7+
www.mikelduke.com
8+
9+
10+
*******************************************************************************
11+
A php based webservice for GPS tracking with Google Maps integration
12+
13+
Uses Bootstrap to display the Admin pages:
14+
http://getbootstrap.com/
15+
16+
Get a Google Maps API Key:
17+
https://developers.google.com/maps/signup
18+
19+
*******************************************************************************
20+
21+
22+
## Features
23+
* Stores gps coordinates in a MySQL database, generates xml, and draws markers on to an Google Maps map.
24+
* Draw Paths on the map using the gps entries
25+
* Paths can be colored
26+
* Entries can be linked to paths, to a device, and a device to an owner
27+
* Multiple gps entry types with custom icons
28+
* Edit markers on the map view by dragging to new locations
29+
* Shows marker name and comment in small dialog on map view
30+
* Can have multiple users to admin the system
31+
* Users can easily add new gps points either through the admin interface or using any external client capable of making HTTP GET requests.
32+
* On Android, it is simple to create a task using the app [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=en) to generate the requests as desired.
33+
* To embed on a webpage: <iframe src="view.php" height="520" width="520" seamless></iframe>
34+
35+
Example Update URL:
36+
http://yoursite.com/phpGPS/addGpsEntry.php?key=1234&newEntry=Y&gps_devicename=DeviceID&gps_type_id=1&gps_path_id=1&gps_date_dt=11-13-2014&gps_date_time=22.31&gps_status=&gps_latitude=32&gps_longitude=-96&gps_altitude=160.0&gps_accuracy=57&gps_name=test%20spot&gps_comment=test%20comment&gps_address1=address%201&gps_address2=address%202&gps_address3=address%203&gps_city=city&gps_zipcode=567567&gps_state=state&gps_country=country
37+
38+
## Important Pages
39+
* phpGPS_Settings.php - Settings File
40+
* generateXML.php - Generates xml for use by google maps
41+
* view.php - Displays the map with markers, embeddedable in an iframe
42+
43+
44+
## Requirements
45+
* php 5
46+
* MySQL
47+
* Webserver
48+
49+
50+
## Install Instructions
51+
1. Extract php files to webhost
52+
2. Download bootstrap and extract to phpGPS/bootstrap
53+
3. Create Database for use by phpGPS
54+
4. Enter database settings and other config in phpGPS_Settings.php
55+
5. Open phpGPS/install/install.php in browser to create the necessary tables
56+
6. Delete the install folder on webhost
57+
7. Login as user admin/admin and change the default admin pass
58+
8. Set up owners, devices, paths, etc as desired and start creating markers

sql/CreateTables.sql

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
-- Create Table for phpGPS
2+
3+
CREATE TABLE IF NOT EXISTS gps_owner (
4+
gps_owner_id int NOT NULL AUTO_INCREMENT,
5+
gps_owner_name varchar(100),
6+
gps_owner_desc varchar(500),
7+
gps_owner_email varchar(100),
8+
gps_owner_address varchar(200),
9+
gps_owner_website varchar(200),
10+
gps_owner_phone varchar(20),
11+
PRIMARY KEY (gps_owner_id)
12+
);
13+
14+
CREATE TABLE IF NOT EXISTS gps_device (
15+
gps_device_id int NOT NULL AUTO_INCREMENT, -- PK Unique Entry ID
16+
gps_device_local_id varchar(255), -- Unique Device ID from Device
17+
gps_device_name varchar(255),
18+
gps_device_desc varchar(255),
19+
gps_device_comment varchar(2000),
20+
gps_owner_id int,
21+
PRIMARY KEY (gps_device_id),
22+
UNIQUE (gps_device_local_id),
23+
FOREIGN KEY (gps_owner_id) REFERENCES gps_owner(gps_owner_id)
24+
);
25+
26+
CREATE TABLE IF NOT EXISTS gps_type (
27+
gps_type_id int NOT NULL AUTO_INCREMENT,
28+
gps_type_name varchar(30),
29+
gps_type_desc varchar(255),
30+
gps_type_image varchar(2000),
31+
gps_type_icon varchar(300),
32+
PRIMARY KEY (gps_type_id)
33+
);
34+
35+
CREATE TABLE IF NOT EXISTS gps_path (
36+
gps_path_id int NOT NULL AUTO_INCREMENT,
37+
gps_path_name varchar(100),
38+
gps_path_desc varchar(500),
39+
gps_type_id int, -- Default Path Icon type
40+
gps_path_status varchar(1),
41+
gps_path_color varchar(20),
42+
PRIMARY KEY (gps_path_id),
43+
FOREIGN KEY (gps_type_id) REFERENCES gps_type(gps_type_id)
44+
);
45+
46+
CREATE TABLE IF NOT EXISTS gps_entries (
47+
gps_entry_id int NOT NULL AUTO_INCREMENT, -- PK Unique Entry ID
48+
gps_entry_date DATETIME NOT NULL, -- Date the entry was made
49+
gps_device_id int, -- ID field for use with multiple devices
50+
gps_type_id int,
51+
gps_path_id int,
52+
gps_path_sequence FLOAT(6, 3), -- Sequence in path if points are added out of order
53+
gps_date DATETIME NOT NULL, -- Date of the GPS reading
54+
gps_status varchar(1), -- Field to hold status, ie H for Hide
55+
gps_latitude FLOAT(12, 8) NOT NULL,
56+
gps_longitude FLOAT(12, 8) NOT NULL,
57+
gps_altitude FLOAT(6,1),
58+
gps_accuracy int,
59+
gps_name varchar(100),
60+
gps_comment varchar(2000),
61+
gps_address1 varchar(500),
62+
gps_address2 varchar(500),
63+
gps_address3 varchar(500),
64+
gps_city varchar(200),
65+
gps_zipcode varchar(10),
66+
gps_state varchar(50),
67+
gps_country varchar(100),
68+
PRIMARY KEY (gps_entry_id),
69+
FOREIGN KEY (gps_device_id) REFERENCES gps_device(gps_device_id),
70+
FOREIGN KEY (gps_type_id) REFERENCES gps_type(gps_type_id),
71+
FOREIGN KEY (gps_path_id) REFERENCES gps_path(gps_path_id)
72+
);
73+
74+
CREATE TABLE IF NOT EXISTS user_types (
75+
user_type_id int NOT NULL AUTO_INCREMENT,
76+
user_type_name varchar(20) NOT NULL,
77+
user_type_desc varchar(200),
78+
PRIMARY KEY (user_type_id),
79+
UNIQUE (user_type_name)
80+
);
81+
82+
CREATE TABLE IF NOT EXISTS users (
83+
user_id int NOT NULL AUTO_INCREMENT,
84+
user_name varchar(100) NOT NULL,
85+
user_pass varchar(100) NOT NULL,
86+
user_salt varchar(10) NOT NULL,
87+
user_type_id int,
88+
PRIMARY KEY (user_id),
89+
FOREIGN KEY (user_type_id) REFERENCES user_types(user_type_id),
90+
UNIQUE (user_name)
91+
);

sql/DropTables.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Drops tables used in phpGPS
2+
3+
drop table users;
4+
drop table user_types;
5+
drop table gps_entries;
6+
drop table gps_path;
7+
drop table gps_type;
8+
drop table gps_device;
9+
drop table gps_owner;

sql/InsertTestData.sql

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
-- Inserts Test data to database
2+
3+
-- Table of GPS Owners
4+
insert into gps_owner (
5+
gps_owner_name,
6+
gps_owner_desc,
7+
gps_owner_email,
8+
gps_owner_address,
9+
gps_owner_website,
10+
gps_owner_phone
11+
) VALUES (
12+
'Mikel Duke',
13+
'',
14+
'',
15+
'',
16+
'www.mikelduke.com',
17+
''
18+
);
19+
20+
-- Table of GPS Devices FKed to Owners
21+
insert into gps_device (
22+
gps_device_local_id,
23+
gps_device_name,
24+
gps_device_desc,
25+
gps_device_comment,
26+
gps_owner_id
27+
) VALUES (
28+
'KOT49H',
29+
'Note 3',
30+
'Samsung Galaxy Note 3',
31+
'My current cell phone',
32+
1
33+
);
34+
35+
-- GPS Icon Types
36+
insert into gps_type (
37+
gps_type_name,
38+
gps_type_desc,
39+
gps_type_image,
40+
gps_type_icon
41+
) VALUES (
42+
'restaurant',
43+
'test restaurant type',
44+
'',
45+
'red'
46+
);
47+
48+
-- GPS Path Info
49+
insert into gps_path (
50+
gps_path_name,
51+
gps_path_desc,
52+
gps_type_id,
53+
gps_path_status,
54+
gps_path_color
55+
) VALUES (
56+
'test path 1',
57+
'testing restaurant paths',
58+
1,
59+
NULL,
60+
'blue'
61+
);
62+
63+
-- GPS Locations
64+
insert into gps_entries (
65+
gps_entry_date,
66+
gps_device_id,
67+
gps_type_id,
68+
gps_path_id,
69+
gps_date,
70+
gps_status,
71+
gps_latitude,
72+
gps_longitude,
73+
gps_altitude,
74+
gps_accuracy,
75+
gps_name,
76+
gps_comment,
77+
gps_address1,
78+
gps_address2,
79+
gps_address3,
80+
gps_city,
81+
gps_zipcode,
82+
gps_state,
83+
gps_country
84+
) VALUES (
85+
now(),
86+
1,
87+
1,
88+
1,
89+
now(),
90+
NULL,
91+
32.97572738,
92+
-96.7106512,
93+
140.0,
94+
180,
95+
'test name',
96+
'test comment',
97+
'addy1',
98+
'addy2',
99+
'addy3',
100+
'city',
101+
'34543',
102+
'texas',
103+
'USA'
104+
);
105+
106+
insert into gps_entries (
107+
gps_entry_date,
108+
gps_device_id,
109+
gps_type_id,
110+
gps_path_id,
111+
gps_date,
112+
gps_status,
113+
gps_latitude,
114+
gps_longitude,
115+
gps_altitude,
116+
gps_accuracy,
117+
gps_name,
118+
gps_comment,
119+
gps_address1,
120+
gps_address2,
121+
gps_address3,
122+
gps_city,
123+
gps_zipcode,
124+
gps_state,
125+
gps_country
126+
) VALUES (
127+
now(),
128+
1,
129+
1,
130+
1,
131+
now(),
132+
NULL,
133+
32.86172238,
134+
-96.76385136,
135+
108.0,
136+
48,
137+
'name 2',
138+
'test comment 2',
139+
'2-addy1',
140+
'2-addy2',
141+
'2-addy3',
142+
'2-city',
143+
'2-34543',
144+
'2-texas',
145+
'2-USA'
146+
);
147+
148+
insert into user_types (
149+
user_type_name,
150+
user_type_desc
151+
) VALUES (
152+
'admin',
153+
'Administrator'
154+
);
155+
156+
insert into user_types (
157+
user_type_name,
158+
user_type_desc
159+
) VALUES (
160+
'users',
161+
'Users'
162+
);
163+
164+
insert into users (
165+
user_name,
166+
user_pass,
167+
user_salt,
168+
user_type_id
169+
) VALUES (
170+
'admin',
171+
'00SLi00eTJrV2',
172+
'00',
173+
1
174+
);
175+
176+
-- Test Selection
177+
178+
select
179+
*
180+
from
181+
gps_entries ge
182+
left join gps_device gd on ge.gps_device_id = gd.gps_device_id
183+
where
184+
ge.gps_status <> 'H' or ge.gps_status IS NULL
185+
order by
186+
ge.gps_date;
187+

0 commit comments

Comments
 (0)