Navigation Menu

Skip to content

Commit

Permalink
adjust geometry data limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gooong committed Aug 4, 2018
1 parent 3e1bf36 commit e9b8e3f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/en_US/editgrid.rst
Expand Up @@ -108,7 +108,7 @@ To view individual geometry, click corresponding button in the cell. To view all

- *About SRID:* If there are geometries with different SRIDs in the same column, the viewer will render geometries with the same SRID in the map. If SRID=4326 the OSM tile layer will be added in the map.

- *About data size:* For performance considerations, the viewer will render geometry data up to 5MB.
- *About data size:* For performance considerations, the viewer will render geometries no more than 100000, totaling up to 20MB.

**Sort/Filter options dialog**

Expand Down
20 changes: 12 additions & 8 deletions web/pgadmin/static/js/sqleditor/geometry_viewer.js
Expand Up @@ -36,7 +36,8 @@ let GeometryViewer = {

function renderGeometry(items, columns, columnIndex) {
BuildGeometryViewerDialog();
const maxRenderByteLength = 5 * 1024 * 1024; //render geometry data up to 5MB
const maxRenderByteLength = 20 * 1024 * 1024; //render geometry data up to 20MB
const maxRenderGeometries = 100000; // render geometries up to 100000
let field = columns[columnIndex].field;
let geometries3D = [],
supportedGeometries = [],
Expand All @@ -45,7 +46,8 @@ function renderGeometry(items, columns, columnIndex) {
geometryItemMap = new Map(),
mixedSRID = false,
geometryTotalByteLength = 0,
tooLargeDataSize = false;
tooLargeDataSize = false,
tooManyGeometris = false;


if (_.isUndefined(items)) {
Expand Down Expand Up @@ -76,6 +78,10 @@ function renderGeometry(items, columns, columnIndex) {
tooLargeDataSize = true;
return false;
}
if(supportedGeometries.length >= maxRenderGeometries){
tooManyGeometris = true;
return false;
}

if (!geometry.srid) {
geometry.srid = 0;
Expand All @@ -91,11 +97,9 @@ function renderGeometry(items, columns, columnIndex) {

// generate map info content
{
if (tooLargeDataSize) {
let notParsedNum = items.length - (supportedGeometries.length + unsupportedItems.length + geometries3D.length);
let content = notParsedNum + (notParsedNum > 1 ? ' geometries': ' geometry') + ' not parsed.';
infoContent.push(content +
'<i class="fa fa-question-circle" title="Due to performance limitations, just render geometry data up to 5MB." aria-hidden="true"></i>');
if (tooLargeDataSize || tooManyGeometris) {
infoContent.push(supportedGeometries.length + ' geometries rendered' +
'<i class="fa fa-question-circle" title="Due to performance limitations, the extra geometries are not rendered" aria-hidden="true"></i>');
}
if (geometries3D.length > 0) {
infoContent.push(gettext('3D geometries not rendered.'));
Expand Down Expand Up @@ -133,7 +137,7 @@ function renderGeometry(items, columns, columnIndex) {
};

if (mixedSRID) {
infoContent.push(gettext('Geometries with other non-SRID_') + selectedSRID + ' not rendered.' +
infoContent.push(gettext('Geometries with non-SRID') + selectedSRID + ' not rendered.' +
'<i class="fa fa-question-circle" title="There are geometries with different SRIDs in this column." aria-hidden="true"></i>');
}

Expand Down
2 changes: 1 addition & 1 deletion web/pgadmin/static/js/sqleditor/geometry_viewer_dialog.js
Expand Up @@ -23,7 +23,7 @@ function BuildGeometryViewerDialog() {
weight: 3,
};
const geojsonStyle = {
weight: 3,
weight: 2,
};
const popupOption = {
closeButton: false,
Expand Down

0 comments on commit e9b8e3f

Please sign in to comment.