Add Shapefile widget

2250
2
Jump to solution
01-20-2016 07:33 AM
Labels (1)
DiegoLlamas
Occasional Contributor III

Hi,

I am using the "add Shapefile Widget" that someone here helped to create. Now that I am using it and checking the behavior I notice that the polygons that compose the shapefile, after adding it to WAB app the polygons do not respect the original forms, they have a distotion very significant.

First I thought it was because AGOL use Web Mercator Coordinates system. Here in Puerto Rico we use Nad83 Projected Coordinate system So I  added on parcel example in Nad83 and I notice the distortion, after that I added the same chunk of parcels projected to Web Mercator and I had the exact same distortion in the same parcels.

Add Shapefile2.PNG

Add Shapefile.PNG

My question is, Do you know why could it be happening? dos anybody knows is someone notice the same behavior? is there a new version of this widget for WAB 1.3? how could i solve this problem? this problem also happend in WAB 1.2

Thanks,

Diego Llamas

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MonikaHonkova2
New Contributor II

Hi Diego,

have you looked into the code widget.js? It generalizes features on the fly:

                  //generalize features for display Here we generalize at 1:40,000 which is approx 10 meters

                  //This should work well when using web mercator.

                  var extent = scaleUtils.getExtentForScale(widgetMap, 40000);

                  var resolution = extent.getWidth() / widgetMap.width;

                  params.generalize = true;

                  params.maxAllowableOffset = resolution;

                  params.reducePrecision = true;

                  params.numberOfDigitsAfterDecimal = 0;

Personally, I don't want the shapes to be generalized (e.g. a round circle is after generalization not that round anymore as vertices are removed) , so I commented out these few lines of code...

Monika

View solution in original post

2 Replies
MonikaHonkova2
New Contributor II

Hi Diego,

have you looked into the code widget.js? It generalizes features on the fly:

                  //generalize features for display Here we generalize at 1:40,000 which is approx 10 meters

                  //This should work well when using web mercator.

                  var extent = scaleUtils.getExtentForScale(widgetMap, 40000);

                  var resolution = extent.getWidth() / widgetMap.width;

                  params.generalize = true;

                  params.maxAllowableOffset = resolution;

                  params.reducePrecision = true;

                  params.numberOfDigitsAfterDecimal = 0;

Personally, I don't want the shapes to be generalized (e.g. a round circle is after generalization not that round anymore as vertices are removed) , so I commented out these few lines of code...

Monika

View solution in original post

DiegoLlamas
Occasional Contributor III

Monika,

Thank you for your help!

0 Kudos