2

I have a problem I could use some help with. In our application we have multiple FeatureLayers and on some of these layers a user can draw new objects.

When a user draws a new object, lets call it a tent (any type of Geometry), I need to check if the position is valid. The object is valid when it does not consume the same position as a building. The buildings are stored on a separate featureLayer that is stored on a MapServer (and loaded in the browser). The drawing, the tent, is only stored locally (for now).

So to get to the point.. what is think I need is a service that finds the distance between all objects on a layer(the buildings) and the object that is drawn at-the-moment..

I did have a look at the SummarizeNearby services but at this moment we don’t have the license for it. Then I had a look at the GeometryService and I would like to know if this is the correct way to do it..

I think it is possible to use the difference or intersect method of the GeometryService to find the difference between all the graphic/geometries on the buildings-layer and the drawn-object. If the difference is the same size as the graphics in the buildings-layer, then there is no conflict. But if the result is different then the buildings-layer, then the buildings-layer did contain the object that is just drawn, and there-for the drawn object is not valid.

Please let me now if this is the way to go, or if there are other ways to calculate/find objects that intersect/overlap.

1 Answer 1

0

sounds like all you need to do is execute a spatial query against your buildings service passing the newly drawn geometry to see if any features are returned. take a look at this sample for an example.

you'd do something nearly identical, but check instead to make sure no features were returned.

1
  • Works great! one small question, i want to use the Shape Comparison Language but can't get it working with this code: query.spatialRelationship = Query.SPATIAL_REL_RELATION; query.relationParam = "G1 IN G2": ( i want a more fine-grained relation check..) Some how the server returns an error.. But the default relation types do work..
    – Nico Bijl
    Commented Feb 11, 2015 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.