<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>MapBox OSM Development</title>
 <link href="http://mapbox.com/osmdev/atom.xml" rel="self"/>
 <link href="http://mapbox.com/osmdev"/>
 <updated>2013-05-16T13:58:05-04:00</updated>
 <id>http://mapbox.com/osmdev</id>
 <author>
   <name>MapBox</name>
   <email>info@mapbox.com</email>
 </author>

 
 <entry>
   <title>Gps And Gpx</title>
   <link href="http://mapbox.com/osmdev/2013/04/05/gps-and-gpx/"/>
   <updated>2013-04-05T00:00:00-04:00</updated>
   <id>http://mapbox.com/osmdev/2013/04/05/gps-and-gpx</id>
   <content type="html"></content>
 </entry>
 
 <entry>
   <title>iD alpha3, with Radically Better Feature Editing</title>
   <link href="http://mapbox.com/osmdev/2013/03/11/id-alpha3"/>
   <updated>2013-03-11T00:00:00-04:00</updated>
   <id>http://mapbox.com/osmdev/2013/03/11/id-alpha3</id>
   <content type="html">&lt;p&gt;We just made &lt;a href='http://ideditor.com/'&gt;iD, our new OpenStreetMap editor&lt;/a&gt;, simpler and friendlier for new users. This is part of today&amp;#8217;s Alpha3 launch that also includes performance improvements, some friendly UI adjustments, and bug fixes. &lt;a href='http://openstreetmap.us/iD/release/' target='_blank'&gt;Try editing OpenStreetMap with iD alpha3!&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;img alt='grid' src='http://farm9.staticflickr.com/8103/8549119093_837b11fe3c_o.png' /&gt;&lt;/p&gt;

&lt;h2 id='feature_interface'&gt;Feature Interface&lt;/h2&gt;

&lt;p&gt;OpenStreetMap uses &lt;a href='http://wiki.openstreetmap.org/wiki/Tags'&gt;tags&lt;/a&gt; &amp;#8211; pairs of keys and values such as &lt;code&gt;shop=butcher&lt;/code&gt; &amp;#8211; to represent features and their attributes. Knowing how to tag a feature is one of the hardest parts of editing OpenStreetMap, because there are thousands of different tags and values, and most features require a combination of different tags. For instance, the &lt;code&gt;highway&lt;/code&gt; tag to identify basic road type, but details like speed limits, access, and surface require additional tags.&lt;/p&gt;

&lt;p&gt;This idea of tags is essential to handle the complexity and detail of mapping the world, but it&amp;#8217;s intimidating for new users.&lt;/p&gt;

&lt;p&gt;With iD&amp;#8217;s new interface, users can create &amp;amp; edit features without being tagging wizards. After drawing a new feature, you can search for a feature type, or select one from the grid. The search is smart and includes synonyms, so you find a feature without having to know its exact name - searching for &amp;#8216;coffee&amp;#8217; brings up the &amp;#8216;café&amp;#8217; preset.&lt;/p&gt;

&lt;p&gt;For active mappers, we keep recently used options in the grid, so it&amp;#8217;s easy to add many features of the same type.&lt;/p&gt;

&lt;p&gt;&lt;img alt='address input' src='http://farm9.staticflickr.com/8247/8550217972_28f6c6004d_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;The feature editor then shows relevant attributes with suggested values. Specific inputs, such as the address input which suggests nearby roads, make adding values even easier.&lt;/p&gt;

&lt;p&gt;The interface builds on the ideas of existing OSM editors like Potlatch 2 and JOSM and integrates them further into the default editing workflow.&lt;/p&gt;

&lt;p&gt;There is still plenty to do &amp;#8211; we plan on improving search suggestions, adding more feature types, and customizing more form elements. This is another area where iD must strike the right balance between flexibility and simplicity.&lt;/p&gt;

&lt;h2 id='operations'&gt;Operations&lt;/h2&gt;

&lt;p&gt;&lt;img alt='operations' src='http://farm9.staticflickr.com/8230/8550218012_a27de6c017_o.png' /&gt;&lt;/p&gt;
&lt;!-- troll&gt; Use the new simplify operation to remove unnecessary detail from ways in OpenStreetMap. &lt;/troll --&gt;
&lt;p&gt;You can now rotate areas, merge entities of different types, and move multiple objects at once.&lt;/p&gt;

&lt;h2 id='performance'&gt;Performance&lt;/h2&gt;

&lt;p&gt;We started using &lt;a href='http://en.wikipedia.org/wiki/R-tree'&gt;R-Trees&lt;/a&gt; for performance tuning &lt;a href='http://localhost:4000/2013/02/12/labeling-id/'&gt;iD&amp;#8217;s fast clientside labeling&lt;/a&gt; and are now using them for much more. In alpha3, all entities are stored in an R-Tree so finding them is super fast.&lt;/p&gt;

&lt;p&gt;One-way markers now use a &lt;a href='http://bl.ocks.org/mbostock/4965670'&gt;technique&lt;/a&gt; by &lt;a href='http://bost.ocks.org/'&gt;Mike Bostock&lt;/a&gt; that improves their appearance and performance.&lt;/p&gt;

&lt;h2 id='design'&gt;Design&lt;/h2&gt;

&lt;p&gt;&lt;a href='http://mapbox.com/maki/'&gt;&lt;img alt='maki' src='http://farm9.staticflickr.com/8094/8552455194_2f1d17d496_o_d.png' /&gt;&lt;/a&gt; Point features now use icons from &lt;a href='http://mapbox.com/maki'&gt;Maki&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://openstreetmap.us/iD/release/#layer=Bing&amp;amp;map=17.76/43.63706/-79.45758'&gt;&lt;img alt='iD - Beach' src='http://farm9.staticflickr.com/8103/8549119249_5106f1d45f_o.png' /&gt;&lt;/a&gt; &lt;a href='http://openstreetmap.us/iD/release/#layer=Bing&amp;amp;map=19.00/50.60991/-1.35004'&gt;&lt;img alt='iD - Farmland' src='http://farm9.staticflickr.com/8242/8550218084_cb4f5c6a72_o.png' /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some land use and natural features now have a patterned fill to help identify them.&lt;/p&gt;

&lt;h2 id='translations'&gt;Translations&lt;/h2&gt;

&lt;p&gt;Thanks to all the translators, iD is now available in Danish, German, Spanish, French, Italian, Japanese, Latvian, Dutch, Polish, Russian, Turkish, Ukrainian, and Vietnamese!&lt;/p&gt;

&lt;p&gt;Thanks to Yohan and Porjo for code contributions.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://openstreetmap.us/iD/release/'&gt;Try editing OpenStreetMap width iD alpha3!&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>iD Architecture: Map Rendering and Other UI</title>
   <link href="http://mapbox.com/osmdev/2013/02/28/id-architecture-part-3"/>
   <updated>2013-02-28T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/02/28/id-architecture-part-3</id>
   <content type="html">&lt;p&gt;&lt;em&gt;The third in a three-part series on the technical architecture of the iD editor. Previously we looked at iD&amp;#8217;s &lt;a href='http://mapbox.com/osmdev/2013/02/26/id-architecture-part-1/'&gt;core data types and actions&lt;/a&gt; and &lt;a href='http://mapbox.com/osmdev/2013/02/27/id-architecture-part-2/'&gt;modes, behaviors, and operations&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let&amp;#8217;s look at how iD renders entities on the map and its pattern for abstracting other UI components.&lt;/p&gt;

&lt;h2 id='map_rendering'&gt;Map Rendering&lt;/h2&gt;

&lt;p&gt;The core of iD&amp;#8217;s map rendering system is &lt;code&gt;iD.Map&lt;/code&gt;, which takes care of the &lt;a href='http://bl.ocks.org/mbostock/3757132'&gt;map projection&lt;/a&gt;, &lt;a href='https://github.com/mbostock/d3/wiki/Zoom-Behavior'&gt;zooming and panning&lt;/a&gt;, and states like center and zoom level. &lt;code&gt;iD.Map&lt;/code&gt; also coordinates a system of smaller pieces that render a vector map.&lt;/p&gt;

&lt;p&gt;For rendering entities on screen, iD adopts a geometric vocabulary that&amp;#8217;s a higher-level representation than OSM&amp;#8217;s simple data model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;em&gt;point&lt;/em&gt; is a node that is not a member of any way.&lt;/li&gt;

&lt;li&gt;A &lt;em&gt;vertex&lt;/em&gt; is a node that is a member of at least one way.&lt;/li&gt;

&lt;li&gt;A &lt;em&gt;line&lt;/em&gt; is a way that is not an area.&lt;/li&gt;

&lt;li&gt;An &lt;em&gt;area&lt;/em&gt; is a way that is circular and has certain tags, or a series of one or more ways grouped in a multipolygon relation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img alt='Rendering' src='http://farm9.staticflickr.com/8098/8514270658_a714bf587d_b_d.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;For each of these geometric types, &lt;code&gt;iD.svg&lt;/code&gt; has a corresponding module: &lt;code&gt;iD.svg.Points&lt;/code&gt;, &lt;code&gt;iD.svg.Vertices&lt;/code&gt;, &lt;code&gt;iD.svg.Lines&lt;/code&gt;, and &lt;code&gt;iD.svg.Areas&lt;/code&gt;. &lt;code&gt;iD.Map&lt;/code&gt; delegates to these modules to render entities on screen.&lt;/p&gt;

&lt;p&gt;Each piece of data is connected to the rendering with &lt;a href='http://bost.ocks.org/mike/join/'&gt;d3&amp;#8217;s join system&lt;/a&gt;. When iD loads and renders an entity for the first time, it is part of the &lt;em&gt;enter&lt;/em&gt; selection and the SVG elements needed to represent it are created. When a user modifies an entity, it is part of the &lt;em&gt;update&lt;/em&gt; selection and the appropriate attributes of the SVG element, like those that specify the location on screen, are updated. And when a user deletes an entity or moves it offscreen, the corresponding SVG element is in the &lt;em&gt;exit&lt;/em&gt; selection, and will be removed.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;iD.svg&lt;/code&gt; modules apply classes to SVG elements based on tags, via &lt;code&gt;iD.svg.TagClasses&lt;/code&gt;. For example, an entity tagged with &lt;code&gt;highway=residential&lt;/code&gt; gets two classes: &lt;code&gt;.tag-highway&lt;/code&gt; and &lt;code&gt;.tag-highway-residential&lt;/code&gt;. This allows distinct visual styles to be applied via CSS at either the key or key-value levels. Elements also receive a class corresponding to their entity type (&lt;code&gt;node&lt;/code&gt;, &lt;code&gt;way&lt;/code&gt;, or &lt;code&gt;relation&lt;/code&gt;) and one corresponding to their geometry type (&lt;code&gt;point&lt;/code&gt;, &lt;code&gt;line&lt;/code&gt;, or &lt;code&gt;area&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;iD.svg&lt;/code&gt; namespace has a few other modules that don&amp;#8217;t have a one-to-one correspondence with entities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;iD.svg.Midpoints&lt;/code&gt; renders small &amp;#8220;virtual nodes&amp;#8221; at the midpoints between two vertices.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;iD.svg.Labels&lt;/code&gt; renders textual &lt;a href='http://mapbox.com/osmdev/2013/02/12/labeling-id/'&gt;labels&lt;/a&gt;.&lt;/li&gt;

&lt;li&gt;&lt;code&gt;iD.svg.Surface&lt;/code&gt; sets up a stack of &lt;a href='http://www.w3.org/TR/SVG/struct.html#Groups'&gt;SVG groups&lt;/a&gt; that ensure that map elements appear in an appropriate z-order.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id='other_ui'&gt;Other UI&lt;/h2&gt;

&lt;p&gt;iD provides many user interface elements beyond than the map, including the page footer, an interface for saving changes, and geocoding controls.&lt;/p&gt;

&lt;p&gt;&lt;img alt='Geocoder UI' src='http://farm9.staticflickr.com/8099/8513159105_b189cb1703_o_d.png' /&gt;&lt;/p&gt;

&lt;p&gt;The implementations for all non-map UI components live in the &lt;code&gt;iD.ui&lt;/code&gt; namespace. These modules follow a pattern for &lt;a href='http://bost.ocks.org/mike/chart/'&gt;reusable d3 components&lt;/a&gt; Mike Bostock suggested in the context of charts. The entry point to a UI element is a constructor function; for example &lt;code&gt;iD.ui.Geocoder()&lt;/code&gt;. The constructor function may require a set of mandatory arguments. Most UI components require exactly one argument: a &lt;code&gt;context&lt;/code&gt; object produced by the top-level &lt;code&gt;iD()&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;A component needs some way to be rendered on screen by creating new DOM elements or manipulating existing elements. This is done by calling the component as a function, and passing a d3 selection where the component should render itself:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;container&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;d3&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;select&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;body&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;).&lt;/span&gt;&lt;span class='nx'&gt;append&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;div&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
    &lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;attr&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;class&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;map-control geocode-control&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;geocoder&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;ui&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Geocoder&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;)(&lt;/span&gt;&lt;span class='nx'&gt;container&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Alternatively, and more commonly, the same result is accomplished with &lt;a href='https://github.com/mbostock/d3/wiki/Selections#wiki-call'&gt;d3.selection#call&lt;/a&gt;:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='nx'&gt;d3&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;select&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;body&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;).&lt;/span&gt;&lt;span class='nx'&gt;append&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;div&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
    &lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;attr&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;class&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;map-control geocode-control&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
    &lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;call&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;ui&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Geocoder&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Some components are reconfigurable and provide functionality beyond basic rendering, by providing methods off of the function:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;inspector&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;ui&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Inspector&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;span class='nx'&gt;inspector&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;container&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt; &lt;span class='c1'&gt;// render the inspector&lt;/span&gt;
&lt;span class='nx'&gt;inspector&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt; &lt;span class='c1'&gt;// retrieve the current tags&lt;/span&gt;
&lt;span class='nx'&gt;inspector&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;on&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;change&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='nx'&gt;callback&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt; &lt;span class='c1'&gt;// get notified when a tag change is made&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id='future_direction'&gt;Future Direction&lt;/h2&gt;

&lt;p&gt;We hope you enjoyed the deep dive on iD&amp;#8217;s technical internals. As iD evolves, no doubt some of these details will change, and new architectural pieces will emerge as we build out remaining features like presets. We&amp;#8217;ve captured the text of these posts in the &lt;a href='https://github.com/systemed/iD/blob/master/ARCHITECTURE.md'&gt;ARCHITECTURE.md&lt;/a&gt; file in the iD repository, and will keep it up to date as the project matures.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>iD Architecture: Modes, Behavior, and Operations</title>
   <link href="http://mapbox.com/osmdev/2013/02/27/id-architecture-part-2"/>
   <updated>2013-02-27T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/02/27/id-architecture-part-2</id>
   <content type="html">&lt;p&gt;&lt;em&gt;The second in a three-part series on the technical architecture of the iD editor. Yesterday we looked at iD&amp;#8217;s &lt;a href='http://mapbox.com/osmdev/2013/02/26/id-architecture-part-1/'&gt;core data types and actions&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Closer to the user interface of iD lie three abstractions for a user&amp;#8217;s interaction with the system: modes, behaviors, and operations. Modes contain the code behind the &amp;#8216;Browse&amp;#8217;, &amp;#8216;Point&amp;#8217;, &amp;#8216;Line&amp;#8217; and &amp;#8216;Area&amp;#8217; buttons at the top left, behaviors provide a means of reusing common bits of code across multiple modes, and operations provide the user interface for actions. Let&amp;#8217;s look at each in detail.&lt;/p&gt;

&lt;h2 id='modes'&gt;Modes&lt;/h2&gt;

&lt;p&gt;Modes are settings that change the behavior of an application: for instance, drawing applications tends to have a &amp;#8216;move&amp;#8217; mode, which moves the picture, as well as a &amp;#8216;brush&amp;#8217; mode, in which the same clicks on the picture draw lines.&lt;/p&gt;

&lt;p&gt;Modes are useful because they allow user interfaces to be customized for certain narrow uses, and for common actions, like clicks and drags, to have multiple meanings. However, they pose a challenge for new users, who might not discover them and have access to functionality, or will not realize what mode they&amp;#8217;re currently in.&lt;/p&gt;

&lt;p&gt;In iD modes are manifested in the interface by the four buttons at the top left:&lt;/p&gt;

&lt;p&gt;&lt;img alt='Mode buttons' src='http://farm9.staticflickr.com/8376/8511573084_c0c843ac6f_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;The modality of existing OSM editors runs the gamut from &lt;a href='http://wiki.openstreetmap.org/wiki/Potlatch_2'&gt;Potlatch 2&lt;/a&gt;, which is nearly modeless, to &lt;a href='http://josm.openstreetmap.de/'&gt;JOSM&lt;/a&gt;, which sports half a dozen modes out of the box and has many more provided by plugins. iD seeks a middle ground: too few modes can leave new users unsure where to start, whereas too many can be overwhelming.&lt;/p&gt;

&lt;p&gt;iD&amp;#8217;s initial mode is &amp;#8216;Browse&amp;#8217;: one can drag the map and select entities to edit. From there, users can enter three geometrically-oriented drawing modes, Point, Line, and Area, through the mode buttons or key-shortcuts.&lt;/p&gt;

&lt;p&gt;The geometric modes are also split into a mode for the initial point drawn object and another for continuing an existing object. The exception to this rule is points, which have a single step.&lt;/p&gt;

&lt;p&gt;Selection is handled by a specific &amp;#8216;Select&amp;#8217; mode, which displays editing tools for tags and operations.&lt;/p&gt;

&lt;p&gt;The API for each mode consists of two methods: &lt;code&gt;enter&lt;/code&gt; and &lt;code&gt;exit&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;enter&lt;/code&gt; method sets up all the behavior that should be present when that mode is active. This typically means adding listeners to DOM events that will be triggered on map elements, installing keybindings, and showing certain parts of the interface like the inspector in &lt;code&gt;Select&lt;/code&gt; mode.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;exit&lt;/code&gt; method does the opposite, removing the behavior installed by the &lt;code&gt;enter&lt;/code&gt; method. Together the two methods ensure that modes are self-contained and exclusive: each mode knows exactly the behavior that is specific to that mode, and exactly one mode&amp;#8217;s behavior is active at any time.&lt;/p&gt;

&lt;h2 id='behavior'&gt;Behavior&lt;/h2&gt;

&lt;p&gt;Modes share functionality, which we abstract into behaviors. For example, in both the Browse and Draw modes, iD indicates interactive map elements by drawing a halo around them on mouse hover. Instead of duplicating the code to implement this behavior in all these modes, we extract it to &lt;code&gt;iD.behavior.Hover&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Behaviors&lt;/em&gt; are inspired by &lt;a href='https://github.com/mbostock/d3/wiki/Behaviors'&gt;d3&amp;#8217;s behaviors&lt;/a&gt;. Like d3&amp;#8217;s &lt;code&gt;d3.behavior.zoom&lt;/code&gt; and &lt;code&gt;d3.behavior.drag&lt;/code&gt;, each iD behavior is a function that takes as input a d3 selection (assumed to consist of a single element) and installs DOM event bindings necessary to implement the behavior. &lt;code&gt;iD.behavior.Hover&lt;/code&gt;, for example, installs bindings for the &lt;code&gt;mouseover&lt;/code&gt; and &lt;code&gt;mouseout&lt;/code&gt; events that add and remove a &lt;code&gt;hover&lt;/code&gt; class from map elements.&lt;/p&gt;

&lt;p&gt;Because certain behaviors are appropriate to some but not all modes, we need the ability to remove a behavior when entering a mode where it is not appropriate. d3&amp;#8217;s own behaviors &lt;a href='https://github.com/mbostock/d3/issues/894'&gt;don&amp;#8217;t offer this functionality yet&lt;/a&gt;. Each behavior implements an &lt;code&gt;off&lt;/code&gt; function that uninstalls the behavior. This is very similar to the &lt;code&gt;exit&lt;/code&gt; method of a mode, and in fact many modes do little else but uninstall behaviors in their &lt;code&gt;exit&lt;/code&gt; methods.&lt;/p&gt;

&lt;p&gt;To make modes and behaviors more concrete, here&amp;#8217;s an annotated extract from &lt;code&gt;iD.modes.Browse&lt;/code&gt;:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='c1'&gt;// Each mode is constructed with a context. This is a singleton object which&lt;/span&gt;
&lt;span class='c1'&gt;// encapsulates some global state. It&amp;#39;s constructed via the top-level iD()&lt;/span&gt;
&lt;span class='c1'&gt;// function.&lt;/span&gt;
&lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;modes&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Browse&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='c1'&gt;// Using the module pattern here: the constructor creates an object,&lt;/span&gt;
    &lt;span class='c1'&gt;// sets various properties, some of which are functions, and then returns&lt;/span&gt;
    &lt;span class='c1'&gt;// it.&lt;/span&gt;
    &lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;mode&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='nx'&gt;id&lt;/span&gt;&lt;span class='o'&gt;:&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;browse&amp;#39;&lt;/span&gt;
    &lt;span class='p'&gt;};&lt;/span&gt;

    &lt;span class='c1'&gt;// The browse mode is just a collection of behaviors.&lt;/span&gt;
    &lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;behaviors&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='p'&gt;[&lt;/span&gt;                    &lt;span class='c1'&gt;// In browse mode, you can:&lt;/span&gt;
        &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Hover&lt;/span&gt;&lt;span class='p'&gt;(),&lt;/span&gt;             &lt;span class='c1'&gt;// * Highlight entities on hover&lt;/span&gt;
        &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Select&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;),&lt;/span&gt;     &lt;span class='c1'&gt;// * Select entities via clicks&lt;/span&gt;
        &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Lasso&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;),&lt;/span&gt;      &lt;span class='c1'&gt;// * Select entities via a shift-drag lasso&lt;/span&gt;
        &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;DragNode&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;)];&lt;/span&gt;  &lt;span class='c1'&gt;// * Drag nodes around the map&lt;/span&gt;

    &lt;span class='c1'&gt;// When entering the mode, install each of the behaviors.&lt;/span&gt;
    &lt;span class='nx'&gt;mode&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;enter&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='nx'&gt;behaviors&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;forEach&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
            &lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;install&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
        &lt;span class='p'&gt;});&lt;/span&gt;
    &lt;span class='p'&gt;};&lt;/span&gt;

    &lt;span class='c1'&gt;// When exiting the mode, uninstall each of the behaviors.&lt;/span&gt;
    &lt;span class='nx'&gt;mode&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;exit&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='nx'&gt;behaviors&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;forEach&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
            &lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;uninstall&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;behavior&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
        &lt;span class='p'&gt;});&lt;/span&gt;
    &lt;span class='p'&gt;};&lt;/span&gt;

    &lt;span class='k'&gt;return&lt;/span&gt; &lt;span class='nx'&gt;mode&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id='operations'&gt;Operations&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Operations&lt;/em&gt; wrap actions, providing their user-interface: tooltips, key bindings, and the logic that determines whether an action can be performed given the current map state and selection. Each operation is constructed with the list of IDs which are currently selected and a &lt;code&gt;context&lt;/code&gt; object which provides access to the history and other important parts of iD&amp;#8217;s internal state. After being constructed, an operation can be queried as to whether or not it should be made available (i.e., show up in the context menu) and if so, if it should be enabled.&lt;/p&gt;

&lt;p&gt;&lt;img alt='Operations menu' src='http://farm9.staticflickr.com/8233/8510467127_56c4eb8926_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;We make a distinction between availability and enabled state for the sake of learnability: most operations are available so long as an entity of the appropriate type is selected. Even if it remains disabled for other reasons (e.g., because you can&amp;#8217;t split a way on its start or end vertex), a new user can still learn that &amp;#8220;this is something I can do to this type of thing&amp;#8221;, and a tooltip can provide an explanation of what that operation does and the conditions under which it is enabled.&lt;/p&gt;

&lt;p&gt;To execute an operation, call it as a function, with no arguments. The typical operation will perform the appropriate action, creating a new undo state in the history, and then enter the appropriate mode. For example, &lt;code&gt;iD.operations.Split&lt;/code&gt; performs &lt;code&gt;iD.actions.Split&lt;/code&gt;, then enters &lt;code&gt;iD.modes.Select&lt;/code&gt; with the resulting ways selected.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='c1'&gt;// An array of the ids of the currently selected entities.&lt;/span&gt;
&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;selection&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;w12345&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;];&lt;/span&gt;

&lt;span class='c1'&gt;// Construct the operation. `context` is a context object created by calling `iD()`.&lt;/span&gt;
&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;operation&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;operations&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Split&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;selection&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='nx'&gt;context&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// Can the operation be performed given the current selection&lt;/span&gt;
&lt;span class='c1'&gt;// and state of the map?&lt;/span&gt;
&lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;operation&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;available&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='o'&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class='nx'&gt;operation&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;enabled&lt;/span&gt;&lt;span class='p'&gt;())&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='c1'&gt;// If so, do it!&lt;/span&gt;
    &lt;span class='nx'&gt;operation&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id='next_time'&gt;Next time&lt;/h2&gt;

&lt;p&gt;We wrap up our architecture series with a discussion of &lt;a href='http://mapbox.com/osmdev/2013/02/28/id-architecture-part-3/'&gt;map rendering and other UI components&lt;/a&gt;.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>iD Architecture: Core and Actions</title>
   <link href="http://mapbox.com/osmdev/2013/02/26/id-architecture-part-1"/>
   <updated>2013-02-26T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/02/26/id-architecture-part-1</id>
   <content type="html">&lt;p&gt;&lt;em&gt;The first in a three-part series on the technical architecture of the iD&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href='http://mapbox.com/blog/announcing-id/'&gt;launch of iD&lt;/a&gt;, the new web-based editor that we&amp;#8217;re building for OpenStreetMap, generated interest from technical users interested in contributing to development or using parts of iD in other tools. If that describes you, or if you&amp;#8217;re just curious about the technical details of building an editor, this series is for you.&lt;/p&gt;

&lt;p&gt;Let&amp;#8217;s start by looking at the code at the center of iD: the core and actions. While iD has an impressive display layer which we&amp;#8217;ve &lt;a href='http://mapbox.com/osmdev/2013/02/12/labeling-id/'&gt;improved&lt;/a&gt; and &lt;a href='http://mapbox.com/osmdev/2013/01/11/id-design/'&gt;refined&lt;/a&gt;, the core is independent of map rendering or any UI.&lt;/p&gt;

&lt;p&gt;This core implements the very basics of the OpenStreetMap data model and the datastructures needed to track changes. Actions build on this core, providing the &amp;#8220;business logic&amp;#8221; for making changes to the map data. We&amp;#8217;ve aimed to make both highly reusable, hoping that they will prove useful in other OpenStreetMap-related tools.&lt;/p&gt;

&lt;p&gt;iD is a relatively traditional editor built on this platform, but the possibilities are endless - purpose-specific editors, more advanced user interfaces, or even using iD&amp;#8217;s core purely for querying and displaying OSM data.&lt;/p&gt;

&lt;h2 id='core'&gt;Core&lt;/h2&gt;

&lt;p&gt;The iD &lt;em&gt;core&lt;/em&gt; implements OSM data types, a graph of OSM objects&amp;#8217; relationships to one another, an undo/redo history for changes made during editing, and a couple of important auxiliary classes. It eventually aims to be a reusable, modular library to kickstart other JavaScript-based tools for OpenStreetMap.&lt;/p&gt;

&lt;p&gt;The OSM data model includes three basic data types: nodes, ways, and relations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;em&gt;node&lt;/em&gt; is a point type, having a single geographic coordinate.&lt;/li&gt;

&lt;li&gt;A &lt;em&gt;way&lt;/em&gt; is an ordered list of nodes.&lt;/li&gt;

&lt;li&gt;A &lt;em&gt;relation&lt;/em&gt; groups together nodes, ways, and other relations to provide free-form higher-level structures.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these three types has &lt;em&gt;tags&lt;/em&gt;: an associative array of key-value pairs which describe the object.&lt;/p&gt;

&lt;p&gt;In iD, these three types are implemented by &lt;code&gt;iD.Node&lt;/code&gt;, &lt;code&gt;iD.Way&lt;/code&gt; and &lt;code&gt;iD.Relation&lt;/code&gt;. These three classes inherit from a common base, &lt;code&gt;iD.Entity&lt;/code&gt;. This is the only use of classical inheritance in iD, but it&amp;#8217;s justified by the common functionality of the types. Generically, we refer to a node, way or relation as an &lt;em&gt;entity&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Every entity has an &lt;em&gt;ID&lt;/em&gt; either assigned by the OSM database or a negative, local identifier assigned by iD for newly-created objects. IDs from the OSM database as treated as opaque strings; no &lt;a href='http://lists.openstreetmap.org/pipermail/dev/2013-February/026495.html'&gt;assumptions&lt;/a&gt; are made of them other than that they can be compared for identity and do not begin with a minus sign (and thus will not conflict with proxy IDs). The three types of entities have separate ID spaces: a node can have the same numeric ID as a way or a relation. Instead of segregating ways, nodes, and other entities into different datastructures, iD internally uses fully-unique IDs generated by prefixing each OSM ID with the first letter of the entity type. For example, a way with OSM ID 123456 is represented as &amp;#8216;w123456&amp;#8217; within iD.&lt;/p&gt;

&lt;p&gt;iD entities are &lt;em&gt;immutable&lt;/em&gt;: once constructed, an &lt;code&gt;Entity&lt;/code&gt; object cannot change. Tags cannot be updated; nodes cannot be added or removed from ways, and so on. Immutability makes it easier to reason about the behavior of an entity: if your code has a reference to one, it is safe to store it and use it later, knowing that it cannot have been changed outside of your control. It also makes it possible to implement the entity graph (described below) as an efficient &lt;a href='http://en.wikipedia.org/wiki/Persistent_data_structure'&gt;persistent data structure&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Since iD is an editor, it must allow for new versions of entities. The solution is that all edits produce new copies of anything that changes. At the entity level, this takes the form of methods such as &lt;code&gt;iD.Node#move&lt;/code&gt;, which returns a new node object that has the same ID and tags as the original, but a different coordinate. More generically, &lt;code&gt;iD.Entity#update&lt;/code&gt; returns a new entity of the same type and ID as the original but with specified properties such as &lt;code&gt;nodes&lt;/code&gt;, &lt;code&gt;tags&lt;/code&gt;, or &lt;code&gt;members&lt;/code&gt; replaced.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8087/8508309757_ccf5b6f09b_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;Entities are related to one another: ways have many nodes and relations have many members. To render a map of a certain area, iD needs a datastructure to hold all the entities in that area and traverse these relationships. &lt;code&gt;iD.Graph&lt;/code&gt; provides this functionality. The core of a graph is a map between IDs and the associated entities; given an ID, the graph can give you the entity. Like entities, a graph is immutable: adding, replacing, or removing an entity produces a new graph, and the original is unchanged. Because entities are immutable, the original and new graphs can minimize memory use by sharing references to entities that have not changed instead of copying the entire graph. This persistent data structure approach is similar to the internals of the &lt;a href='http://git-scm.com/'&gt;git&lt;/a&gt; revision control system.&lt;/p&gt;

&lt;p&gt;The final major component of the core is &lt;code&gt;iD.History&lt;/code&gt;, which tracks the changes made in an editing session and provides undo/redo capabilities. Here, the immutable nature of the core types really pays off: the history is a simple stack of graphs, each representing the state of the data at a particular point in editing. The graph at the top of the stack is the current state, off which all rendering is based. To undo the last change, this graph is popped off the stack, and the map is re-rendered based on the new top of the stack.&lt;/p&gt;

&lt;p&gt;This approach constitutes one of the main differences between iD&amp;#8217;s approach to data and that of &lt;a href='http://josm.openstreetmap.de/'&gt;JOSM&lt;/a&gt; and &lt;a href='http://wiki.openstreetmap.org/wiki/Potlatch_2'&gt;Potlatch 2&lt;/a&gt;. Instead of changing a single copy of local data and having to implement an &amp;#8216;undo&amp;#8217; for each specific action, actions in iD do not need to be aware of history and the undo system.&lt;/p&gt;

&lt;p&gt;Finally, we have the auxiliary classes &lt;code&gt;iD.Difference&lt;/code&gt; and &lt;code&gt;iD.Tree&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8382/8510812506_754662d0d5_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;iD.Difference&lt;/code&gt; encapsulates the difference between two graphs, and knows how to calculate the set of entities that were created, modified, or deleted, and need to be redrawn.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;a&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Graph&lt;/span&gt;&lt;span class='p'&gt;(),&lt;/span&gt; &lt;span class='nx'&gt;b&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Graph&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;span class='c1'&gt;// (fill a &amp;amp; b with data)&lt;/span&gt;
&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;difference&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Difference&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// returns entities created between and b&lt;/span&gt;
&lt;span class='nx'&gt;difference&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;created&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;iD.Tree&lt;/code&gt; calculates the set of downloaded entities that are visible in the current map view. To calculate this quickly during map interaction, it uses an &lt;a href='http://en.wikipedia.org/wiki/R-tree'&gt;R-tree&lt;/a&gt;.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;graph&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Graph&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;span class='c1'&gt;// (load OSM data into graph)&lt;/span&gt;

&lt;span class='c1'&gt;// this tree indexes the contents of the graph&lt;/span&gt;
&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;tree&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Tree&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;graph&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// quickly pull all features that intersect with an extent&lt;/span&gt;
&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;features&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;tree&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;intersects&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;
    &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;geo&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Extent&lt;/span&gt;&lt;span class='p'&gt;([&lt;/span&gt;&lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;],&lt;/span&gt; &lt;span class='p'&gt;[&lt;/span&gt;&lt;span class='mi'&gt;2&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='mi'&gt;2&lt;/span&gt;&lt;span class='p'&gt;]),&lt;/span&gt; &lt;span class='nx'&gt;tree&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;graph&lt;/span&gt;&lt;span class='p'&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id='actions'&gt;Actions&lt;/h2&gt;

&lt;p&gt;In iD, an &lt;em&gt;action&lt;/em&gt; is a function that accepts a graph as input and returns a new, modified graph as output. Actions typically need other inputs as well; for example, &lt;code&gt;iD.actions.DeleteNode&lt;/code&gt; also requires the ID of a node to delete. The additional input is passed to the action&amp;#8217;s constructor:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='c1'&gt;// construct the action: this returns a function that remembers the&lt;/span&gt;
&lt;span class='c1'&gt;// value `n123456` in a closure so that when it&amp;#39;s called, it runs&lt;/span&gt;
&lt;span class='c1'&gt;// the specified action on the graph&lt;/span&gt;
&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;action&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;actions&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;DeleteNode&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;n123456&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;

&lt;span class='c1'&gt;// apply the action, yielding a new graph. oldGraph is untouched.&lt;/span&gt;
&lt;span class='nx'&gt;newGraph&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;action&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;oldGraph&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;iD provides actions for all the typical things an editor needs to do: add a new entity, split a way in two, connect the vertices of two ways together, and so on. In addition to performing the basic work needed to accomplish these things, an action typically contains a significant amount of logic for keeping the relationships between entities logical and consistent. For example, an action as apparently simple as &lt;code&gt;DeleteNode&lt;/code&gt;, in addition to removing the node from the graph, needs to do two other things: remove the node from any ways in which it is a member (which in turn requires deleting parent ways that are left with just a single node), and removing it from any relations of which it is a member.&lt;/p&gt;

&lt;p&gt;As you can imagine, implementing all these details requires an expert knowledge of the OpenStreetMap data model. It is our hope that JavaScript based tools for OpenStreetMap can reuse the iD&amp;#8217;s core implementation, significantly reducing the work necessary to create a robust tool.&lt;/p&gt;

&lt;h2 id='next_time'&gt;Next time&lt;/h2&gt;

&lt;p&gt;Up next, we shift gears from abstract data types and algorithms to the parts of the architecture that implement the user interface core of iD: &lt;a href='http://mapbox.com/osmdev/2013/02/27/id-architecture-part-2/'&gt;modes, behavior, and operations&lt;/a&gt;.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>iD alpha2</title>
   <link href="http://mapbox.com/osmdev/2013/02/14/id-alpha2"/>
   <updated>2013-02-14T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/02/14/id-alpha2</id>
   <content type="html">&lt;p&gt;The iD editor for &lt;a href='http://www.openstreetmap.org/'&gt;OpenStreetMap&lt;/a&gt; has reached an alpha2 release, with bug fixes, new features, and improvements to performance and usability.&lt;/p&gt;

&lt;p&gt;You can &lt;a href='http://geowiki.com/iD/'&gt;try the alpha2 release now&lt;/a&gt;, as well as the &lt;a href='http://www.openstreetmap.us/iD/master/'&gt;the latest development version&lt;/a&gt; thanks to &lt;a href='http://www.openstreetmap.us/'&gt;OpenStreetMap US&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id='live_by_default'&gt;Live By Default&lt;/h2&gt;

&lt;p&gt;iD now displays and edits live, official OpenStreetMap data by default. In previous releases, we&amp;#8217;ve relied on &lt;a href='http://api06.dev.openstreetmap.org/'&gt;the development server&lt;/a&gt; for a safe sandbox for iD, but the editor is now stable enough to be trusted with real data, and the iD team uses it as a daily editor.&lt;/p&gt;

&lt;p&gt;This also means that you don&amp;#8217;t need a dev server account - your default OSM account will work on the iD testing instance.&lt;/p&gt;

&lt;h2 id='now_available_in_'&gt;Now Available in 日本語!&lt;/h2&gt;

&lt;p&gt;iD is now available in English, Latvian, Turkish, Spanish, Japanese, German, and French!&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8085/8469221802_6475750bee_h.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;This is all thanks to people who graciously put in the time and energy to contribute translations: &lt;a href='https://github.com/nyampire'&gt;Satoshi&lt;/a&gt;, &lt;a href='https://github.com/tyrasd'&gt;Martin&lt;/a&gt;, &lt;a href='https://github.com/iperdomo'&gt;Iván&lt;/a&gt;, &lt;a href='https://github.com/chrismayer'&gt;Christian&lt;/a&gt;, &lt;a href='https://github.com/m0rix'&gt;m0rix&lt;/a&gt;, &lt;a href='https://github.com/LuisGC'&gt;LuisGC&lt;/a&gt;, Martins Brunenieks, &lt;a href='https://github.com/alperdincer'&gt;Alper&lt;/a&gt;, and others. Thanks!&lt;/p&gt;

&lt;p&gt;Want to help translate iD? &lt;a href='https://github.com/systemed/iD/tree/master/locale'&gt;We now have a translator&amp;#8217;s guide&lt;/a&gt; and a very simple system for handling translations.&lt;/p&gt;

&lt;h2 id='performance'&gt;Performance&lt;/h2&gt;

&lt;p&gt;We&amp;#8217;ve been constantly focused on making iD fast in every way possible, whether through smart architectural choices, like &lt;a href='http://mapbox.com/osmdev/2013/02/12/labeling-id/'&gt;Ansis&amp;#8217;s usage of RTrees for labeling&lt;/a&gt;, or &lt;a href='http://jsperf.com/id-dist-optimization'&gt;micro&lt;/a&gt; &lt;a href='http://jsperf.com/short-array-join'&gt;optimizations&lt;/a&gt; that ensure iD&amp;#8217;s &amp;#8216;hot&amp;#8217; functions are incredibly fast. We&amp;#8217;ve also started profiling iD in Firefox and paying attention to &lt;a href='http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/'&gt;reducing repaints and reflows&lt;/a&gt; wherever possible.&lt;/p&gt;

&lt;h2 id='design_improvements'&gt;Design Improvements&lt;/h2&gt;

&lt;p&gt;We&amp;#8217;ve tweaked road styles to make them more visible, consistent, and beautiful.&lt;/p&gt;

&lt;p&gt;The radial menu that was introduced in alpha1 is now a semi-circle so it stays out of the way of the mouse.&lt;/p&gt;

&lt;h2 id='multiple_selections'&gt;Multiple Selections&lt;/h2&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8093/8469221588_b4d5487eff_h.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;iD now supports selecting multiple features, so you can quickly remove many points or ways. Holding down shift, clicking, and dragging now produces a &amp;#8216;lasso&amp;#8217; tool for multiple selections that should be familiar to those who have used vector graphics editors like Illustrator.&lt;/p&gt;

&lt;p&gt;This also enabled us to add more operations to iD: you can select multiple items and merge them into one, or delete multiple things at once.&lt;/p&gt;

&lt;h2 id='regionspecific_layers'&gt;Region-Specific Layers&lt;/h2&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8375/8468126429_d98d997647_h.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;iD now provides region-specific layers that automatically update as you move the map to different locations. For instance, when editing in the US, you&amp;#8217;ll have access to &lt;a href='http://www.census.gov/geo/www/tiger/'&gt;US Census TIGER&lt;/a&gt; layers, but if you pan over to London, you can reference &lt;a href='https://www.ordnancesurvey.co.uk/oswebsite/opendata/'&gt;Ordinance Survey Open Data&lt;/a&gt; layers.&lt;/p&gt;

&lt;p&gt;This functionality is thanks to &lt;a href='http://wiki.openstreetmap.org/wiki/Potlatch_2'&gt;Potlatch 2&lt;/a&gt;&amp;#8217;s excellent layer resources, which we&amp;#8217;re converting to JSON and using in iD.&lt;/p&gt;

&lt;h2 id='usability_improvements'&gt;Usability Improvements&lt;/h2&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8238/8468126847_ae2225ab24_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;Some of the biggest changes to iD are very subtle usability improvements. You can now connect lines by dragging the end of one onto another - an incredibly useful tweak that addresses the common case in OSM data of data that is poorly connected.&lt;/p&gt;

&lt;p&gt;Dragging points and lines to the edges of the map causes the map to scroll, so you don&amp;#8217;t have to &amp;#8216;drop&amp;#8217; the point and scroll the map manually.&lt;/p&gt;

&lt;p&gt;Click events now have more tolerance so drawing lines is radically faster and less error-prone.&lt;/p&gt;

&lt;h2 id='recovering_changes'&gt;Recovering Changes&lt;/h2&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8089/8468126637_d28518afdd_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;Sometimes you can&amp;#8217;t finish your edits in one session and need to close the browser window. iD now uses localStorage to save intermediate work, and offers to recover changes when you load the page again.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Labeling in OpenStreetMap's iD Editor</title>
   <link href="http://mapbox.com/osmdev/2013/02/12/labeling-id"/>
   <updated>2013-02-12T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/02/12/labeling-id</id>
   <content type="html">&lt;p&gt;One of the key features in the &lt;a href='http://mapbox.com/osmdev/2013/01/29/alpha1/'&gt;alpha1 release&lt;/a&gt; of the &lt;a href='http://mapbox.com/blog/announcing-id/'&gt;iD&lt;/a&gt; map editor was its powerful support for labels. Labels are essential for orienting users and enabling them to find and fix misspellings and omissions. The technical challenge is to place labels quickly and avoid problems like overlapping text and visual clutter.&lt;/p&gt;

&lt;p&gt;The basic goal of labeling is identify important features while avoiding overlapping labels. Because iD is an editor for a dynamic dataset, it also needs to handle labels which are updated by the user, hide labels so they don&amp;#8217;t interfere with editing, and prioritize labeling features in the currently visible area. Traditional algorithms for automatic label placement use relatively complex simulated forces or &lt;a href='http://en.wikipedia.org/wiki/Simulated_annealing'&gt;annealing&lt;/a&gt; to find optimal label placements. In contrast, iD&amp;#8217;s approach is simple, but effective for its editing-centric use.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/labels/labels-riga.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;First, iD collects and sorts all points, lines, areas in order of importance, based on their tagged attributes. For each of these potentially labeled features, the algorithm calculates possible positions for the label, iterating through different options to avoid conflicts with previously placed labels. In this way, it&amp;#8217;s a fast &lt;a href='http://en.wikipedia.org/wiki/Greedy_algorithm'&gt;greedy algorithm&lt;/a&gt;, and does run into scenarios in which it can&amp;#8217;t place a label.&lt;/p&gt;

&lt;p&gt;The set of possible label positions that are calculated for a feature depends on its type. For lines, labels must be shorter than the line and within the visible area. Line labels are flipped if necessary to ensure they do not appear upside-down. Area labels are placed only when they fit in the area&amp;#8217;s bounding box. Point labels are currently simple: they&amp;#8217;re always placed to the right of the point.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/labels/labels-mountpleasant.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;The labels are rendered using SVG. Point and area labels use &lt;code&gt;text&lt;/code&gt; elements, whereas lines use &lt;code&gt;textPath&lt;/code&gt;. Each label has a &lt;code&gt;rect&lt;/code&gt; or &lt;code&gt;path&lt;/code&gt; halo placed behind it to make the text readable on top of imagery and features. Labels are rendered on top of all other map features.&lt;/p&gt;

&lt;p&gt;To keep editing fast and clear, labels are intelligently shown and hidden based on mouse position - so hovering near a road will fade out the label to reveal any hidden details.&lt;/p&gt;

&lt;p&gt;Because labels are updated with each redraw of the map, they need to be extremely fast. iD calculates label bounding boxes based on estimated text length, since it&amp;#8217;s slow to use browser-calculated bounds. We use &lt;a href='https://github.com/imbcmdth/RTree'&gt;RTree&lt;/a&gt; to optimize collision detection and proximity searches, a technique inspired by &lt;a href='https://github.com/kothic/kothic-js'&gt;kothic.js&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href='https://github.com/mourner'&gt;Vladimir&lt;/a&gt; and &lt;a href='https://github.com/RandomEtc'&gt;Tom&lt;/a&gt; for their suggestions.&lt;/p&gt;

&lt;p&gt;iD&amp;#8217;s labeling is robust and fast, but there&amp;#8217;s still more work to do: we have a &lt;a href='https://github.com/systemed/iD/issues?labels=labels&amp;amp;page=1&amp;amp;state=open'&gt;roadmap for further improvements&lt;/a&gt; that will be part of ongoing iD improvements.&lt;/p&gt;

&lt;p&gt;Try it for yourself and &lt;a href='http://ideditor.com'&gt;take iD for a spin&lt;/a&gt;! If you find an area with poor labeling, &lt;a href='https://github.com/systemed/iD/issues'&gt;please report it in an issue&lt;/a&gt;.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>iD alpha1</title>
   <link href="http://mapbox.com/osmdev/2013/01/29/alpha1"/>
   <updated>2013-01-29T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/01/29/alpha1</id>
   <content type="html">&lt;p&gt;Today iD reached a new level of stability with an alpha1 release.&lt;/p&gt;

&lt;p&gt;Since &lt;a href='http://mapbox.com/osmdev/2012/12/22/alpha0/'&gt;releasing iD alpha0&lt;/a&gt; in late December, we&amp;#8217;ve made over &lt;a href='https://github.com/systemed/iD/compare/v0.0.0alpha0...v0.0.0alpha1'&gt;500 commits to the project&lt;/a&gt;, including a redesign, many bugfixes, usability improvements, and features.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8083/8426420765_1e7e80b957_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;John, Ansis, Saman, and I have started to use iD on the production OSM system with real data, and started our first real new-user testing at the &lt;a href='http://www.openstreetmap.us/2013/01/522/'&gt;OpenStreetMap editathon at MapBox&lt;/a&gt;. We&amp;#8217;re confident that iD is reliable enough for real use, so you can now switch to editing &lt;a href='http://www.openstreetmap.org/'&gt;openstreetmap.org&lt;/a&gt; instead of &lt;a href='http://api06.dev.openstreetmap.org/'&gt;api06.dev.openstreetmap.org&lt;/a&gt; by clicking the &lt;code&gt;dev&lt;/code&gt; button in the bottom-right of the interface.&lt;/p&gt;

&lt;h2 id='labels'&gt;Labels&lt;/h2&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8351/8424470891_fe2f0e5715_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href='http://mapbox.com/about/team/#ansis-brammanis'&gt;Ansis&lt;/a&gt; wrote a sophisticated labeling system in iD, which makes it easier to identify unnamed and misnamed features and quickly orient yourself in new areas. It uses a &lt;a href='https://github.com/imbcmdth/RTree'&gt;fast RTree implementation&lt;/a&gt; and takes inspiration from &lt;a href='https://github.com/kothic/kothic-js'&gt;Kothic.js&lt;/a&gt; and other javascript-based renderers.&lt;/p&gt;

&lt;h2 id='performance'&gt;Performance&lt;/h2&gt;

&lt;p&gt;We&amp;#8217;re still pushing hard on performance - we improved the way that iD stores, updates, and searches its database, which is implemented as a &lt;a href='http://en.wikipedia.org/wiki/Persistent_data_structure'&gt;persistent data structure&lt;/a&gt;. Navigating the map is also faster thanks to increased usage of CSS transforms.&lt;/p&gt;

&lt;h2 id='multipolyons_and_relations'&gt;Multipolyons and Relations&lt;/h2&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8190/8424466795_f75f692256_h.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;John wrote a vastly improved system for relations and multipolygons in iD, which means that &lt;a href='http://wiki.openstreetmap.org/wiki/Relation:multipolygon'&gt;multipolygon relations&lt;/a&gt; are now displayed and edited correctly. This was one of the largest final issues towards iD editing real map data, especially data in cities with complex buildings and atriums.&lt;/p&gt;

&lt;h2 id='try_it_out'&gt;Try it Out&lt;/h2&gt;

&lt;p&gt;We need testers and input now more than ever. &lt;a href='http://geowiki.com/iD/#map=20.00/38.90085/-77.02271'&gt;The testing instance&lt;/a&gt; is now fixed to the alpha1 release, so try it out! Click &amp;#8216;dev&amp;#8217; in the bottom-right to switch to the official OpenStreetMap.org server and your own OSM account.&lt;/p&gt;

&lt;p&gt;&lt;a href='https://github.com/systemed/iD/issues?page=1&amp;amp;state=open'&gt;File tickets on GitHub for anything amiss&lt;/a&gt;, or ask us (&lt;code&gt;jfire&lt;/code&gt;, &lt;code&gt;tmcw&lt;/code&gt;, &lt;code&gt;ansis&lt;/code&gt;, and &lt;code&gt;samanbb&lt;/code&gt;) in the &lt;code&gt;#ideditor&lt;/code&gt; room on &lt;code&gt;irc.oftc.net&lt;/code&gt;. We&amp;#8217;d love to know what&amp;#8217;s confusing about iD and how we can improve it.&lt;/p&gt;

&lt;h2 id='on_to_alpha2'&gt;On to alpha2&lt;/h2&gt;

&lt;p&gt;This is just the beginning: some of the most interesting functionality in iD is still to come. Our big goals for an alpha2 release will be &lt;a href='https://github.com/systemed/iD/issues/164'&gt;presets support&lt;/a&gt;, &lt;a href='https://github.com/systemed/iD/issues/17'&gt;translations&lt;/a&gt;, and &lt;a href='https://github.com/systemed/iD/issues?labels=operations&amp;amp;page=1&amp;amp;state=open'&gt;operations&lt;/a&gt; for more advanced editing actions and tools.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Taginfo</title>
   <link href="http://mapbox.com/osmdev/2013/01/17/taginfo"/>
   <updated>2013-01-17T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/01/17/taginfo</id>
   <content type="html">&lt;p&gt;&lt;a href='http://taginfo.openstreetmap.org/'&gt;Taginfo&lt;/a&gt;, a project by &lt;a href='http://blog.jochentopf.com/'&gt;Jochen Topf&lt;/a&gt;, has been a huge element in making iD great for editing and learning about OpenStreetMap&amp;#8217;s tag system.&lt;/p&gt;

&lt;p&gt;Many of the most important features in iD are here because of the hard work of others in the community: the &lt;a href='http://wiki.openstreetmap.org/wiki/API'&gt;OSM API&lt;/a&gt;, OpenStreetMap US&amp;#8217;s &lt;a href='http://wiki.openstreetmap.org/wiki/TIGER_2012'&gt;TIGER 2012 layer&lt;/a&gt;, algorithms pioneered in &lt;a href='http://wiki.openstreetmap.org/wiki/Potlatch_2'&gt;Potlatch 2&lt;/a&gt; and &lt;a href='http://josm.openstreetmap.de/'&gt;JOSM&lt;/a&gt;, and much more.&lt;/p&gt;

&lt;p&gt;Taginfo is written in &lt;a href='https://github.com/joto/taginfo'&gt;a smart style&lt;/a&gt; - a C++ parser for &lt;a href='http://wiki.openstreetmap.org/wiki/Main_Page'&gt;wiki&lt;/a&gt; &amp;amp; &lt;a href='http://planet.openstreetmap.org/'&gt;OSM Planet&lt;/a&gt; using Jochen&amp;#8217;s own &lt;a href='https://github.com/joto/osmium'&gt;osmium&lt;/a&gt; framework, combined with a simple &lt;a href='http://www.sinatrarb.com/'&gt;sinatra&lt;/a&gt;-based web frontend. This means that it&amp;#8217;s fast in practice, and a service that we&amp;#8217;ve grown to rely on.&lt;/p&gt;

&lt;p&gt;The &lt;a href='http://taginfo.openstreetmap.org/taginfo/apidoc'&gt;Taginfo API&lt;/a&gt; is extensive: it even &lt;a href='http://taginfo.openstreetmap.org/taginfo/apidoc#api_4_key_distribution_ways'&gt;generates maps&lt;/a&gt; of worldwide tag usage, to find region-specific patterns. Here&amp;#8217;s a map of the distribution of the &lt;code&gt;highway=&lt;/code&gt; key.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8044/8380732653_619e80babc_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;We first started using Taginfo to power autocomplete functionality in iD: given a key, we can show popular values, and even filter through these values so that keys with many different values, like &lt;code&gt;name&lt;/code&gt;, don&amp;#8217;t have confusing autocomplete suggestions.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8465/8381826950_58e18ef493_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;To take this concept even further, we&amp;#8217;re using Taginfo&amp;#8217;s &lt;a href='http://taginfo.openstreetmap.org/taginfo/apidoc#api_4_tag_wiki_pages'&gt;wiki_pages&lt;/a&gt; API to bring in deeper documentation for specific tag combinations, informing users of particulars like whether a specific road type matches up with &lt;code&gt;highway=motorway_link&lt;/code&gt; or how to &lt;a href='http://wiki.openstreetmap.org/wiki/Cycleway'&gt;tag a cycleway&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8219/8380745725_4da2971df7_h.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;We&amp;#8217;re able to include images from wiki pages because of a &lt;a href='http://blog.jochentopf.com/2013-01-10-taginfo-news.html'&gt;new version of the API&lt;/a&gt; which Jochen kindly developed with iD in mind.&lt;/p&gt;

&lt;p&gt;Taginfo has been a great resource and enables iD to provide a critical improvement to conventional tagging interfaces: tags are still entered through an unlimited freeform, but more useful context around common choices is provided as guidance for both, new and experienced mappers.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>OAuth in Javascript</title>
   <link href="http://mapbox.com/osmdev/2013/01/15/oauth-in-javascript"/>
   <updated>2013-01-15T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/01/15/oauth-in-javascript</id>
   <content type="html">&lt;p&gt;With iD, you can securely log in to OpenStreetMap, make changes, and save them to the OpenStreetMap.org database. This is made possible by iD&amp;#8217;s implementation of the &lt;a href='http://oauth.net/'&gt;OAuth&lt;/a&gt; specification, a standard system for applications to authenticate and interact. We&amp;#8217;ve developed a &lt;a href='https://github.com/tmcw/ohauth'&gt;tiny library called ohauth&lt;/a&gt; which provides the basic components of the process, and includes a &lt;a href='http://pajhome.org.uk/crypt/md5/'&gt;trusted implementation of sha1&lt;/a&gt; written by Paul Johnston.&lt;/p&gt;

&lt;p&gt;iD is an unusual and interesting implementation of OAuth because it&amp;#8217;s a purely browser-based Javascript application: as opposed to conventional implementations, there&amp;#8217;s no server application in between it and the OSM API.&lt;/p&gt;

&lt;p&gt;To make this work, we needed to write much of the fundamental code for authenticating: while JOSM and Potlatch 2 use libraries for Java and Actionscript, respectively, and TileMill uses a node.js OAuth implementation, there&amp;#8217;s no established implementation for OAuth 1.0 in purely client-side applications. &lt;a href='http://oauth.net/2/'&gt;OAuth 2.0&lt;/a&gt; supports a simplified client-side flow and thus has a &lt;a href='https://github.com/andreassolberg/jso'&gt;well-written Javascript library&lt;/a&gt;, but is not supported on OpenStreetMap.org.&lt;/p&gt;

&lt;p&gt;The OpenStreetMap website is powered by a Ruby on Rails application called the &lt;a href='http://wiki.openstreetmap.org/wiki/Rails_Port'&gt;Rails Port&lt;/a&gt;, which luckily uses a well-tested &lt;a href='https://github.com/pelle/oauth-plugin'&gt;oauth-plugin&lt;/a&gt; for its side of the authentication exchange.&lt;/p&gt;

&lt;h2 id='cross_origin_resource_sharing'&gt;Cross Origin Resource Sharing&lt;/h2&gt;

&lt;p&gt;The biggest challenge for this implementation is the &lt;a href='http://en.wikipedia.org/wiki/Same_origin_policy'&gt;same origin policy&lt;/a&gt; that applies to browser Javascript which uses AJAX across domains. iD is built to be hostable anywhere, with implementations on &lt;a href='http://geowiki.com/iD/'&gt;geowiki.com&lt;/a&gt; and elsewhere, which can all access the OSM API. So we can&amp;#8217;t guarantee that requests for resources, like authentication calls, will be on the same domain.&lt;/p&gt;

&lt;p&gt;In the past, we&amp;#8217;ve used &lt;a href='http://en.wikipedia.org/wiki/JSONP'&gt;JSONP&lt;/a&gt; in this case: a hack that allows one to request &lt;a href='http://www.json.org/'&gt;JSON&lt;/a&gt; resources across domains. JSONP has many known flaws: &lt;a href='http://json-p.org/'&gt;potential security flaws&lt;/a&gt;, an inability to read and set headers, no support for methods other than GET, and the response body format is traditionally limited to JSON (though you can stringify XML in JSONP).&lt;/p&gt;

&lt;p&gt;Thus cross-domain OAuth can&amp;#8217;t be done with JSONP, and requires actual cross-domain requests with &lt;a href='http://en.wikipedia.org/wiki/Cross-origin_resource_sharing'&gt;CORS&lt;/a&gt;. Luckily, OpenStreetMap supports the standard, which provides a simple way to jump across the border.&lt;/p&gt;

&lt;p&gt;The downside is that &lt;a href='http://caniuse.com/cors'&gt;support for CORS in Internet Explorer&lt;/a&gt; is nearly non-existent: only in IE10 is it supported in standard form. iD does not support IE before version 10 at the moment (with a distant possibility of IE9 support in the future).&lt;/p&gt;

&lt;h2 id='javascript_implementations'&gt;Javascript Implementations&lt;/h2&gt;

&lt;p&gt;As mentioned, &lt;a href='http://oauth.net/code/'&gt;OAuth.org&lt;/a&gt; links to a &lt;a href='http://oauth.googlecode.com/svn/code/javascript/'&gt;javascript library&lt;/a&gt; for OAuth 1.&lt;/p&gt;

&lt;p&gt;That library unfortunately leaves much to be desired, both in terms of style and design, and isn&amp;#8217;t immediately usable in a project like iD. We do, however, use the same &lt;a href='http://pajhome.org.uk/crypt/md5/'&gt;implementation of SHA1&lt;/a&gt; by Paul Johnston.&lt;/p&gt;

&lt;p&gt;Thus iD uses a somewhat fixed-up SHA1 library and a &lt;a href='https://github.com/tmcw/ohauth'&gt;very simple library titled ohauth&lt;/a&gt;, which inherits most strategy from the official implementation. This basic functionality is then &lt;a href='https://github.com/systemed/iD/blob/master/js/iD/oauth.js'&gt;wrapped with UI elements and logic in iD&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id='the_authorize_step'&gt;The Authorize Step&lt;/h2&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8085/8379988173_d717f74497_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;Besides a range of AJAX requests, the OAuth specification requires a step in which users are directed towards the &amp;#8216;provider&amp;#8217; and choose what permissions they want to give iD. For instance, they can prevent iD from having the ability to view or edit their user profile.&lt;/p&gt;

&lt;p&gt;iD initially tried to redirect the entire page to OSM&amp;#8217;s &lt;code&gt;/oauth/authorize&lt;/code&gt; page, which required a cookie with the value of the request_token so that it can be reused for the &lt;code&gt;access_token&lt;/code&gt; step. This isn&amp;#8217;t just hackish, but it has a very bad failure case: if that request fails, the user is stranded on a broken page.&lt;/p&gt;

&lt;p&gt;The second technique is to use an &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; to do authorization. This works much better with the flow of authentication, but interacts poorly with browser security controls: Safari doesn&amp;#8217;t permit cookie access in iframes, and all browsers will complain about the necessary step of extracting the iframe&amp;#8217;s URL for OAuth: when the iframe is on &lt;code&gt;openstreetmap.org&lt;/code&gt; instead of &lt;code&gt;localhost:3000&lt;/code&gt; (or the other domain name/port of your testing page), trying to access its location is against your browser&amp;#8217;s rules.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='nx'&gt;iframe&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;onload&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;iframe&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;contentWindow&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;location&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;search&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Thus, iD now uses a popup window in order to execute the authorize step of OAuth. This has quite a few advantages: it works in Safari, users are able to easily see what site they&amp;#8217;re authenticating against, and bailing on the process is easy: they can simply close the window.&lt;/p&gt;

&lt;p&gt;However, this includes yet another wrinkle: the Javascript API for opening windows, &lt;a href='https://developer.mozilla.org/en-US/docs/DOM/window.open'&gt;&lt;code&gt;window.open&lt;/code&gt;&lt;/a&gt;, has been abused and overused by many advertising sites, so many browsers limit its use: the only reliable way to open a popup in WebKit-based browsers is to call &lt;code&gt;window.open&lt;/code&gt; within the scope of an event handler that is responding to a user interaction like a mouse click. This is a viable approach even if it&amp;#8217;s easy to lose that scope like shown in the example below.&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;onclick&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='nb'&gt;window&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;open&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;foo.html&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt; &lt;span class='c1'&gt;// this window will open&lt;/span&gt;
&lt;span class='p'&gt;};&lt;/span&gt;

&lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;onclick&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='nb'&gt;window&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;setTimeout&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='nb'&gt;window&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;open&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;foo.html&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt; &lt;span class='c1'&gt;// this window will not open&lt;/span&gt;
    &lt;span class='p'&gt;},&lt;/span&gt; &lt;span class='mi'&gt;100&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;span class='p'&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content>
 </entry>
 
 <entry>
   <title>Designing iD</title>
   <link href="http://mapbox.com/osmdev/2013/01/11/id-design"/>
   <updated>2013-01-11T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2013/01/11/id-design</id>
   <content type="html">&lt;p&gt;&lt;a href='http://mapbox.com/osmdev/2012/12/22/alpha0/'&gt;We launched the Alpha0 version of iD two weeks ago&lt;/a&gt;, and with it, came a host of design changes. At this point, the basics are in place and the project is in a good place to start further refinement.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s now a simple layout with a comprehensive icon set and consistent button styles. I tried to keep things clean and straightforward for now. We can refine things later where we need to:&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/design-notes/design-image-1.png' /&gt;&lt;/p&gt;

&lt;p&gt;We added custom cursors to make mouse interactions feel more intuitive:&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/design-notes/design-image-2.png' /&gt;&lt;/p&gt;

&lt;p&gt;We implemented tooltips for inline help:&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/design-notes/design-image-3.png' /&gt;&lt;/p&gt;

&lt;p&gt;Map features, which are rendered in SVG, have been refined. I tried to make sure the markers, nodes, and ways were big enough to easily click and modify, but not so intrusive as to obscure the map. We added special hover and active states to make it clear when an element is selected or can be interacted with:&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/design-notes/design-image-4.png' /&gt;&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s a consistent style for modals that we use when we need to provide the user with more information or when an action is required:&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/design-notes/design-image-5.png' /&gt;&lt;/p&gt;

&lt;p&gt;We approached the project collaboratively: I started with a full mock-up of the application:&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/design-notes/design-image-6.png' /&gt;&lt;/p&gt;

&lt;p&gt;Which allowed me to easily try ideas out before implementing them:&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://mapbox.com/osmdev/images/design-notes/design-image-7.png' /&gt;&lt;/p&gt;

&lt;p&gt;Once I had a concept down I was happy with, I &lt;a href='https://github.com/systemed/iD/issues?state=open'&gt;made issues in the issue tracker&lt;/a&gt;. &lt;a href='http://github.com/tmcw'&gt;Tom&lt;/a&gt;, &lt;a href='https://github.com/jfirebaugh'&gt;John&lt;/a&gt; and I would refine the concepts, then we&amp;#8217;d start on implementation. If the task was simple, like restyling buttons, I did most of the work myself. It took a while to get the hang of editing the DOM with d3.js, but now I can work with it more or less as though it&amp;#8217;s HTML.&lt;/p&gt;

&lt;h2 id='shortcomings_of_the_current_design_and_plans_for_the_future'&gt;Shortcomings of the current design and plans for the future&lt;/h2&gt;

&lt;p&gt;iD is a functioning editor, but it&amp;#8217;s far from finished.&lt;/p&gt;

&lt;p&gt;For starters, the layout isn&amp;#8217;t quite polished yet. Some parts of the site are flexible, others are fixed width. I&amp;#8217;d love to implement a more cohesive system so elements of the UI fit together on a stronger grid. Right now the footer links feel a little too tacked on, and the tag inspector needs to be more carefully positioned and needs to have its behavior refined.&lt;/p&gt;

&lt;p&gt;The built-in tag reference still has a long way to go before its as useful as it could be. &lt;a href='https://github.com/systemed/iD/issues/256'&gt;There&amp;#8217;s a issue on the topic open right now&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The SVG styles for map data are close, but still not complete. I&amp;#8217;d love to have more consistent styles for selection across buildings, areas, and streets.&lt;/p&gt;

&lt;p&gt;The most important &amp;amp; challenging design task that is yet to be tackled, is an easy to use preset interface for users who aren&amp;#8217;t familiar with OSM&amp;#8217;s tagging system. &lt;a href='https://github.com/systemed/iD/issues/164'&gt;Discussion on the topic has already begun&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Lastly, we need a better onboarding experience for new users. There are a few ways to approach this: Do we want to create a pop-based step-by-step walkthrough? A help page? Should we simply try to make the interface more intuitive and the existing tooltips stronger so we don&amp;#8217;t even need a walkthrough?&lt;/p&gt;

&lt;p&gt;Over the course of the next few weeks, I will be working together with other iD contributors to refine existing concepts, propose new ideas, and help make sure everything&amp;#8217;s implemented properly.&lt;/p&gt;

&lt;p&gt;Join the design conversation by creating issues or providing input &lt;a href='https://github.com/systemed/iD/issues'&gt;on the issue tracker&lt;/a&gt;. Or, if you&amp;#8217;re feeling ambitious, fork the project and start playing around with &lt;a href='https://github.com/systemed/iD/tree/master/img/source'&gt;the SVG source files&lt;/a&gt;! For questions you can always find me and other contributors on #ideditor on irc.oftc.net.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>iD Alpha0</title>
   <link href="http://mapbox.com/osmdev/2012/12/22/alpha0"/>
   <updated>2012-12-22T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2012/12/22/alpha0</id>
   <content type="html">&lt;p&gt;Today we&amp;#8217;re tagging the very first version of the iD editor for OpenStreetMap. It&amp;#8217;s come a very long way in the past few months since kicking off after &lt;a href='http://www.systemed.net/blog/index.php?post=24'&gt;Richard&amp;#8217;s talk at the State of the Map US conference&lt;/a&gt;: &lt;a href='http://mapbox.com/osmdev/2012/12/06/designing-a-better-osm-editor/'&gt;design improvements by Saman&lt;/a&gt;, &lt;a href='http://mapbox.com/osmdev/2012/12/06/testing-id/'&gt;testing infrastructure and core data strategy with John&lt;/a&gt;, and a lot more.&lt;/p&gt;

&lt;p&gt;It also has a long way to go, but we&amp;#8217;re going to shift development into feature &amp;amp; bug branches so that you can start tinkering with it and giving input.&lt;/p&gt;

&lt;p&gt;Here&amp;#8217;s a quick idea of what&amp;#8217;s there to try out:&lt;/p&gt;

&lt;h3 id='points_lines_areas_and_tags'&gt;Points, Lines, Areas, and Tags&lt;/h3&gt;

&lt;p&gt;iD now supports creating, modifying, and deleting all of the fundamental datatypes of OpenStreetMap: you can draw, tag, and increase the accuracy of roads, buildings, and places on the map.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8492/8294526421_c6079c4bdc_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;The tag editor takes advantage of &lt;a href='http://taginfo.openstreetmap.org/'&gt;Taginfo&lt;/a&gt; for inline autocomplete and documentation. Popular tag combinations are shown as you type.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8503/8294526589_6f118c9fdf_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;iD&amp;#8217;s background layer system already supports Bing, TIGER, OSM, and custom layers which use XYZ and quadtile schemes. You can dim layers to 50% opacity or turn off the background layer entirely.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8361/8295580278_b231b22816_h.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;iD shows you the usernames of local mappers so you can get in contact &amp;amp; ask about changes that you&amp;#8217;re making - the local community.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8501/8294526649_0755b4147f_b.jpg' /&gt;&lt;/p&gt;

&lt;h3 id='whats_to_come'&gt;What&amp;#8217;s to Come&lt;/h3&gt;

&lt;p&gt;There are still &lt;a href='https://github.com/systemed/iD/issues'&gt;many issues to fix and implement&lt;/a&gt;. Besides just bugs and visual tweaks, there are some major features that we&amp;#8217;ve yet to crack the surface on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A powerful, customizable set of presets which guide the editing process for typical features like buildings and roads&lt;/li&gt;

&lt;li&gt;Relations editing, including user-friendly tools for adding and fixing turn restrictions, so that applications like &lt;a href='http://project-osrm.org/'&gt;OSRM&lt;/a&gt; have a richer dataset&lt;/li&gt;

&lt;li&gt;A plugin system to allow for advanced features like those in &lt;a href='http://josm.openstreetmap.de/'&gt;JOSM&lt;/a&gt; without making iD itself unwieldy&lt;/li&gt;

&lt;li&gt;Full translatability to allow iD to be used in many native languages&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id='how_to_help'&gt;How to Help&lt;/h3&gt;

&lt;p&gt;&lt;a href='http://geowiki.com/iD/#?map=20.00/38.87952/-77.02405'&gt;Try editing with the testing instance!&lt;/a&gt;. We&amp;#8217;d love to have more help developing and testing iD.&lt;/p&gt;

&lt;p&gt;To &lt;strong&gt;help test&lt;/strong&gt;, edit the map, find bugs, and &lt;a href='https://github.com/systemed/iD/issues'&gt;report them on GitHub&lt;/a&gt; after searching for existing issues.&lt;/p&gt;

&lt;p&gt;To &lt;strong&gt;help code&lt;/strong&gt;, check out the issues and find one that sounds interesting. We idle in &lt;code&gt;#ideditor&lt;/code&gt; on &lt;code&gt;irc.oftc.net&lt;/code&gt; and would love to help out.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Javascript Browser Testing and Continuous Integration with iD</title>
   <link href="http://mapbox.com/osmdev/2012/12/06/testing-id"/>
   <updated>2012-12-06T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2012/12/06/testing-id</id>
   <content type="html">&lt;p&gt;&lt;em&gt;Guest blogger &lt;a href='https://github.com/jfirebaugh'&gt;John Firebaugh&lt;/a&gt; is an avid Ruby and Javascript developer, an OpenStreetMap mapper, and a contributor to the OpenStreetMap.org web site. He joined us for a sprint this week in the MapBox office in Washington DC where, among other things, he focused on testing.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It is extremely important that the &lt;a href='https://github.com/systemed/iD'&gt;iD editor&lt;/a&gt; is stable and tested: when deployed, it will be used to modify the singular &lt;a href='http://www.openstreetmap.org/'&gt;OpenStreetMap&lt;/a&gt; database. To ensure that iD&amp;#8217;s growth is accompanied by stability and reliability, we spent time this week refining the choice of tools we use for testing, improving test coverage, and setting up a continuous integration system. You can now &lt;a href='https://travis-ci.org/systemed/iD'&gt;check out iD&amp;#8217;s testing status at any time on Travis-CI&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Automated testing helps us improve iD&amp;#8217;s architecture and technical design (through &lt;a href='http://en.wikipedia.org/wiki/Test-driven_development'&gt;test-driven development&lt;/a&gt;) and reduces the chances of inadvertently breaking existing code as we add new features and fix bugs. In this post I&amp;#8217;ll outline our test infrastructure and explain how to test your iD instance when developing.&lt;/p&gt;

&lt;h2 id='testing_tools'&gt;Testing Tools&lt;/h2&gt;

&lt;p&gt;iD runs in a browser, as client-side Javascript that relies on a DOM. We&amp;#8217;re using a combination of testing tools that allow us to test both interactively in a number of browsers, and automatically, whenever a change is submitted to the repository.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8487/8250568844_51ed102a6c_b.jpg' /&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href='http://visionmedia.github.com/mocha/'&gt;Mocha&lt;/a&gt; provides the framework for defining tests, grouping them logically into suites, and running them. We use it in the style of &lt;a href='http://en.wikipedia.org/wiki/Behavior-driven_development'&gt;behavior-driven development&lt;/a&gt;, whose main constructs are &lt;code&gt;describe&lt;/code&gt;, to group a set of related test specifications, and &lt;code&gt;it&lt;/code&gt;, to specify a facet of behavior. We use a top-level &lt;code&gt;describe&lt;/code&gt; to name the module under test, second-level &lt;code&gt;describe&lt;/code&gt;s for each of its methods, and as many &lt;code&gt;it&lt;/code&gt;s as are necessary to fully specify each method&amp;#8217;s behavior. For a good example, have a look at the tests for &lt;a href='https://github.com/systemed/iD/blob/master/test/spec/graph/entity.js'&gt;iD.Entity&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='http://chaijs.com/'&gt;Chai&lt;/a&gt; provides the language for test assertions, with which we declare exactly how we expect the modules and functions that make up iD to behave. For instance, with chai&amp;#8217;s assertions we can say that we &lt;a href='https://github.com/systemed/iD/blob/433dced53d896a4e0b162b35cfffd4b6bb687438/test/spec/graph/entity.js#L85'&gt;&lt;code&gt;expect(iD.Node({tags: {foo: &amp;#39;bar&amp;#39;}}).tags).to.eql({foo: &amp;#39;bar&amp;#39;})&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;p&gt;&lt;a href='http://sinonjs.org/'&gt;Sinon&lt;/a&gt; provides test spies, &lt;a href='http://en.wikipedia.org/wiki/Test_stub'&gt;stubs&lt;/a&gt;, and &lt;a href='http://en.wikipedia.org/wiki/Mock_object'&gt;mocks&lt;/a&gt;. Some parts of iD lend themselves to being tested in isolation, some parts require that their direct collaborators be mocked or stubbed, and some are best integration tested, with only the connection to the &lt;a href='http://wiki.openstreetmap.org/wiki/API'&gt;OSM API&lt;/a&gt; stubbed out. In all of these scenarios, we can take advantage of the test doubles provided by Sinon (even in isolation testing, spies are handy for verifying that callbacks are triggered at appropriate times). And with &lt;a href='http://chaijs.com/plugins/sinon-chai'&gt;sinon-chai&lt;/a&gt;, they are all nicely integrated with chai&amp;#8217;s assertion language.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id='all_together'&gt;All Together&lt;/h2&gt;

&lt;p&gt;Here&amp;#8217;s how we confirm that the &lt;code&gt;DeleteNode&lt;/code&gt; action actually removes a node from iD&amp;#8217;s graph database:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='c1'&gt;// The group of tests&lt;/span&gt;
&lt;span class='nx'&gt;describe&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;iD.actions.DeleteNode&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt; &lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='c1'&gt;// A specific desired behavior&lt;/span&gt;
    &lt;span class='nx'&gt;it&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s2'&gt;&amp;quot;removes the node from the graph&amp;quot;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='kd'&gt;function&lt;/span&gt; &lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;node&lt;/span&gt;   &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Node&lt;/span&gt;&lt;span class='p'&gt;(),&lt;/span&gt;
            &lt;span class='nx'&gt;action&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;actions&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;DeleteNode&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;node&lt;/span&gt;&lt;span class='p'&gt;),&lt;/span&gt;
            &lt;span class='nx'&gt;graph&lt;/span&gt;  &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;action&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;iD&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;Graph&lt;/span&gt;&lt;span class='p'&gt;([&lt;/span&gt;&lt;span class='nx'&gt;node&lt;/span&gt;&lt;span class='p'&gt;]));&lt;/span&gt;
        &lt;span class='c1'&gt;// The assertion: if graph.entity(node.id) is defined,&lt;/span&gt;
        &lt;span class='c1'&gt;// a test failure is reported&lt;/span&gt;
        &lt;span class='nx'&gt;expect&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;graph&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;entity&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;node&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;id&lt;/span&gt;&lt;span class='p'&gt;)).&lt;/span&gt;&lt;span class='nx'&gt;to&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;be&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='kc'&gt;undefined&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
    &lt;span class='p'&gt;});&lt;/span&gt;
&lt;span class='p'&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;iD tests run within the browser, so we can easily open different browsers and confirm there are no platform-specific bugs. In-browser testing also makes it possible to use Chrome&amp;#8217;s &lt;a href='https://developers.google.com/chrome-developer-tools/docs/overview'&gt;Web Developer tools&lt;/a&gt; to pinpoint the cause of a failure.&lt;/p&gt;

&lt;h2 id='testing_your_changes'&gt;Testing Your Changes&lt;/h2&gt;

&lt;p&gt;How do you run the tests locally, after making a change to the code? It&amp;#8217;s easy: just open your repository&amp;#8217;s copy of &lt;a href='https://github.com/systemed/iD/blob/master/test/index.html'&gt;test/index.html&lt;/a&gt; in a browser. This file includes each of the individual script files that comprise iD, so rerunning the tests after a change is as simple as refreshing the page.&lt;/p&gt;

&lt;p&gt;A companion file, &lt;code&gt;index_packaged.html&lt;/code&gt;, tests the concatenated and minified iD.min.js package. It catches some problems that &lt;code&gt;index.html&lt;/code&gt; doesn&amp;#8217;t, but it requires running &lt;code&gt;make&lt;/code&gt; after any change.&lt;/p&gt;

&lt;p&gt;We encourage you to run the tests before submitting a pull request, and to add tests for any changes or additions you make.&lt;/p&gt;

&lt;h2 id='continuous_integration'&gt;Continuous Integration&lt;/h2&gt;

&lt;p&gt;To ensure that the tests pass after every commit, we rely on &lt;a href='https://travis-ci.org/'&gt;Travis CI&lt;/a&gt;, an &lt;a href='https://github.com/travis-ci'&gt;open source&lt;/a&gt;, &lt;a href='https://love.travis-ci.org/sponsors'&gt;sponsor-supported&lt;/a&gt; project that provides free continuous-integration testing for projects on &lt;a href='https://github.com/'&gt;GitHub&lt;/a&gt;. When a change is pushed to GitHub, Travis is notified via &lt;a href='https://help.github.com/articles/post-receive-hooks'&gt;post-receive hook&lt;/a&gt; and runs and reports tests, emailing the maintainers on test failures.&lt;/p&gt;

&lt;p&gt;The tests run in-browser, so how do they run automatically? We use &lt;a href='http://phantomjs.org/'&gt;phantomjs&lt;/a&gt;, a headless &lt;a href='http://www.webkit.org/'&gt;WebKit&lt;/a&gt; runner, which integrates with Mocha via &lt;a href='http://metaskills.net/mocha-phantomjs/'&gt;mocha-phantomjs&lt;/a&gt; providing a console-driven test runner and reporter. Luckily, travis-ci has phantomjs installed by default, so it runs perfectly on their servers.&lt;/p&gt;

&lt;h2 id='lets_build_and_test'&gt;Let&amp;#8217;s Build (and Test)&lt;/h2&gt;

&lt;p&gt;The second ingredient for our testing is people - &lt;a href='http://geowiki.com/iD'&gt;try it out&lt;/a&gt; and &lt;a href='https://github.com/systemed/iD/issues'&gt;report issues and bugs&lt;/a&gt;! Combining continuous integration testing with reporting and management of bugs will make iD a rock-solid editor for &lt;a href='http://www.openstreetmap.org/'&gt;OpenStreetMap&lt;/a&gt;.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Designing a New OpenStreetMap Editor</title>
   <link href="http://mapbox.com/osmdev/2012/12/06/designing-a-better-osm-editor"/>
   <updated>2012-12-06T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2012/12/06/designing-a-better-osm-editor</id>
   <content type="html">&lt;p&gt;&lt;img alt='Lead image' src='http://cl.ly/image/310z1k1h3f47/id-editor-graphic.png' /&gt;&lt;/p&gt;

&lt;p&gt;Richard Fairhurst &lt;a href='http://www.systemed.net/blog/index.php?post=24'&gt;set forth this vision for iD, a new OpenStreetMap editor, in a blog post a few months ago&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The principle for admittance to OSM should be “I know stuff that can go on this map”, not “I’m good at using an OSM editor”. The more local knowledge that can be added to OSM, the better the map is.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;He proposed a redesigned editor that is modal, seamless, and fast - well suited for both beginners and experienced users. Now &lt;a href='http://mapbox.com/osmdev/2012/10/23/welcome/'&gt;working on the iD project with redoubled efforts&lt;/a&gt; with funding from the Knight Foundation this continues to be our goal.&lt;/p&gt;

&lt;p&gt;At this point, much of the basic editing functionality is in place. Still, no actual designer has been involved, and no thorough review of UI details has taken place. The visual design needs work, but that&amp;#8217;s the easy part: Icons, button styles, layout details, those things will fall into place. The hard part is laying the groundwork, creating the paradigms for an intuitive, yet powerful user interface.&lt;/p&gt;

&lt;p&gt;Some of the challenging questions include: How do we improve the first time experience for new users? How do we progressively expose more complexity while keeping the tool easy to use? How do we balance map legibility with showing as much data as possible? Should map panning and zooming use standard conventions, or should clicking, double-clicking, and the scroll-wheel be reserved for editing mechanics? What should the user flow look like for adding new nodes? These are some of the harder questions that I hope to be able to make informed decisions about as I get deeper into the design process.&lt;/p&gt;

&lt;p&gt;Many of these design problems are being &lt;a href='https://github.com/systemed/iD/issues?state=open'&gt;tracked &amp;amp; discussed right now on iD&amp;#8217;s GitHub project&lt;/a&gt; and I welcome additional input. Designing iD will be an iterative process, and if the first take on a feature of user flow isn&amp;#8217;t quite right we should make sure to revisit it.&lt;/p&gt;

&lt;h2 id='a_first_review_of_existing_editors_and_literature'&gt;A first review of existing editors and literature&lt;/h2&gt;

&lt;p&gt;Right now, I am just starting to work on the iD user interface directly, with mock-ups and commits. Before I got my hands dirty with design work, I researched existing literature and experimented with other map editors out there. Here is a short list of the most interesting editors and posts I&amp;#8217;ve taken a look at. My notes here reflect less the full result of my reviews but more a quick listing of what I&amp;#8217;m aware of in this space. If you have any additional pointers in this field for me, I would love to hear about them.&lt;/p&gt;

&lt;h3 id='potlatch_2'&gt;&lt;a href='http://www.openstreetmap.org/edit?editor=potlatch2'&gt;Potlatch 2&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img alt='Drawing lines' src='http://cl.ly/image/2m3X1j22313D/blog-graphics-potlatch.png' /&gt;&lt;/p&gt;

&lt;p&gt;Potlatch 2 is the go-to editor for in-browser editing on OpenStreetMap.org. One of the best parts of Potlatch is the attention put into keybindings. This makes Potlatch the fastest web-based editor for experienced users. As a designer who spent a lot of time with Inkscape and Illustrator, I can quickly make, connect, and manipulate paths, without constantly searching around for which buttons I need to click or moving through slow step-by-step walkthroughs. Because Potlatch supports the entire spectrum of data manipulations on OSM, it&amp;#8217;s more flexible and complex than comparable editors from other organizations.&lt;/p&gt;

&lt;h3 id='josm'&gt;&lt;a href='http://www.openstreetmap.org/edit?editor=potlatch2'&gt;JOSM&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img alt='key/value' src='http://cl.ly/image/2k1c140l2M2f/JOSM.png' /&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href='http://josm.openstreetmap.de/'&gt;Java OpenStreetMap editor (JOSM)&lt;/a&gt; is a desktop application and the most popular editor in OSM. JOSM can do more and is faster than any of the other editors on this list, but it has a steeper learning curve. It allows users direct access to the data model and doesn&amp;#8217;t force users to use defaults. This is the editor that you can use to map the world from scratch.&lt;/p&gt;

&lt;p&gt;OSM is open to describing any geographic feature in the world and its data structure is developed in an organic, community driven process. Hence editors for OSM need to provide a large degree of freedom. JOSM, Potlatch and also iD need to be designed with that kind of flexibility in mind. This is different from the editors I reviewed next like Waze, or the heavily moderated Google MapMaker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;note: In the original version of this blogpost I innacurately said JOSM has &amp;#8220;no abstraction&amp;#8221;, when in truth users can use presets and bypass the free tagging interface if they&amp;#8217;d like to.&lt;/strong&gt;&lt;/p&gt;

&lt;h3 id='waze_editor'&gt;&lt;a href='https://www.waze.com/editor/'&gt;Waze editor&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img alt='Direct manipulation' src='http://cl.ly/image/0p0T3j1C2w3Z/blog-graphics-waze.png' /&gt;&lt;/p&gt;

&lt;p&gt;Of all the existing editors, the waze map editor impressed me most. It has the advantage of serving a more niche purpose: it&amp;#8217;s an editor for a map for car navigation, so a lot of the complexity of an OSM editor can instantly be dropped. Another interesting design decision is the turn restriction UI: It allows for a kind of direct manipulation by clicking icons that would be reserved for sidebars and menus in other editors. Very intuitive and easy to use.&lt;/p&gt;

&lt;h3 id='google_map_maker'&gt;&lt;a href='http://www.google.com/mapmaker'&gt;Google Map Maker&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img alt='Steps' src='http://cl.ly/image/3S0Z120q3A11/blog-graphics-google.png' /&gt;&lt;/p&gt;

&lt;p&gt;Google MapMaker has one goal in mind: accessibility. The whole tool is designed to encourage someone new to start making a change and commit it. Some ways it accomplishes this goal is through its edit-first, sign-in-later approach. Adding ways and nodes is a guided experience, with many small steps, with one choice to make at each step, so on the first run users know what to do.&lt;/p&gt;

&lt;h3 id='nokias_here_map_creator'&gt;&lt;a href='http://here.net/mapcreator'&gt;Nokia&amp;#8217;s Here Map Creator&lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;img alt='details panel' src='http://cl.ly/image/0b1h1j372Y37/blog-graphics-here2.png' /&gt;&lt;/p&gt;

&lt;p&gt;I like the way the details panel is hidden, it appears only when you it needs to be filled out. This intuitively pulls users through the process of adding to the map. I know when I should be focusing on manipulating things on the map, and when I should be describing the things I&amp;#8217;ve added to the map. The UI also gradually introduces complexity with expandable menus. Even upon expansion, the choices are clear and the UI is attractive.&lt;/p&gt;

&lt;p&gt;&lt;img alt='right click menu' src='http://cl.ly/image/0N051d1Y3k0S/blog-graphics-here.png' /&gt;&lt;/p&gt;

&lt;p&gt;This is the only editor that takes control of the right click menu. I don&amp;#8217;t know if this is the right approach for iD, but it does make it easy to quickly add new nodes and ways. Good keyboard shortcuts can accomplish the same thing.&lt;/p&gt;

&lt;h3 id='reading_list'&gt;Reading List&lt;/h3&gt;

&lt;p&gt;This list covers some of the reading I&amp;#8217;ve done to get up to speed on iD. If you&amp;#8217;re interested in the project, you might find these resources helpful.&lt;/p&gt;

&lt;p&gt;&lt;a href='https://github.com/systemed/iD/blob/master/NOTES.md'&gt;iD project Notes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the document &lt;a href='https://github.com/tmcw'&gt;Tom&lt;/a&gt; and &lt;a href='https://github.com/jfirebaugh'&gt;John&lt;/a&gt; put together to outline iD&amp;#8217;s design &amp;amp; development philosophy.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://blog.cloudmade.com/category/mapzen/'&gt;CloudMade blogposts about Mapzen&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This link should almost go in the editors section, because it&amp;#8217;s about Mapzen, an editor CloudMade began developing a couple years ago. Unfortunately, the mapzen project is no longer actively maintained, and it&amp;#8217;s completely offline. Still, a few years ago this was an exciting and promising effort and the developers did a great job of blogging their work. Some interesting features of Mapzen included very tight integration between the editor and a social platform, and deliberate design of the editable data overlays in the editor.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://www.systemed.net/blog/index.php?post=24'&gt;It all starts with an editor – the blog edit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is Richard&amp;#8217;s blog post that I quote above. It&amp;#8217;s the starting point for much of the ongoing iD work.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://wiki.openstreetmap.org/wiki/Potlatch_2/Primer'&gt;OSM wiki page for Potlatch 2&lt;/a&gt;, &lt;a href='http://wiki.openstreetmap.org/wiki/Good_practice'&gt;OSM wiki page for good practices in contributing to the map&lt;/a&gt; and &lt;a href='http://wiki.openstreetmap.org/wiki/Editing_Standards_and_Conventions'&gt;OSM wiki page for editing standards and conventions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These Wiki pages are essential reading. It&amp;#8217;s hard to design an editor when you don&amp;#8217;t understand what the results need to look like.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Correction: A previous version of the post suggested that JOSM does not abstract the data model and doesn&amp;#8217;t provide a lot of defaults while presets cover actually a large portion of OSM tag configurations.&lt;/em&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Design Improvements to OpenStreetMap.org</title>
   <link href="http://mapbox.com/osmdev/2012/11/21/design-improvements-to-openstreetmaporg"/>
   <updated>2012-11-21T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2012/11/21/design-improvements-to-openstreetmaporg</id>
   <content type="html">&lt;p&gt;Part of our &lt;a href='http://mapbox.com/blog/knight-invests-openstreetmap/'&gt;Knight funded work on OpenStreetMap&lt;/a&gt; aims to improve the social experience for mappers. While concrete goals in this realm remain to be fleshed out as we &lt;a href='http://mapbox.com/osmdev/2012/10/23/welcome/'&gt;focus on editor work&lt;/a&gt;, we know that UI improvements to OpenStreetMap.org will be essential.&lt;/p&gt;

&lt;p&gt;To get started, I recently wrapped up a round of design and markup clean-ups to OpenStreetMap.org. This work is available as &lt;a href='https://github.com/openstreetmap/openstreetmap-website/pull/150'&gt;a ready-to-merge pull request to the openstreetmap-website project&lt;/a&gt; and is pending a final review. At the end of this post you will find a series of screenshots showing current progress.&lt;/p&gt;

&lt;p&gt;This first batch of improvements is fairly straightforward. Before introducing new features or UI concepts, I decided to start by making a concrete impact through fixing existing problems, modernizing outdated markup, and nudging the site towards better typography, hierarchy, and user-friendliness one step at a time. As a designer starting to work with the OpenStreetMap.org web site I see these improvements as an important step towards understanding the &lt;a href='https://github.com/openstreetmap/openstreetmap-website/'&gt;code base&lt;/a&gt; and the OpenStreetMap community so I can make informed suggestions and participate in more profound improvements to the project in the coming months.&lt;/p&gt;

&lt;p&gt;Concrete improvements include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A clearer, more harmonious typgraphic scale.&lt;/li&gt;

&lt;li&gt;A persistent header and subnav pattern across most pages on the website.&lt;/li&gt;

&lt;li&gt;Table-based layouts on the user profile page, the changelist page, the data browser pages, and elsewhere have been replaced with modern HTML markup.&lt;/li&gt;

&lt;li&gt;A number of utility classes, like &lt;code&gt;button&lt;/code&gt; and a series of &lt;code&gt;padding&lt;/code&gt; classes reduce CSS repetition &amp;amp; make it easier to style new content or features if they get added in the future.&lt;/li&gt;

&lt;li&gt;Link lists are now properly marked up as &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; elements.&lt;/li&gt;

&lt;li&gt;Most of the icons on the site have been replaced with cleaner, clearer, more consistent alternatives.&lt;/li&gt;

&lt;li&gt;A standard pattern of 20px &amp;amp; 10px padding and margins has been introduced, improving the rhythm of the pages and giving the content some much-needed breathing room.&lt;/li&gt;

&lt;li&gt;Many smaller, more insignificant fixes that I ran across in the process of tackling some of the larger goals.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the most important reasons for modernizing the site with more semantic markup and reusable classes is to give more flexibility to myself or other designers for styling and arranging content in the future. For example, there was no way to create the visual separation between the header and the body of the content area before I introduced separate &lt;code&gt;header&lt;/code&gt; and &lt;code&gt;content&lt;/code&gt; divs to every page, and now that those divs are in place and consistent, it&amp;#8217;s easy to make large scale changes to layout and heirachy by adjusting those container classes.&lt;/p&gt;

&lt;h2 id='next_steps'&gt;Next Steps&lt;/h2&gt;

&lt;p&gt;First and foremost, the next thing I plan to do is work with Tom Hughes and other maintainers of the OpenStreetMap web site to make sure this work can be merged in safely, with all the kinks fixed.&lt;/p&gt;

&lt;p&gt;After that, with some of the more interdependent fixes complete, I will be able to approach remaining tasks one at a time. The rest of the incremental improvements on my todo list include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A more inviting signup page&lt;/li&gt;

&lt;li&gt;Better styling for markers and popups. I am waiting on the port of the OpenLayers maps to Leaflet before I dig into this.&lt;/li&gt;

&lt;li&gt;Revamped button styles across the site&lt;/li&gt;

&lt;li&gt;Replace table layouts with more semantic markup for all forms.&lt;/li&gt;

&lt;li&gt;Better 404 page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While working on the rest of these small changes, I&amp;#8217;ll start to spend time concepting a broader vision for the OSM project. Expect to hear more from me soon with details.&lt;/p&gt;

&lt;p&gt;For now, have a look at the screen shots below or the &lt;a href='https://github.com/openstreetmap/openstreetmap-website/pull/150'&gt;pull request&lt;/a&gt; to see what has been accomplished so far.&lt;/p&gt;

&lt;h2 id='screenshots'&gt;Screenshots&lt;/h2&gt;

&lt;p&gt;Here are some screenshots showing my progress so far. Hover over the images to see the old version, or click for a full size image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Home page:&lt;/strong&gt; &lt;a href='/osmdev/images/osm-updates/home-new.png'&gt;
&lt;img rel='/osmdev/images/osm-updates/home-old.png' src='/osmdev/images/osm-updates/home-new.png' class='rollover-image blog-image' /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Changeset page:&lt;/strong&gt; &lt;a href='/osmdev/images/osm-updates/changeset-new.png'&gt;
&lt;img rel='/osmdev/images/osm-updates/changeset-old.png' src='/osmdev/images/osm-updates/changeset-new.png' class='rollover-image blog-image' /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User page:&lt;/strong&gt; &lt;a href='/osmdev/images/osm-updates/user-new.png'&gt;
&lt;img rel='/osmdev/images/osm-updates/user-old.png' src='/osmdev/images/osm-updates/user-new.png' class='rollover-image blog-image' /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Diary page:&lt;/strong&gt; &lt;a href='/osmdev/images/osm-updates/diary-new.png'&gt;
&lt;img rel='/osmdev/images/osm-updates/diary-old.png' src='/osmdev/images/osm-updates/diary-new.png' class='rollover-image blog-image' /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data browser panel:&lt;/strong&gt; &lt;a href='/osmdev/images/osm-updates/browser-new.png'&gt;
&lt;img rel='/osmdev/images/osm-updates/browser-old.png' src='/osmdev/images/osm-updates/browser-new.png' class='rollover-image blog-image' /&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key panel:&lt;/strong&gt; &lt;a href='/osmdev/images/osm-updates/key-new.png'&gt;
&lt;img rel='/osmdev/images/osm-updates/key-old.png' src='/osmdev/images/osm-updates/key-new.png' class='rollover-image blog-image' /&gt;
&lt;/a&gt;&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Getting serious about SVG</title>
   <link href="http://mapbox.com/osmdev/2012/11/20/getting-serious-about-svg"/>
   <updated>2012-11-20T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2012/11/20/getting-serious-about-svg</id>
   <content type="html">&lt;p&gt;&lt;a href='https://github.com/systemed/iD'&gt;iD&lt;/a&gt; depends on SVG for drawing map features, displaying tiles, and a model upon which to build complex interactions.&lt;/p&gt;

&lt;p&gt;In the process of building it, we&amp;#8217;ve learned a lot about SVG&amp;#8217;s performance equation - and it&amp;#8217;s time to share some of this. A lot of this is taken from &lt;a href='https://github.com/systemed/iD/blob/master/NOTES.md'&gt;NOTES.md&lt;/a&gt;, a sort of developer-journal which has grown over the last few weeks.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;note that the examples in this post are designed to run around ~30fps in Google Chrome on a fast computer. They&amp;#8217;re made to push the limits, so may crash slower browsers on slower machines.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id='first_steps_with_svg'&gt;First Steps with SVG&lt;/h2&gt;

&lt;p&gt;We&amp;#8217;re generally using &lt;a href='http://d3js.org/'&gt;d3&lt;/a&gt; for graphics in iD. It&amp;#8217;s a very, very light abstraction layer over SVG - it eliminates the need for manual namespacing, gives a jQuery-like chainable &lt;code&gt;attr&lt;/code&gt; setter, and so on.&lt;/p&gt;

&lt;p&gt;SVG elements are elements on-page just like HTML elements, with a few differences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There&amp;#8217;s no &lt;code&gt;z-index&lt;/code&gt; - order in-page is the rendering model&lt;/li&gt;

&lt;li&gt;SVG has its own &lt;code&gt;transform&lt;/code&gt; property, which is different and has difference performance implications than CSS&amp;#8217;s &lt;code&gt;transform&lt;/code&gt; property.&lt;/li&gt;

&lt;li&gt;Many CSS styles work with SVG elements, but many do not. Some things we&amp;#8217;d think of as styling variables, like the radii of circles, are actually expressed as attributes rather than style rules.&lt;/li&gt;

&lt;li&gt;SVG has a powerful and possibly awful system of doing inter-references: a &lt;code&gt;&amp;lt;defs&amp;gt;&lt;/code&gt; element for definitions which are used by other elements by &lt;code&gt;xlink:ref&lt;/code&gt; attributes. For instance, you need to define a &lt;code&gt;&amp;lt;path&amp;gt;&lt;/code&gt; in &lt;code&gt;&amp;lt;defs&amp;gt;&lt;/code&gt; in order to reference it from a &lt;code&gt;textPath&lt;/code&gt; element in your main drawing canvas if you wish to draw text on a path.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id='principles'&gt;Principles&lt;/h2&gt;

&lt;p&gt;There are a few basic goals of any performance tuning task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href='http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/'&gt;Reducing repaints &amp;amp; reflows&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Triggering code paths that your browser can optimize, like using &lt;a href='http://seb.ly/2011/02/html5-canvas-sprite-optimisation/'&gt;rounded pixels in Canvas&lt;/a&gt; or using specific forms of functions to avoid &lt;a href='http://floitsch.blogspot.com/2012/03/optimizing-for-v8-inlining.html'&gt;V8 deoptimization&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id='svgs_special_moves_g_and_defs'&gt;SVG&amp;#8217;s special moves: g and defs&lt;/h2&gt;

&lt;p&gt;The basic structure of the map canvas for iD is as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;div (supersurface)
  svg (surface)
    defs
      rect#clip
      path (textPath data)
    g (tilegroup)
    r (vector root)
      g (fill, casing, stroke, text, hit, temp)
        (path, g, marker, etc)&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Besides just having more shapes, SVG has different concepts - one is the &lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt; element, that represents a group. The groups can be very useful, since they can be transformed with the &lt;code&gt;transform&lt;/code&gt; attribute: for instance, markers are set up like&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='html'&gt;&lt;span class='nt'&gt;&amp;lt;g&lt;/span&gt; &lt;span class='na'&gt;transform=&lt;/span&gt;&lt;span class='s'&gt;&amp;#39;translate(10, 20)&amp;#39;&lt;/span&gt;&lt;span class='nt'&gt;&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;image&lt;/span&gt; &lt;span class='nt'&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class='nt'&gt;&amp;lt;circle&lt;/span&gt; &lt;span class='nt'&gt;/&amp;gt;&lt;/span&gt;
&lt;span class='nt'&gt;&amp;lt;/g&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;SVG&amp;#8217;s &lt;a href='http://www.svgbasics.com/defs.html'&gt;defs&lt;/a&gt; element is another oddball: it defines content that doesn&amp;#8217;t show up on screen, but can be used via reference: I&amp;#8217;ll mention this later on with &lt;code&gt;textPath&lt;/code&gt; as a example. But another usage of defs for this project is making a &lt;code&gt;rect&lt;/code&gt; element which is used to clip the vector and tile layers.&lt;/p&gt;

&lt;h2 id='css_transforms_are_a_big_boost__sometimes'&gt;CSS Transforms are a big boost - sometimes.&lt;/h2&gt;

&lt;p&gt;For panning the map, transforms seemed to be the main solution - they allow simple pan behaviors to be carried out on a single element, and in a way that doesn&amp;#8217;t require a browser to recalculate individual element positions.&lt;/p&gt;

&lt;p&gt;However, early results were not encouraging - CSS transforms, even of the &amp;#8216;hardware accelerated&amp;#8217; 3D variety - are not accelerated in Google Chrome &lt;em&gt;when used with SVG elements&lt;/em&gt; - they have the same performance profile as SVG attribute transforms.&lt;/p&gt;

&lt;p&gt;The answer is to transform HTML elements, which does trigger fast code in Google Chrome. In iD we do this by transforming a &amp;#8216;surface&amp;#8217; element (the SVG parent) of the map instead of the group (&lt;code&gt;&amp;lt;g&amp;gt;&lt;/code&gt;) elements that make up the tile surface and vector surface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href='http://bl.ocks.org/4075560'&gt;CSS transforms on an SVG element with many contained elements&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href='http://bl.ocks.org/4131834'&gt;CSS 3d transforms on an HTML element with many contained elements&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(update: these now compensate for different vendor prefixes for the &lt;code&gt;transform&lt;/code&gt; CSS property)&lt;/p&gt;

&lt;h2 id='rounded_pixels_give_a_boost'&gt;Rounded pixels give a boost&lt;/h2&gt;

&lt;p&gt;&lt;a href='https://github.com/mourner'&gt;Vladimir&lt;/a&gt; brought up this one and I didn&amp;#8217;t expect it to be a significant bump, since SVG is vectorized, I assumed that it wouldn&amp;#8217;t have raster-pixel bumps like Canvas does. However, it is a boost, and not just because of the shorter string length of &lt;code&gt;d&lt;/code&gt; attributes - rounding and outputting long fixed-point numbers is also faster than non-rounded values. This is about a 20% improvement in testing.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href='http://bl.ocks.org/4081369'&gt;Unrounded coordinates&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href='http://bl.ocks.org/4089090'&gt;Rounded but fixed-length coordinates&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href='http://bl.ocks.org/4081356'&gt;Rounded coordinates&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id='markers_along_a_path'&gt;Markers along a path&lt;/h2&gt;

&lt;p&gt;One of the features we need in iD is an indication of roads that are &lt;a href='http://wiki.openstreetmap.org/wiki/Key:oneway'&gt;one-way&lt;/a&gt;, and which way they are going.&lt;/p&gt;

&lt;p&gt;&lt;a href='http://bl.ocks.org/4079745'&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8479/8190767967_c80907007a_c.jpg' /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SVG has some built-in functionality for this purpose - you can define a &lt;code&gt;marker&lt;/code&gt; in a &lt;code&gt;defs&lt;/code&gt; element and use it on &lt;code&gt;path&lt;/code&gt; elements with &lt;code&gt;marker-mid&lt;/code&gt; and so on. Unfortunately, this doesn&amp;#8217;t cut it, since OSM paths have an extremely variable number of vertices - some straight lines have hundreds of vertices, some have only a few, and would be very sparsely labeled.&lt;/p&gt;

&lt;p&gt;Our current solution to this is to use a &lt;code&gt;textPath&lt;/code&gt; with a glyph - a right-facing triangle. Here&amp;#8217;s &lt;a href='http://bl.ocks.org/4079745'&gt;what it looks like in a standalone demo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, determine the size of an arrow - how many pixels it occupies from left to right on a path:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;arrow&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;svg&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;append&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;text&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;).&lt;/span&gt;&lt;span class='nx'&gt;text&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;►&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
&lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;alength&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='nx'&gt;arrow&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;node&lt;/span&gt;&lt;span class='p'&gt;().&lt;/span&gt;&lt;span class='nx'&gt;getComputedTextLength&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;span class='nx'&gt;arrow&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;remove&lt;/span&gt;&lt;span class='p'&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then &lt;code&gt;getTotalLength&lt;/code&gt; lets you get the pixel-length of a &lt;code&gt;path&lt;/code&gt;, and you can then use multiplication &amp;amp; letter spacing to distribute just enough markers for the path:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='nx'&gt;tp&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;attr&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;letter-spacing&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='nx'&gt;alength&lt;/span&gt; &lt;span class='o'&gt;*&lt;/span&gt; &lt;span class='mi'&gt;2&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt;
    &lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;attr&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;xlink:href&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='s1'&gt;&amp;#39;#p&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;).&lt;/span&gt;&lt;span class='nx'&gt;text&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='kd'&gt;function&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='k'&gt;return&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='k'&gt;new&lt;/span&gt; &lt;span class='nb'&gt;Array&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nb'&gt;Math&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;floor&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;
            &lt;span class='nx'&gt;path&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;node&lt;/span&gt;&lt;span class='p'&gt;().&lt;/span&gt;&lt;span class='nx'&gt;getTotalLength&lt;/span&gt;&lt;span class='p'&gt;()&lt;/span&gt; &lt;span class='o'&gt;/&lt;/span&gt; &lt;span class='nx'&gt;alength&lt;/span&gt; &lt;span class='o'&gt;/&lt;/span&gt; &lt;span class='mi'&gt;2&lt;/span&gt;&lt;span class='p'&gt;)))&lt;/span&gt;
            &lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;join&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='s1'&gt;&amp;#39;►&amp;#39;&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
    &lt;span class='p'&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I noticed that this example is broken in Firefox. This is due to the following (also noted on the example page):&lt;/p&gt;

&lt;p&gt;The original version of this failed because Firefox &lt;a href='https://developer.mozilla.org/en-US/docs/CSS/letter-spacing'&gt;does not support letter-spacing on SVG elements&lt;/a&gt;. The second version failed because it has a &lt;a href='https://bugzilla.mozilla.org/show_bug.cgi?id=346694'&gt;bug in getComputedTextLength&lt;/a&gt;. The third failed because &lt;a href='https://bugzilla.mozilla.org/show_bug.cgi?id=319786'&gt;it does not preserve space according to xml:space&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Needless to say, Firefox is not the main target for iD testing because of a buggy and incomplete implementation of SVG relative to WebKit.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>iD Updates</title>
   <link href="http://mapbox.com/osmdev/2012/11/14/id-updates"/>
   <updated>2012-11-14T00:00:00-05:00</updated>
   <id>http://mapbox.com/osmdev/2012/11/14/id-updates</id>
   <content type="html">&lt;p&gt;For the last few weeks, I&amp;#8217;ve been working on building &lt;a href='https://github.com/systemed/iD'&gt;iD&lt;/a&gt;, along with &lt;a href='https://github.com/jfirebaugh'&gt;John Firebaugh&lt;/a&gt; and with lots of help from &lt;a href='http://www.systemed.net/'&gt;Richard Fairhurst&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We&amp;#8217;re all learning a lot: here are some specifics.&lt;/p&gt;

&lt;h2 id='making_id_fast'&gt;Making iD Fast&lt;/h2&gt;

&lt;p&gt;iD has to be fast. If the experience of moving the map, drawing roads, and so forth isn&amp;#8217;t satisfying, it won&amp;#8217;t be adopted.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s no single ingredient that makes maps fast: it&amp;#8217;s essentially a combination of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Javascript performance&lt;/strong&gt;, like the speed of projecting data to screen coordinates, grabbing data from the local datastore, and assorted code like styling and processing mouse and touch events. In the case of canvas, maintaining a scenegraph is a big javascript performance task.&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;Network performance&lt;/strong&gt;, or how quickly you can grab data from an API to display on-page&lt;/li&gt;

&lt;li&gt;&lt;strong&gt;DOM Performance&lt;/strong&gt;, like drawing to a Canvas element or updating attributes of an SVG element.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The clearest &amp;#8216;first load&amp;#8217; issue for iD is network performance: data is coming down from OSM&amp;#8217;s servers in untiled WMS-style queries and the servers we&amp;#8217;re dealing with are not blazingly fast. We plan to resolve this partially by using tiled requests with smart caching, and otherwise handle expectations by making it clear when map data is loading.&lt;/p&gt;

&lt;p&gt;Javascript performance isn&amp;#8217;t a big bottleneck at this point, though there are certain inefficiencies that would be great to address, mainly in the &lt;a href='https://github.com/mbostock/d3/issues/879'&gt;finer points of d3&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The biggest bottleneck that I&amp;#8217;m currently seeing is the DOM. iD uses SVG for rendering maps because it gives a clear path to styling data and handling interactivity. While it&amp;#8217;s possible to use Canvas with a scenegraph, it&amp;#8217;s likely to be more error-prone as far as hit-detection with multi-layered maps.&lt;/p&gt;

&lt;p&gt;And so the biggest performance problem with, for instance, dragging the map, is the cost of reassigning the &lt;code&gt;d&lt;/code&gt; attribute to all &lt;a href='http://www.w3.org/TR/SVG/paths.html'&gt;svg paths&lt;/a&gt; in order to move them onscreen.&lt;/p&gt;

&lt;p&gt;There are ways around this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Project vector features to a certain &amp;#8216;zero origin&amp;#8217; and transform them into place onscreen&lt;/li&gt;

&lt;li&gt;Handle pan behaviors by setting a transform on the entire map object&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both of these have tradeoffs: data on the map is &lt;em&gt;not static&lt;/em&gt;, and so d3 needs to handle the case of a user dragging a line segment extremely well. And thus a heuristic like setting transforms on the entire map element will require a fallback for correctly calculating the position of transformed paths.&lt;/p&gt;

&lt;p&gt;To fill in some background information: this is referring to &lt;a href='http://www.w3.org/TR/css3-transforms/'&gt;CSS transforms&lt;/a&gt;, which have the positive effect of limiting &lt;a href='http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/'&gt;browser repaints and reflows&lt;/a&gt;, the biggest performance hit of changing elements onscreen.&lt;/p&gt;

&lt;p&gt;SVG&amp;#8217;s performance relative to Canvas is a popular topic: &lt;a href='http://smus.com/canvas-vs-svg-performance/'&gt;canvas is generally faster for drawing many objects&lt;/a&gt; while SVG is better for large canvases. But the main consideration in this project is not raw drawing performance, but the ability of the rendering layer to support interactivity and updates: existing map renderers like &lt;a href='http://kothic.org/js/'&gt;KothicJS&lt;/a&gt; do fast canvas rendering, but static rendering like &lt;a href='http://mapnik.org/'&gt;Mapnik&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id='measuring_fast'&gt;Measuring Fast&lt;/h3&gt;

&lt;p&gt;I&amp;#8217;m mostly developing in Chrome - there doesn&amp;#8217;t seem to be a very good profiler for Firefox, unfortunately. The main metric for debugging performance problems is the Javascript CPU Profile option of the WebKit debugger.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8060/8185637922_2c0da12015_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;Setting attributes, pulling data, and projecting points (&amp;#8216;mercator&amp;#8217;) all contribute to the performance profile of iD.&lt;/p&gt;

&lt;p&gt;Another dimension we&amp;#8217;re paying close attention to is memory usage, or heap size. While much of iD uses the &lt;a href='http://macwright.org/2012/06/04/the-module-pattern.html'&gt;module pattern&lt;/a&gt; - for instance, the main &lt;code&gt;iD.Map&lt;/code&gt; object - for highly allocated objects, we&amp;#8217;re using Javascript prototype-based objects, which cut down on the size of closures in the heap.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8346/8185651010_f49da6247c_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;Heap size is and should be dominated by the actual data of the map, stored in coordinate arrays and so on.&lt;/p&gt;

&lt;h3 id='the_size_of_id'&gt;The Size of iD&lt;/h3&gt;

&lt;p&gt;The size of Javascript code has varying importance - often, it is cached after first load and doesn&amp;#8217;t effect performance in any real way. However, given non-shared caches and large libraries (&lt;a href='http://openlayers.org/'&gt;OpenLayers&lt;/a&gt; comes to mind) code size is a real performance consideration.&lt;/p&gt;

&lt;p&gt;We&amp;#8217;re using &lt;a href='https://github.com/mishoo/UglifyJS'&gt;uglifyjs&lt;/a&gt; for code compression, and a simple Makefile &amp;amp; cat system for building a big &lt;code&gt;iD.js&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8343/8185641019_382e88c7ec_o.png' /&gt;&lt;/p&gt;

&lt;p&gt;Right now &lt;a href='http://d3js.org/'&gt;d3&lt;/a&gt; is the majority of the iD payload. This is relatively acceptable, since iD itself is very small, and would likely be much larger if it didn&amp;#8217;t depend on d3 for specifics like map projection, event binding, and so on.&lt;/p&gt;

&lt;h2 id='making_id_friendly'&gt;Making iD Friendly&lt;/h2&gt;

&lt;p&gt;iD has to be friendly. Meaning that it needs to be as self-explanatory as possible, and then fall back to help quickly.&lt;/p&gt;

&lt;p&gt;First this is a question of interaction paradigms. The map should be some combination of an Adobe Illustrator experience and a Google Maps experience, without being too confusing. This means that, unlike Potlatch 2, we&amp;#8217;re planning on having, essentially, modes.&lt;/p&gt;

&lt;p&gt;One big difference will also be the separation of drawing &amp;#8216;roads&amp;#8217; versus drawing &amp;#8216;areas&amp;#8217;. In the OSM data model, ways can represent both buildings - closed loops with area - and streets. There&amp;#8217;s very little distinction on a technical level, but a very large distinction in most users minds, so we&amp;#8217;re going to mirror the mental model.&lt;/p&gt;

&lt;p&gt;The next big &amp;#8216;what&amp;#8217; in OSM is the tagging model: while it&amp;#8217;s flexible, it&amp;#8217;s not clear.&lt;/p&gt;

&lt;p&gt;iD is going to have a system of presets which has solid visual cues and good descriptions. Behind this is strong integration with &lt;a href='http://taginfo.openstreetmap.org/'&gt;TagInfo&lt;/a&gt; or similar: an index of commonly used tag combinations which leads users to make correct choices.&lt;/p&gt;

&lt;p&gt;In order to make that work, we&amp;#8217;re going to need to help out a lot on editing OSM wiki help - improving the descriptions of tag combinations to make them both distinct and descriptive.&lt;/p&gt;

&lt;h2 id='making_id_correct'&gt;Making iD Correct&lt;/h2&gt;

&lt;p&gt;OpenStreetMap is filled with corner cases. A few pathological conditions I&amp;#8217;ve listed in the &lt;code&gt;NOTES.md&lt;/code&gt; file which has been developed along with iD:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ways with one node&lt;/li&gt;

&lt;li&gt;Relations which contain themselves (circular references)&lt;/li&gt;

&lt;li&gt;Nodes with no tags and no way attached&lt;/li&gt;

&lt;li&gt;Ways which contain only nodes that are subsets of the nodes of other ways&lt;/li&gt;

&lt;li&gt;Paths with intersecting boundaries (invalid geometries)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Handling each of these cases correctly is essential to iD: this editor cannot be destructive, or make design decisions that puts data integrity at risk.&lt;/p&gt;

&lt;h2 id='whats_next'&gt;What&amp;#8217;s Next&lt;/h2&gt;

&lt;p&gt;We&amp;#8217;re working on the meat of the problem currently: the ability to draw, edit, and remove map features, have those operations be reversable as undo operations and create changesets from that.&lt;/p&gt;

&lt;p&gt;The data model has progressed greatly: an immutable graph, a simple history representation, and lightweight data objects are complete. There&amp;#8217;s a lot around the edges, like entering and exiting drawing states, that needs work.&lt;/p&gt;

&lt;p&gt;And the issue of iterating through the graph and generating a changeset is just about to be started.&lt;/p&gt;

&lt;p&gt;If you&amp;#8217;re interested in contributing, take a look at &lt;a href='https://github.com/systemed/iD'&gt;the repository on github&lt;/a&gt;, the &lt;a href='https://github.com/systemed/iD/blob/master/NOTES.md'&gt;current notes&lt;/a&gt; and &lt;a href='https://github.com/systemed/iD/issues?page=1&amp;amp;state=open'&gt;open issues&lt;/a&gt;. We&amp;#8217;re keeping a very open contributing process - pull requests are merged quickly, everything happens in the &lt;code&gt;master&lt;/code&gt; branch, and issues are discussed in GitHub issues or in the &lt;code&gt;#osm-dev&lt;/code&gt; IRC channel. Join us!&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>First Steps With iD Editor</title>
   <link href="http://mapbox.com/osmdev/2012/10/25/diving-into-id"/>
   <updated>2012-10-25T00:00:00-04:00</updated>
   <id>http://mapbox.com/osmdev/2012/10/25/diving-into-id</id>
   <content type="html">&lt;p&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8472/8115110370_6e3ca14f20_b.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The OSM Editor&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href='https://github.com/systemed/iD'&gt;iD&lt;/a&gt; editor is a new Javascript map editor initiated by &lt;a href='http://www.systemed.net/'&gt;Richard Fairhurst&lt;/a&gt;, the author of &lt;a href='http://wiki.openstreetmap.org/wiki/Potlatch_2'&gt;Potlatch 2&lt;/a&gt;, the current default editing experience for &lt;a href='http://www.openstreetmap.org/'&gt;OpenStreetMap&lt;/a&gt;. One of OSM&amp;#8217;s clearest needs is a good map editor - it&amp;#8217;s the difference between new users becoming consistent contributors or being scared away by the complexity of mapping.&lt;/p&gt;

&lt;p&gt;The idea of a new editor is a much-discussed topic - Potlatch 2 is built on Flash, and the advanced editor option, &lt;a href='http://josm.openstreetmap.de/'&gt;JOSM&lt;/a&gt;, can be intimidating even to the tech-savvy.&lt;/p&gt;

&lt;h2 id='architecture'&gt;Architecture&lt;/h2&gt;

&lt;p&gt;iD is exciting because it&amp;#8217;s a smart approach to building the future - for the most part, it&amp;#8217;s taking knowledge from Richard&amp;#8217;s and others&amp;#8217; work with Potlatch to make a stable, modular layer for OSM data model. From there, we&amp;#8217;re working on building a great user interface that&amp;#8217;s intuitive and simple, but not limiting.&lt;/p&gt;

&lt;p&gt;The initial work on iD used the &lt;a href='http://dojotoolkit.org/'&gt;dojo framework&lt;/a&gt; as a library and source of structure. I&amp;#8217;ve been working in the past week to limit this dependency - it now uses &lt;a href='http://underscorejs.org/'&gt;underscore.js&lt;/a&gt; for functional programming mechanisms and &lt;a href='http://jquery.com/'&gt;jQuery&lt;/a&gt; for DOM &amp;amp; AJAX.&lt;/p&gt;

&lt;p&gt;The biggest change recently is moving to &lt;a href='http://d3js.org/'&gt;d3&lt;/a&gt; for data-binding and graphics. We&amp;#8217;re using &lt;code&gt;d3.geo.mercator&lt;/code&gt; as the map projection, &lt;code&gt;d3.behavior.zoom&lt;/code&gt; for navigating the map, and &lt;code&gt;d3.behavior.drag&lt;/code&gt; for dragging handle points for ways and points for POIs.&lt;/p&gt;

&lt;p&gt;The map tiling component is extremely minimal - less than &lt;a href='http://bl.ocks.org/3943330'&gt;100 lines of javascript&lt;/a&gt;. The emphasis of the project will really be on keeping rendering fast &amp;amp; light and then focusing on the functionality of the editor, which will require extensive work with the OSM object model, an undo system, and the various APIs.&lt;/p&gt;

&lt;p&gt;Currently the &lt;a href='http://wiki.openstreetmap.org/wiki/MapCSS'&gt;MapCSS&lt;/a&gt; backend dependency has been removed, and replaced with a simpler system that operates by simple CSS classes added to path elements and styling functions for deriving icons from points. This seems to work well, and basic d3 functionality like &lt;a href='https://github.com/mbostock/d3/wiki/Selections#wiki-sort'&gt;sorting selections&lt;/a&gt; works well to replicate OSM&amp;#8217;s &lt;code&gt;layer&lt;/code&gt; and &lt;code&gt;bridge&lt;/code&gt; rendering priorities.&lt;/p&gt;

&lt;p&gt;For instance, here&amp;#8217;s the current sorting function:&lt;/p&gt;
&lt;div class='highlight'&gt;&lt;pre&gt;&lt;code class='js'&gt;&lt;span class='kd'&gt;function&lt;/span&gt; &lt;span class='nx'&gt;waystack&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
    &lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='o'&gt;!&lt;/span&gt;&lt;span class='nx'&gt;a&lt;/span&gt; &lt;span class='o'&gt;||&lt;/span&gt; &lt;span class='o'&gt;!&lt;/span&gt;&lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;return&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
    &lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;layer&lt;/span&gt; &lt;span class='o'&gt;!==&lt;/span&gt; &lt;span class='kc'&gt;undefined&lt;/span&gt; &lt;span class='o'&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;layer&lt;/span&gt; &lt;span class='o'&gt;!==&lt;/span&gt; &lt;span class='kc'&gt;undefined&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='k'&gt;return&lt;/span&gt; &lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;layer&lt;/span&gt; &lt;span class='o'&gt;-&lt;/span&gt; &lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;layer&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
    &lt;span class='p'&gt;}&lt;/span&gt;
    &lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;bridge&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;return&lt;/span&gt; &lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
    &lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;bridge&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='k'&gt;return&lt;/span&gt; &lt;span class='o'&gt;-&lt;/span&gt;&lt;span class='mi'&gt;1&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
    &lt;span class='kd'&gt;var&lt;/span&gt; &lt;span class='nx'&gt;as&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;,&lt;/span&gt; &lt;span class='nx'&gt;bs&lt;/span&gt; &lt;span class='o'&gt;=&lt;/span&gt; &lt;span class='mi'&gt;0&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
    &lt;span class='k'&gt;if&lt;/span&gt; &lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;highway&lt;/span&gt; &lt;span class='o'&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;highway&lt;/span&gt;&lt;span class='p'&gt;)&lt;/span&gt; &lt;span class='p'&gt;{&lt;/span&gt;
        &lt;span class='nx'&gt;as&lt;/span&gt; &lt;span class='o'&gt;-=&lt;/span&gt; &lt;span class='nx'&gt;highway_stack&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;indexOf&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;a&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;highway&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
        &lt;span class='nx'&gt;bs&lt;/span&gt; &lt;span class='o'&gt;-=&lt;/span&gt; &lt;span class='nx'&gt;highway_stack&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;indexOf&lt;/span&gt;&lt;span class='p'&gt;(&lt;/span&gt;&lt;span class='nx'&gt;b&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;tags&lt;/span&gt;&lt;span class='p'&gt;.&lt;/span&gt;&lt;span class='nx'&gt;highway&lt;/span&gt;&lt;span class='p'&gt;);&lt;/span&gt;
    &lt;span class='p'&gt;}&lt;/span&gt;
    &lt;span class='k'&gt;return&lt;/span&gt; &lt;span class='nx'&gt;as&lt;/span&gt; &lt;span class='o'&gt;-&lt;/span&gt; &lt;span class='nx'&gt;bs&lt;/span&gt;&lt;span class='p'&gt;;&lt;/span&gt;
&lt;span class='p'&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I&amp;#8217;ve started on basic testing using &lt;a href='http://pivotal.github.com/jasmine/'&gt;Jasmine&lt;/a&gt;, though test coverage needs a lot of improvement.&lt;/p&gt;

&lt;p&gt;The really cool thing is that iD has &lt;code&gt;iD.Node&lt;/code&gt;, &lt;code&gt;iD.Way&lt;/code&gt;, and &lt;code&gt;iD.Relation&lt;/code&gt; - Javascript wrappers for basic bits of OSM that we can reason about. So, in the course of building an editor it&amp;#8217;s handy to have shortcuts like &lt;code&gt;activeWay.isClosed()&lt;/code&gt;, and combine these with &amp;#8216;actions&amp;#8217; - essentially stock operations, like adding nodes to ways.&lt;/p&gt;

&lt;h2 id='immediate_future_plans'&gt;Immediate Future Plans&lt;/h2&gt;

&lt;p&gt;Creating an editor can be fraught: you can make a system in which people unknowingly duplicate, delete, or corrupt OpenStreetMap data. So it&amp;#8217;s important that iD is being built with previous experience and lots of tests - and ideally this process will lead to thorough documentation on how to do things the right way, as well.&lt;/p&gt;

&lt;p&gt;Right now text labels are turned off due to an apparent limitation of SVG&amp;#8217;s &lt;code&gt;textPath&lt;/code&gt; element. This is a top priority to get back. On the bright side, the refactor allows us to use &lt;a href='http://www.svgbasics.com/defs.html'&gt;use and defs&lt;/a&gt; elements to reduce the duplication of paths for lines.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve also started to rebuild UI elements, like a tag editor with the new system and with lightweight HTML+CSS that can be styled nicely. These bits are a bit tricky, and are intertwined with the issue of whether to keep multiple versions of objects or to store transformations between versions.&lt;/p&gt;

&lt;h2 id='contribute'&gt;Contribute&lt;/h2&gt;

&lt;p&gt;If you&amp;#8217;d like to help out, or just git clone and kick the tires, see the &lt;a href='https://github.com/systemed/iD'&gt;GitHub repository for iD&lt;/a&gt;. Right now there&amp;#8217;s a lot moving - so pardon the dust - but it&amp;#8217;s a fun early look at a really big change for OSM.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Hacking on OWL and APIs On October 27 and 28</title>
   <link href="http://mapbox.com/osmdev/2012/10/23/hack-weekend"/>
   <updated>2012-10-23T11:00:00-04:00</updated>
   <id>http://mapbox.com/osmdev/2012/10/23/hack-weekend</id>
   <content type="html">&lt;p&gt;&lt;img alt='' src='http://farm4.staticflickr.com/3060/2313908883_596c884195_z.jpg' /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Photo &lt;a href='http://www.flickr.com/photos/heatheronhertravels/2313908883/'&gt;heatherontravels&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Matt Amos, one of the maintainers of the &lt;a href='http://bit.ly/fXdrQJ'&gt;OpenStreetMap Watch List (OWL)&lt;/a&gt; is in town for the weekend. Tom and I will take this opportunity and join him hacking on OWL and on OpenStreetMap APIs.&lt;/p&gt;

&lt;p&gt;Join us: We&amp;#8217;ll get together on Saturday October 27th and Sunday October 28th at the &lt;a href='http://bit.ly/mapboxoffice'&gt;MapBox office&lt;/a&gt; at 11AM and we&amp;#8217;ll go until about 6PM. There will be plenty of coffee and if we&amp;#8217;re hungry we&amp;#8217;ll order in. If you&amp;#8217;re not in DC: we&amp;#8217;ll also hang out on IRC - #osm-dev on irc.oftc.net.&lt;/p&gt;</content>
 </entry>
 
 <entry>
   <title>Welcome to the MapBox OSM Development Blog</title>
   <link href="http://mapbox.com/osmdev/2012/10/23/welcome"/>
   <updated>2012-10-23T10:45:00-04:00</updated>
   <id>http://mapbox.com/osmdev/2012/10/23/welcome</id>
   <content type="html">&lt;p&gt;&lt;a href='http://a.tiles.mapbox.com/v3/saman.map-nzxr8zw8.html#3/0/0'&gt;&lt;img alt='' src='http://farm9.staticflickr.com/8189/8102552022_58fb86abec_z.jpg' /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;World wide OpenStreetMap data coverage 2012&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After &lt;a href='http://mapbox.com/blog/kicking-off-knight-work/'&gt;kicking off Knight Foundation funded OpenStreetMap work two weeks ago&lt;/a&gt; we have gotten &lt;a href='http://lists.openstreetmap.org/pipermail/dev/2012-October/025746.html'&gt;tons&lt;/a&gt; &lt;a href='http://lists.openstreetmap.org/pipermail/dev/2012-October/025777.html'&gt;of&lt;/a&gt; &lt;a href='http://lists.openstreetmap.org/pipermail/dev/2012-October/025867.html'&gt;feedback&lt;/a&gt; from the community on mailing lists, the &lt;a href='https://github.com/openstreetmap/openstreetmap-website/'&gt;openstreetmap-website&lt;/a&gt; repository and at the State of the Map in Portland. This was extremely valuable input and it&amp;#8217;s fantastic to see so many people we can engage with on improving OpenStreetMap. &lt;a href='http://lists.openstreetmap.org/pipermail/dev/2012-October/025867.html'&gt;There is much more work to be done than what we can hope to tackle&lt;/a&gt; in the next months, but there are incredibly clear next actions to follow now. Specifically, Tom has started to contribute to the &lt;a href='http://www.geowiki.com/'&gt;iD project&lt;/a&gt;. Here is a &lt;a href='http://lists.openstreetmap.org/pipermail/dev/2012-October/025995.html'&gt;note by Richard Fairhurst on how to get involved in development&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We&amp;#8217;re starting this blog as a casual space to talk about our ongoing Knight-funded work. This is the place to stay in the loop of what we&amp;#8217;re up to. Expect regular updates of where work is happening and bigger picture posts. We will continue to post key developments to &lt;a href='http://lists.openstreetmap.org/listinfo/talk'&gt;&lt;span&gt;talk&lt;/span&gt;&lt;/a&gt; and hash out conversations on &lt;a href='http://lists.openstreetmap.org/listinfo/dev'&gt;&lt;span&gt;dev&lt;/span&gt;&lt;/a&gt;, while we&amp;#8217;re keeping our heads down on work in &lt;a href='https://github.com/systemed/iD'&gt;issue queues like iD&amp;#8217;s&lt;/a&gt;.&lt;/p&gt;</content>
 </entry>
 
 
</feed>