FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Learn/ResetFieldDB.html at master · GeospatialPython/Learn · GitHub
GeospatialPython
/
Learn
Public
Notifications
You must be signed in to change notification settings
Fork
51
Star
85
Code
Issues
0
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Learn
/
ResetFieldDB.html
Copy path
More file actions
More file actions
Latest commit
History
History
History
85 lines (80 loc) · 2.57 KB
Breadcrumbs
Learn
/
ResetFieldDB.html
Copy path
File metadata and controls
85 lines (80 loc) · 2.57 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html
>
<
html
>
<
head
>
<
title
>
Learning Geospatial Analysis with Python 2nd Ed. Field Data Collection Example "Database" Reset
</
title
>
<
meta
name
="
viewport
"
content
="
width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no
"
>
<
style
>
body
{
padding
:
0
;
margin
:
0
;
background-color
:
#
000000
;
color
:
#
FFFFFF
;
font-family
:
Verdana
,
Arial
,
Sans-serif;
}
html
,
body
,
#
map
{
height
:
80
%
;
}
h1
,
h2
,
h3
,
h4
{
color
:
#
FFFFFF
;
font-family
:
Verdana
,
Arial
,
Sans-serif;
}
#
info
{
background-color
:
#
FFFF00
;
color
:
#
FF0000
;
font-family
:
Verdana
,
Arial
,
Sans-serif;
}
</
style
>
</
head
>
<
body
onload
="
retrieveData()
"
>
<
div
>
<
h3
>
Field Data Collection Example "Database" Reset
</
h3
>
<
font
color
="
#009933
"
>
Learning Geospatial Analysis with Python 2nd Ed.
</
font
>
<
p
>
This page resets the simple MyJSON.com storage for this cookbook example to a single geojson feature to fix the inevitable
<
a
href
="
http://www.joelonsoftware.com/articles/fog0000000319.html
"
>
Shlemiel problem
</
a
>
with this simple design. This approach
keeps this example as simple and understandable as possible.
</
p
>
</
div
>
<
div
id
="
form
"
>
<
form
id
="
dbReset
"
>
<
input
type
="
button
"
value
="
RESET
"
onclick
="
sendData()
"
>
<
br
/>
</
form
>
<
b
>
Current stored geojson contents:
</
b
>
<
br
/>
</
div
>
<
div
id
="
currentDb
"
>
</
div
>
<
script
>
var
myJsonUrl
=
'https://api.myjson.com/bins/3ztvz'
;
var
database
=
''
;
info
=
''
;
function
retrieveData
(
)
{
var
xhr
=
new
XMLHttpRequest
(
)
;
xhr
.
open
(
"GET"
,
myJsonUrl
+
"?pretty=1"
,
false
)
;
xhr
.
send
(
null
)
;
data
=
xhr
.
responseText
;
info
=
document
.
getElementById
(
"currentDb"
)
;
info
.
innerHTML
=
"<pre>"
+
data
+
"</pre>"
;
}
function
sendData
(
)
{
frm_name
=
document
.
getElementById
(
"name"
)
;
frm_date
=
document
.
getElementById
(
"date"
)
;
frm_comment
=
document
.
getElementById
(
"comment"
)
;
observation
=
{
"type"
:
"FeatureCollection"
,
"crs"
:
{
"type"
:
"name"
,
"properties"
:
{
"name"
:
"urn:ogc:def:crs:OGC:1.3:CRS84"
}
}
,
"features"
:
[
{
"type"
:
"Feature"
,
"properties"
:
{
"popupContent"
:
"NAME: Joel Lawhead<br> DATE: 2015-11-2<br> COMMENT: No ice found."
}
,
"geometry"
:
{
"type"
:
"Point"
,
"coordinates"
:
[
-
101.467289719626166
,
39.596844824675088
]
}
}
]
}
;
var
xhr
=
new
XMLHttpRequest
(
)
;
xhr
.
open
(
"PUT"
,
myJsonUrl
,
true
)
;
xhr
.
setRequestHeader
(
'Content-Type'
,
'application/json; charset=UTF-8'
)
;
// update the collected data as JSON
obs
=
JSON
.
stringify
(
observation
)
;
xhr
.
send
(
obs
)
;
info
.
innerHTML
=
"<pre>"
+
obs
+
"</pre>"
;
}
</
script
>
</
body
>
</
html
>
Back
|
FazBrowse Home
|
New Git URL