Editing a seamless polygon layer via the web?

948
11
Jump to solution
08-12-2013 07:48 PM
RobHudson
New Contributor
ArcGIS is filled with so many options, that I could really use someone who knows the entire product to point me to the right technologies.

Our users manage regions of their city.  They each need to independently divide their region into smaller delivery routes.  They need the ability to edit these route boundaries via a web interface of some kind.  When editing the boundaries of one route (moving a vertex, for example), it should also move the same vertex on the neighboring polygon, so as to keep the total area seamlessly covered.

Right now, I am using JavaScript API.  I see that it has functions for editing polygons, but nothing that I can find that will do what I describe.  I am not married to JavaScript API, and am willing to convert to a different editor (Silverlight/Flex?) if it will open up this possibility.

What do you guys think?  Can ArcGIS do what I need?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Frequent Contributor
you can see an example of snapping in action using the JS API here.

the same API supports autoComplete as well (with the help of a geometry service)

View solution in original post

0 Kudos
11 Replies
RobHudson
New Contributor
To anyone who happens to read this and offers some guidance, I am grateful for your help!

I have been scouring the forums, samples, and documentation, and have found a few hints, but nothing that provides a roadmap.  Here are the technologies that I think I need, but figuring out how to implement them remains elusive.

Snapping to other polygons:  I see that JavaScript API has a Snapping Manager (added in 2.6), however it has virtually no documentation, and is not included in any of the sample code as near as I can tell.  Can anybody please post some guidance and/or sample code for implementing snapping in JS API?

AutoComplete:  I have read about it as a concept in Desktop.  Do any of the web APIs support it?

Snapping to a different layer:  My map contains a streets layer, and the user will be drawing boundaries on top of that.  In a perfect world, I would like for their polygons to snap automatically to the street centerline, unless they happen to be holding a hotkey down (or have an option toggled).  Can this be accomplished with any of the web APIs?
0 Kudos
JohnGravois
Frequent Contributor
you can see an example of snapping in action using the JS API here.

the same API supports autoComplete as well (with the help of a geometry service)
0 Kudos
RobHudson
New Contributor
you can see an example of snapping in action using the JS API here.

the same API supports autoComplete as well (with the help of a geometry service)


Thank you very much!  That gives me a starting point.  I can see the snapping behavior when using Google Chrome.

Unfortunately, snapping in the measurement sample does not seem to work with IE.  I tried with IE versions 10, 9, 8 and 7, and it just doesn't snap.  That is kind of a big deal, because most of our customers use IE.  Does anyone know if this is just a problem with the measurement sample page, or is snapping not compatible with IE?
0 Kudos
JohnGravois
Frequent Contributor
the short answer to your question is that snapping is not broken in IE.

i was able to reproduce the error you described in IE10 only.  when using the developer tools to set "IE9"as the browser and document mode, measuring and snapping behavior returned to normal.

the IE10 specific bug you found affects AMD style maps only, and relates to a problem with the measurement widget in general, not to snapping.  here is the tracking number for the issue i logged a few minutes ago on your behalf.

[NIM093983: Measurement widget doesn't display area calculations in IE10 (AMD apps only).]


sorry for all the confusion and thanks for bringing the item to our attention!
0 Kudos
RobHudson
New Contributor
Thank you very much! 

I confirmed that by changing both the browser and document mode to IE9, I was able to use snapping.  This is something I can manage using X-UA-Compatible until the IE10 issue is fixed.

Thanks for the quick reply!
0 Kudos
RobHudson
New Contributor
FYI, the "Editor Widget with Simple Toolbar" sample says that it has snapping if you press the Alt key.  I have tried that sample using both Chrome and IE, but snapping doesn't appear to work.  Since the problem is with both IE and Chrome, it is probably a problem with the sample, rather than snapping, but I figured you guys would want to be aware of it.

http://developers.arcgis.com/en/javascript/samples/ed_simpletoolbar/

By the way, it may be better to use a different key besides Alt to toggle snapping... In IE, if the menu bar is set to hidden, the Alt key causes the menu bar at the top to toggle visible.  This causes the page to resize and re-render every time the key is pressed or depressed.
0 Kudos
JohnGravois
Frequent Contributor
looks like they forgot to load a couple modules when they converted this sample to AMD.  i added Color and SnappingManager and afterwards Snapping started working.

require([
        ...
        "esri/layers/FeatureLayer",
 "esri/SnappingManager",
        ...
        "dojo/_base/array", "dojo/_base/Color", "dojo/parser", "dojo/keys",
 
...
function(
        Map, Edit, 
        ArcGISTiledMapServiceLayer, FeatureLayer, SnappingManager,
        SimpleMarkerSymbol, SimpleLineSymbol, 
        Editor, TemplatePicker,
        esriConfig, jsapiBundle,
        arrayUtils, Color, parser, keys
      )



thanks for the catch!  i've notified the team.
0 Kudos
RobHudson
New Contributor
You have been a terrific help!  I almost have this project nailed down.

If you are feeling generous, I have a few more quick questions.


  • Because of the way I am storing the data, I need to pass the features back to ASP.Net, grab some stuff from session state, and validate them individually, before saving them to SQL using a spatial datatype.  Is there an example of serializing the json object for the features into .Net, and/or updating them to SQL?  We are a multi-tenant architecture, and the databases where these will be stored are not registered with SDE.

  • I don't want to save any features that are not "valid", meaning that I don't want users drawing polygons that cross over themselves.  Is there any way to prevent this in the UI?  If not, is there any way I can validate and throw up an alarm, either in the UI or in code-behind in .Net?

  • If two neighboring polygons share a vertex (or an edge), I want for the user to be able to move both vertexes at once (maybe while a hotkey is pressed).  Can this be done?

  • I would like to "validate" that the polygons do not overlap each other.  If they do overlap, I want to highlight the union regions to the user so they can correct them.  Is there sample code for this?


You have been a tremendous help.  If you want to pass this off to someone else, I totally understand.

Cheers, -Rob
0 Kudos
JohnGravois
Frequent Contributor
no worries.  thanks again for catching the problems in those samples.

you aren't going to be using any of the pre-baked editing tools available in the API if you need to push to .NET and SQL without using an SDE database and ArcGIS Server Feature Service.  because of this, samples will be harder to come by.

with regard to catching invalid geometries, your best bet is to use the simplify operation exposed by a geomety service.  you can pass JSON features to it and get back geometries that are guaranteed to be topologically correct.  you can find a sample here where we simplify prior to buffering.

i have seen customers write client side logic for spatial relationship validation, but haven't ever seen an example for something that complex in the API resource center.
0 Kudos