Select to view content in your preferred language

Load PostGIS MVT with ArcGIS JavaScript Maps SDK

79
0
Wednesday
EvelynHsu
Regular Contributor

We have created a polygon feature class in PostgreSQL database (using PostGIS geometry as the spatial type) in the spatial reference of EPSG:4490.

A java program was written to generate MVT from the feature class.

async getVectorTile(xMin, yMin, xMax, yMax, table, fields='objectid', filter, epsg=4490){

let sq1=`SELECT
ST_AsMVT(tile,'polygon') tile
FROM
(
SELECT ${fields},ST_AsMvtGeom(st_transform(t.shape,$epsg}),st_transform(ST_MakeEnvelope(${xMin},${yMin},${xMax},${yMax},4490),${epsg}),4096,64,TRUE)As geom
FROM
${table} t
)As tile`
if (filter) {
  sql += ` where ${filter}`
}

 

On the frontend, using ArcGIS JS SDK, a mapview was initialized with the same spatial reference (4490). However, the MVT layer could not be loaded. No error in the console and whatsoever.

 

Instead, if the mapview were to be initialized in 3857, the layer could be loaded properly with all data in the rightful place. 

 

The odd thing here is that the original data is in 4490, the shape column has SRID set to 4490, and in SQL we explicitly transformed the rows to 4490 too, but all that didn't seem to work at all.

 

Any idea what could be the issue here? 

0 Kudos
0 Replies