Select to view content in your preferred language

Adding null geometry to a map

1925
2
10-26-2015 06:41 AM
TyroneBiggums
Occasional Contributor III

I noticed that when bad data is used to create a Point graphic in a graphicLayer, a point is (seemingly) randomly placed on the map.

Specifically, the bad data is that graphic.geometry.x (and .y) is undefined.

The default map extent is about 4 when I add the point (in fact, I had a layer, then 5 points to the layer where all x and y are undefined). All points display in the middle of the USA. When I mouse scroll to zoom in/out, the points all move to the top-left visible coordinate of the map. From there, I can pan the map around, and the points stay still. The points reset to wherever the top-left visible x/y coordinate is on the map.

Any thoughts on what is happening? Why isn't there some kind of validation to not show anything? Bad data shouldn't result in unexpected visual data, no?

And yes, I'm adding validation on my end. I found a code path where I'm setting the geometry to the value of a jQuery .val() DOM element. Once I correct it, this isn't an issue. I'm just trying to understand it better.

This is for 3.14.

Thank you,
D

2 Replies
williamcarr
Occasional Contributor II

Do the graphics/points acquire a geometry after the zoom in/out event? I had some issue with this a year ago where a map click would query the x,y>create a graphic(invisible)>create a new feature in a feature layer>then applyEdits from the graphic geometry to the newly created feature. I noticed that the mouse location on a pan would update the graphic x,y before the apply edits took effect.

Interesting how your points jump to the corner when the extent changes. Any updates on your progress?

0 Kudos
TyroneBiggums
Occasional Contributor III

No update. If the graphic is added to the map with a null x or y, there is no telling where the point will be located. That occurs when the graphic is added, and it gets moved when the extent changes.

0 Kudos