Why are vertices offset in 2d MapView and 3d SceneView?

1176
11
06-27-2017 03:06 PM
RichardHughes2
Occasional Contributor III

It appears that the features rendered in the WebView and MapView have a higher max allowable offset than the same features rendered in a web map in AGOL.  The 90 degree angles look good in the 2d api, but when they are drawn in 3d, they turn into non-90 degree angles.

My guess is that the 3D api enforces a higher max-allowable offset which is making the data quality poor.  I am going to try to manually adjust this setting on each layer in the scene, but I am wondering whether this is the correct approach.

Has anyone else run into this issue with shapes being modified in 3d at large scale?

The first image shows the polygons in a web map in AGOL

web map in AGOL

The second image show the same web map rendered in an Map View on my test connect web server.  As you can tell, there is a major issue happening somewhere

MapView of webmap

0 Kudos
11 Replies
HemingZhu
Occasional Contributor III

State Plane Coordinate System is suitable for 2D and for measurement or survey purpose. It won't be a surprise the it will a little off in a 3D display 

0 Kudos
RichardHughes2
Occasional Contributor III

It is difficult to explain clearly the first time.....

In the 3.x api the shapes are normal, but when I view them in the 4.x api they are modified.  Even if I use the MapView from the 4.x api.  So right now I don't know if the issue is the View on the Map or the layer in the map.

0 Kudos
RichardHughes2
Occasional Contributor III

State Plane is supported in the Local Scene just as any other projection.  I double checked the projects for the basemap and the layers and they are both in the same state plane projection.  

It looks to me like the data is generalized for display at a small scale and delivered to the client initially.  When I zoom in the geometries are not being redrawn with a less degree of generalization.

To be more precise, it is not appear to be generalizing vertices, just moving them based upon the scale and pixel size.  

0 Kudos
ThomasSolow
Occasional Contributor III

Interesting issue.  I don't know a lot about this topic.  If you're able to make those services/data public, I'd be happy to play around with them though.

If I had to guess I'd guess that this is a projection issue (like you mentioned) as opposed to a max-allowable-offset issue.

0 Kudos
RichardHughes2
Occasional Contributor III

Following up:

I published both Web Mercator and State Plane polygons and they both showed the modified geometry.

I exported the data from AGOL to a file geodatabase and verified that the data was uploaded and is being stored in the correct geometry.

After reading more on the LayerView.  It seems that issue lies in there somewhere.  The default settings, whatever they may be is not delivering the correct data to the client when zooming in to large scales.  It is as if the geometry is being rendered like the camera is far away.

0 Kudos
ThomasSolow
Occasional Contributor III

My understanding is that a polygon geometry only has to be delivered to the client once.  The changes to the visualization of the polygons as the user zooms in and out should not require additional http requests, that is all handled in the client.

I understand what you mean by "It is as if the geometry is being rendered like the camera is far away," but I'm still not sure what the issue is.  If you could post an example JSON of one of the distorted polygon graphics (preferable in web mercator), I can try to reproduce to make sure it isn't an issue with the geometry itself.  

You can try:

// after you add the feature layer to the map
view.whenLayerView(featureLayer).then(layerView => {
  layerView.queryFeatures().then(features => {
    console.log(JSON.stringify(features.map(f => f.toJSON())))
  });
});

// or if you're using  web map
webmap.then(wm => {
  // assuming there's one layer only in web map
  view.whenLayerView(wm.layers.getItemAt(0).then(layerView => {
    layerView.queryFeatures().then(features => {
      console.log(JSON.stringify(features.map(f => f.toJSON())))
    });
  });
});

to print the features, so I can try reproduce. If we can rule out a problem with the feature geometries, then it's likely something to do with how the feature services are being created.

RichardHughes2
Occasional Contributor III

Hi Thomas,

I've queried for a specific OID and returned the JSON at the bottom.  

Some things I've found through testing.

1.  The more features are in the layer, the more significant the modification of the geometry by the view.  There are 900 plus polygons in this layer.  When I published a small selection of the features there was less modification of the geometry by the view.

2.  The modification seems to be more drastic when feature are reprojected on the fly.  I am trying to use all State Plane maps since it does not require that I reproject any data.  For now I am testing with a basemap and features in Web Mercator.

3.  The geometry returned by query on a bad feature is identical to the geometry returned by the same query on a subset of the same features published as a separate service.  In this case, the subset geometry looks better, whereas the full layer has issues.

{
"fields": [
{
"alias": "Leasee",
"domain": null,
"editable": false,
"length": 50,
"name": "Leasee",
"nullable": true,
"type": "esriFieldTypeString"
}
],
"spatialReference": {
"latestWkid": 6523,
"wkid": 103102
},
"geometryType": "esriGeometryPolygon",
"features": [
{
"geometry": {
"rings": [
[
[
2289245.933,
14859004.976
],
[
2289245.891,
14858999.994
],
[
2289235.697,
14859000.08
],
[
2289235.739,
14859005.061
],
[
2289245.933,
14859004.976
]
]
],
"spatialReference": {
"latestWkid": 6523,
"wkid": 103102
}
},
"attributes": {
"Leasee": "Perkins, Lonnie"
}
}
],
"exceededTransferLimit": null
}

The above json was returned for both of the geometries highlighted below.

Highlighted feature with issue

SubSet layer with minor issues

0 Kudos
ThomasSolow
Occasional Contributor III

Thanks for the information.

I can't replicate this issue, but to summarize what I understand the issue to be:

A large set of polygons viewed from a zoomed out perspective (notice the jagged edge of the polygons, presumably this is just due to pixel size):

Once I zoom in, the edges straighten:

If I take a screenshot right as I zoom in, I can see unstraightened edges before they're redrawn:

This seems to be more or less the issue here: that this process is not working for your geometries and (some) of your polygons are not being redrawn as you zoom in and out.

As to why that's happening, I'm still fairly clueless.  It could be a setting on your feature service I suppose, something like "maxAllowableOffset" as you mentioned.   So playing with that setting might be worthwhile, although you may have already tried that.

The fact that you mention this issue is worse for larger numbers of polygons makes me think that this may not be the issue though.  I'll keep playing around with this though.

0 Kudos
RichardHughes2
Occasional Contributor III

Thanks a bunch!!

With the new API is it best practice to use Web Mercator for everything?

There is a setting I see on the Feature Layers that is called "generalizedForScale = 4000".  This does look like the scale at which the geometry is stuck at.  

Are you able to tell if this property on your feature services changes with the scale in the map changing?

0 Kudos