Changing symbology per individual item for added graphics

797
6
Jump to solution
08-09-2012 01:15 AM
AdrianMarsden
Regular Contributor II
Hi

I can see how using the draw and edit toolbars I can allow my users to add their own stuff on a temporary basis, but is there any easy way yet to allow them to change the symbology of an individual item - plus to be able to add text? THey have been used to using the ArcIMS Redlining tool (http://arcscripts.esri.com/details.asp?dbid=14276) so my current project to move away from ArcIMS depends on being able to give them what they currently have.

Cheers

ACM
Reply
0 Kudos
1 Solution

Accepted Solutions
KenMorefield
Occasional Contributor
Adrian,
Check out the sample found here:
http://arcscripts.esri.com/details.asp?dbid=15706
This was developed way back in the early days of the ArcGIS Server Javascript API.  It's an awesome sample which allows you to create all types of graphics (including text), changing the colors, fonts, etc.  When you draw the graphic on the map (or add the text to the map), it creates the javascript code at the bottom of the map.  You copy and paste that code into your mapping application... Hopefully this helps give you a starting point...

Ken

View solution in original post

Reply
0 Kudos
6 Replies
JohnGravois
Frequent Contributor
You are hoping to change the value used to symbolize a feature already published in a service, correct?

I don't know of any redlining techniques, but you could definitely accomplish this by publishing a feature service and allowing people to add new attribute information and change a value which would set different predetermined symbology.

The editing sample linked below gives an example of this.  Just click an existing polygon and change its attribute from "passive" to "active" to see its symbology change.

http://help.arcgis.com/en/webapi/javascript/arcgis/demos/ed/ed_default_editingwidget.html
Reply
0 Kudos
AdrianMarsden
Regular Contributor II
Not really - it was adapting these examples http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_draw.html and http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_edit.html to allow users to change the style of the things they are drawing - the current redlining tool in ArcIMS allows them to define the style as they are drawing, but not to change it afterwards - so that is my baseline to achieve -

my goal is to allow them to edit a set of layers (point, line, polygon, annotation) which then gets stamped with their AD name and filtered when it is displayed so only they can see it.  I probably will have attributes that define the style - so a field called "Colour" and a pick list of a dozen or so.  For the my users that'll be enough, it isn't a massively used feature, but one they will moan about if I replace the old ArcIMS tool with a new one.

Cheers

ACM
Reply
0 Kudos
KenMorefield
Occasional Contributor
Not really - it was adapting these examples http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_draw.html and http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_edit.html to allow users to change the style of the things they are drawing - the current redlining tool in ArcIMS allows them to define the style as they are drawing, but not to change it afterwards - so that is my baseline to achieve -

my goal is to allow them to edit a set of layers (point, line, polygon, annotation) which then gets stamped with their AD name and filtered when it is displayed so only they can see it.  I probably will have attributes that define the style - so a field called "Colour" and a pick list of a dozen or so.  For the my users that'll be enough, it isn't a massively used feature, but one they will moan about if I replace the old ArcIMS tool with a new one.

Cheers

ACM

Hi Adrian,
You might look at the sample at the following link - pay particular attention to the "Draw Tools."
http://stlouis.esri.com/apps/exportmap/
This sample allows users to draw points, lines, and polygons, and to select the color of each graphic from a dropdown list.  You could add a handful of colors to the dropdown list for your users, and then possibly save the drawings to the users computer using HTML5 like this sample:
http://help.arcgis.com/en/webapi/javascript/arcgis/demos/exp/exp_localstorage.html

Ken
Reply
0 Kudos
AdrianMarsden
Regular Contributor II
Yay! that's the sort of thing, many thanks.

Any worked example of adding text?  Although I'm sure I can work that one out, an additional menu item, and maybe an additional drop down (or two for font size and font)

PS - I'll explore the local storage route for all sorts of options as soon as I get a date for our XP >> Windows 7 roll out - at the moment I am limited to a user base with IE8
Reply
0 Kudos
KenMorefield
Occasional Contributor
Adrian,
Check out the sample found here:
http://arcscripts.esri.com/details.asp?dbid=15706
This was developed way back in the early days of the ArcGIS Server Javascript API.  It's an awesome sample which allows you to create all types of graphics (including text), changing the colors, fonts, etc.  When you draw the graphic on the map (or add the text to the map), it creates the javascript code at the bottom of the map.  You copy and paste that code into your mapping application... Hopefully this helps give you a starting point...

Ken

View solution in original post

Reply
0 Kudos
AdrianMarsden
Regular Contributor II
As you say, awesome!  Many thanks for pointing that out


PS for others to working check this, I've added the code to my personal website http://chawke.co.uk/graphic_symbology.html

P
PS Some tweaking is needed for the latest versions, any version of the API over 2.0 breaks the layout, plus as discussed elsewhere the references to 'esri' needs moving to the end of the init function

pps Not much needed for 3.1 API - just the moving the few references to the init function and making sure the CSS was pointed to 3.1 as well 😮 which I forgot the first time http://chawke.co.uk/g3.html for tweaked version for latest API
Reply
0 Kudos