Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DENUE tiles
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
DENUE tiles
Commits
2f079692
Commit
2f079692
authored
Feb 19, 2021
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove '/data' in routes and calls
parent
4dca3da3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
10 deletions
+12
-10
geobuf.js
geobuf.js
+1
-1
geojson.js
geojson.js
+1
-1
geojsonmvt.js
geojsonmvt.js
+1
-1
list_layers.js
list_layers.js
+1
-1
mbtiles.js
mbtiles.js
+1
-1
mvt.js
mvt.js
+1
-1
functions.js
public/js/functions.js
+6
-4
No files found.
geobuf.js
View file @
2f079692
...
...
@@ -93,7 +93,7 @@ const sql = (params, query) => {
* 422:
* description: invalid datasource or columnname
*/
app
.
get
(
'/
data/
geobuf/:table'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/geobuf/:table'
,
async
(
req
,
res
)
=>
{
if
(
!
req
.
query
.
geom_column
)
{
req
.
query
.
geom_column
=
'geom'
;
}
...
...
geojson.js
View file @
2f079692
...
...
@@ -93,7 +93,7 @@ module.exports = function(app, pool) {
* 422:
* description: invalid datasource or columnname
*/
app
.
get
(
'/
data/
geojson/:table'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/geojson/:table'
,
async
(
req
,
res
)
=>
{
if
(
!
req
.
query
.
geom_column
)
{
req
.
query
.
geom_column
=
'geom'
;
}
...
...
geojsonmvt.js
View file @
2f079692
...
...
@@ -78,7 +78,7 @@ const geojsonSQL = (params, query) => {
}
module
.
exports
=
function
(
app
,
pool
)
{
app
.
get
(
'/
data/
geojsonmvt/:table'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/geojsonmvt/:table'
,
async
(
req
,
res
)
=>
{
//console.log(req)
...
...
list_layers.js
View file @
2f079692
...
...
@@ -88,7 +88,7 @@ const sql = () => {
* 500:
* description: unexpected error
*/
app
.
get
(
'/
data/
list_layers'
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/list_layers'
,
async
(
req
,
res
)
=>
{
try
{
const
sqlString
=
sql
()
const
result
=
await
pool
.
query
(
sqlString
);
...
...
mbtiles.js
View file @
2f079692
...
...
@@ -12,7 +12,7 @@ let header = {
// Route which handles requests like the following: /<mbtiles-name>/0/1/2.pbf
module
.
exports
=
function
(
app
)
{
app
.
get
(
'/
data/
:source/mbtiles/:z/:x/:y.pbf'
,
function
(
req
,
res
)
{
app
.
get
(
'/:source/mbtiles/:z/:x/:y.pbf'
,
function
(
req
,
res
)
{
new
MBTiles
(
p
.
join
(
__dirname
,
`/public/
${
req
.
params
.
source
}
.mbtiles`
),
function
(
err
,
mbtiles
)
{
mbtiles
.
getTile
(
req
.
params
.
z
,
req
.
params
.
x
,
req
.
params
.
y
,
function
(
err
,
tile
,
headers
)
{
if
(
err
)
{
...
...
mvt.js
View file @
2f079692
...
...
@@ -168,7 +168,7 @@ module.exports = function(app, pool, cache) {
* 422:
* description: invalid datasource or columnname
*/
app
.
get
(
'/
data/
:datasource/mvt/:z/:x/:y'
,
cacheMiddleWare
,
async
(
req
,
res
)
=>
{
app
.
get
(
'/:datasource/mvt/:z/:x/:y'
,
cacheMiddleWare
,
async
(
req
,
res
)
=>
{
if
(
!
req
.
query
.
geom_column
)
{
req
.
query
.
geom_column
=
'geom'
;
// default
}
...
...
public/js/functions.js
View file @
2f079692
...
...
@@ -7,7 +7,9 @@
/* global mapboxgl, turf */
const
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
const
baseUrl
=
new
URL
(
window
.
location
.
href
).
href
;
// returns "http://localhost:8093/"
// use `${baseUrl}something` - don't need `${baseUrl}/something`
//let selectedMunis = [{id: "09002", geom: { coordinates: [[ -99.25958633422852, 19.34791392861453 ]], type: "Polygon" }}, {id: "09012", geom: { coordinates: [[ -99.25958633422852, 19.34791392861453 ]], type: "Polygon" }}],
// selectedIDs = selectedMunis.map(m => m.id);
let
selectedMunis
=
[],
...
...
@@ -22,7 +24,7 @@ const tileSource = (mbtiles, minZoom, maxZoom) => {
// if serving directly from PostGIS, use "source-layer": table, if using mbtiles, use "source-layer": "denue"
let
pbfSource
=
{
"type"
:
"vector"
,
"tiles"
:
[
`
${
baseUrl
}
/
${
mbtiles
}
/mbtiles/{z}/{x}/{y}.pbf`
],
"tiles"
:
[
`
${
baseUrl
}${
mbtiles
}
/mbtiles/{z}/{x}/{y}.pbf`
],
"minzoom"
:
minZoom
,
"maxzoom"
:
maxZoom
,
/*"type": "symbol",
...
...
@@ -66,7 +68,7 @@ map.on("style.load", async () => {
// add municipios source
map
.
addSource
(
"dim_municipio"
,
{
"type"
:
"vector"
,
"tiles"
:
[
`
${
baseUrl
}
/
dim_municipio/mvt/{z}/{x}/{y}?geom_column=municipio_geom_4326&columns=municipio_cvegeo`
],
"tiles"
:
[
`
${
baseUrl
}
dim_municipio/mvt/{z}/{x}/{y}?geom_column=municipio_geom_4326&columns=municipio_cvegeo`
],
"maxzoom"
:
14
,
"minzoom"
:
8
,
"promoteId"
:
{
"dim_municipio"
:
"municipio_cvegeo"
}
...
...
@@ -236,7 +238,7 @@ map.on("click", "denue", async e => {
let
features
=
map
.
queryRenderedFeatures
(
e
.
point
,
{
layers
:
[
"denue"
]
});
if
(
features
.
length
!=
0
)
{
let
denue_cve
=
features
[
0
].
properties
[
"denue_cve"
];
let
denueQuery
=
`
${
baseUrl
}
/
query/dim_denue2019?columns=denue_nombre&filter=denue_cve=
${
denue_cve
}
`
;
let
denueQuery
=
`
${
baseUrl
}
query/dim_denue2019?columns=denue_nombre&filter=denue_cve=
${
denue_cve
}
`
;
const
response
=
await
fetch
(
denueQuery
);
const
denueData
=
await
response
.
json
();
new
mapboxgl
.
Popup
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment