Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FACT Data API Reader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FACT
FACT Utils
FACT Data API Reader
Commits
61aafc8e
Commit
61aafc8e
authored
3 months ago
by
Riccardo Boero
Browse files
Options
Downloads
Patches
Plain Diff
Table optimization test.
parent
0422ff4c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Project.toml
+1
-1
1 addition, 1 deletion
Project.toml
src/data_services/FACT_air.jl
+3
-1
3 additions, 1 deletion
src/data_services/FACT_air.jl
with
4 additions
and
2 deletions
Project.toml
+
1
−
1
View file @
61aafc8e
name
=
"FACT_data_API_reader"
name
=
"FACT_data_API_reader"
uuid
=
"77ed0678-dbc6-4e3d-9156-895052ddb5a7"
uuid
=
"77ed0678-dbc6-4e3d-9156-895052ddb5a7"
authors
=
[
"Riccardo Boero <ribo@nilu.no>"
]
authors
=
[
"Riccardo Boero <ribo@nilu.no>"
]
version
=
"0.0.
5
"
version
=
"0.0.
6
"
[deps]
[deps]
DataFrames
=
"a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataFrames
=
"a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
...
...
This diff is collapsed.
Click to expand it.
src/data_services/FACT_air.jl
+
3
−
1
View file @
61aafc8e
...
@@ -85,8 +85,10 @@ function us_air(conn_dict::Dict, selection::Dict)
...
@@ -85,8 +85,10 @@ function us_air(conn_dict::Dict, selection::Dict)
dftemp
=
DataFrame
()
dftemp
=
DataFrame
()
# iterate over geo objects
# iterate over geo objects
for
(
id
,
shape
)
in
zip
(
geo_id
,
shape_obj
)
for
(
id
,
shape
)
in
zip
(
geo_id
,
shape_obj
)
# Extract the first two characters of id in Julia
id_short
=
id
[
1
:
2
]
# prepare query
# prepare query
query
=
"SELECT count(*) as airports, SUM(COALESCE(COMMERCIAL, 0) + COALESCE(COMMUTER_O, 0) + COALESCE(AIR_TAXI_O, 0) + COALESCE(LOCAL_OPS, 0) + COALESCE(ITNRNT_OPS, 0) + COALESCE(MIL_ACFT_O, 0)) as flights FROM us_airports WHERE fips_state = '"
*
id
*
"' AND ST_Intersects(ST_GeomFromText('"
*
shape
*
"'), SHAPE);"
query
=
"SELECT count(*) as airports, SUM(COALESCE(COMMERCIAL, 0) + COALESCE(COMMUTER_O, 0) + COALESCE(AIR_TAXI_O, 0) + COALESCE(LOCAL_OPS, 0) + COALESCE(ITNRNT_OPS, 0) + COALESCE(MIL_ACFT_O, 0)) as flights FROM us_airports WHERE fips_state = '"
*
id
_short
*
"' AND ST_Intersects(ST_GeomFromText('"
*
shape
*
"'), SHAPE);"
# create connection
# create connection
conn
=
establish_connection
(
conn_dict
[
"host"
],
conn_dict
[
"user"
],
conn_dict
[
"password"
],
conn_dict
[
"database"
];
port
=
conn_dict
[
"port"
])
conn
=
establish_connection
(
conn_dict
[
"host"
],
conn_dict
[
"user"
],
conn_dict
[
"password"
],
conn_dict
[
"database"
];
port
=
conn_dict
[
"port"
])
# execute
# execute
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment