170
Yet Another Mapping API - Not ! Mansour Raad [email protected]

Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Embed Size (px)

DESCRIPTION

In this session we will demonstrate the Flex Mapping API For ArcGIS Server, where we will deconstruct live real-world mapping applications and algorithms such as dense clustering, auto labeling of features, collaborative editing, real-time asset tracking and client/server collaborative Geo-Processing. In addition, we will demonstrate how to create your own layer, geometry and symbol extensions for superior rendering performance taking advantage of the FP10 drawing API.

Citation preview

Page 1: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Yet AnotherMapping API - Not !

Mansour [email protected]

Page 2: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 3: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 6: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 7: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 8: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ArcGIS Services

• Map Tiles ESRI / Virtual Earth (token)

• Geocoding / Reverse

• Query / Identify

• Routing with Barriers and Time Windows

• Buffer / Projection

• GeoProcessing

Page 9: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

You & ArcGIS

BlazePHP.Net

Local AGS

Page 10: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Map “Hello World”

Page 11: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<?xml version="1.0" encoding="utf-8"?>2.<mx:Application3. xmlns:mx="http://www.adobe.com/2006/mxml"4. xmlns:esri="http://www.esri.com/2008/ags"5. layout="absolute"6. >7. <esri:Map id="map">8. <esri:ArcGISTiledMapServiceLayer url=”http://host/rest/map”/> 9. </esri:Map> 10.</mx:Application>

Map “Hello World”

Page 12: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<?xml version="1.0" encoding="utf-8"?>2.<mx:Application3. xmlns:mx="http://www.adobe.com/2006/mxml"4. xmlns:esri="http://www.esri.com/2008/ags"5. layout="absolute"6. >7. <esri:Map id="map">8. <esri:ArcGISTiledMapServiceLayer url=”http://host/rest/map”/> 9. </esri:Map> 10.</mx:Application>

Map “Hello World”

Page 13: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<?xml version="1.0" encoding="utf-8"?>2.<mx:Application3. xmlns:mx="http://www.adobe.com/2006/mxml"4. xmlns:esri="http://www.esri.com/2008/ags"5. layout="absolute"6. >7. <esri:Map id="map" openHandCursorVisible="false" zoomSliderVisible="false">8. <esri:ArcGISTiledMapServiceLayer id="layer" url="{cb.selectedItem.url}"/> 9. </esri:Map>10. <mx:ComboBox id="cb" dataProvider="{[11. {label:'Imagery',url:'http://host/rest/Image'},12. {label:'Physical',url:'http://host/rest/Physical'}13. ]}"/> 14.</mx:Application>

Page 14: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<?xml version="1.0" encoding="utf-8"?>2.<mx:Application3. xmlns:mx="http://www.adobe.com/2006/mxml"4. xmlns:esri="http://www.esri.com/2008/ags"5. layout="absolute"6. >7. <esri:Map id="map" openHandCursorVisible="false" zoomSliderVisible="false">8. <esri:ArcGISTiledMapServiceLayer id="layer" url="{cb.selectedItem.url}"/> 9. </esri:Map>10. <mx:ComboBox id="cb" dataProvider="{[11. {label:'Imagery',url:'http://host/rest/Image'},12. {label:'Physical',url:'http://host/rest/Physical'}13. ]}"/> 14.</mx:Application>

Page 15: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<?xml version="1.0" encoding="utf-8"?>2.<mx:Application3. xmlns:mx="http://www.adobe.com/2006/mxml"4. xmlns:esri="http://www.esri.com/2008/ags"5. layout="absolute"6. >7. <esri:Map id="map" openHandCursorVisible="false" zoomSliderVisible="false">8. <esri:ArcGISTiledMapServiceLayer id="layer" url="{cb.selectedItem.url}"/> 9. </esri:Map>10. <mx:ComboBox id="cb" dataProvider="{[11. {label:'Imagery',url:'http://host/rest/Image'},12. {label:'Physical',url:'http://host/rest/Physical'}13. ]}"/> 14.</mx:Application>

Page 16: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

GeoProcessingDriveTimes

Page 17: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 18: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 19: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 20: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 21: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1. <esri:Geoprocessor id="gp" url="<GeoProcessesorURL>" showBusyCursor="true"/>2. <esri:Map id="map" openHandCursorVisible="false" mapClick="mapClickHandler(event)">3. <esri:extent>4. <esri:Extent xmin="-95.41" ymin="38.86" xmax="-95.1" ymax="39.06">5. <esri:SpatialReference wkid="4326"/>6. </esri:Extent>7. </esri:extent>8. <esri:ArcGISTiledMapServiceLayer url="<MapServiceURL>"/>9. <esri:GraphicsLayer id="polygonLayer" graphicProvider="{gp.executeFirstFeatureSet.features}">10. <esri:renderer>11. <esri:UniqueValueRenderer attribute="ToBreak">12. <esri:UniqueValueInfo value="1">13. <esri:symbol>14. <esri:SimpleFillSymbol alpha="0.5" color="0xFF0000"/>15. </esri:symbol>16. </esri:UniqueValueInfo>17. <esri:UniqueValueInfo value="2">18. <esri:symbol>19. <esri:SimpleFillSymbol alpha="0.5" color="0x00FF00"/>20. </esri:symbol>21. </esri:UniqueValueInfo>22. <esri:UniqueValueInfo value="3">23. <esri:symbol>24. <esri:SimpleFillSymbol alpha="0.5" color="0x0000FF"/>25. </esri:symbol>26. </esri:UniqueValueInfo>27. </esri:UniqueValueRenderer>28. </esri:renderer>29. </esri:GraphicsLayer>30. <esri:GraphicsLayer id="pointLayer"/>31. </esri:Map>

Page 22: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1. <esri:Geoprocessor id="gp" url="<GeoProcessesorURL>" showBusyCursor="true"/>2. <esri:Map id="map" openHandCursorVisible="false" mapClick="mapClickHandler(event)">3. <esri:extent>4. <esri:Extent xmin="-95.41" ymin="38.86" xmax="-95.1" ymax="39.06">5. <esri:SpatialReference wkid="4326"/>6. </esri:Extent>7. </esri:extent>8. <esri:ArcGISTiledMapServiceLayer url="<MapServiceURL>"/>9. <esri:GraphicsLayer id="polygonLayer" graphicProvider="{gp.executeFirstFeatureSet.features}">10. <esri:renderer>11. <esri:UniqueValueRenderer attribute="ToBreak">12. <esri:UniqueValueInfo value="1">13. <esri:symbol>14. <esri:SimpleFillSymbol alpha="0.5" color="0xFF0000"/>15. </esri:symbol>16. </esri:UniqueValueInfo>17. <esri:UniqueValueInfo value="2">18. <esri:symbol>19. <esri:SimpleFillSymbol alpha="0.5" color="0x00FF00"/>20. </esri:symbol>21. </esri:UniqueValueInfo>22. <esri:UniqueValueInfo value="3">23. <esri:symbol>24. <esri:SimpleFillSymbol alpha="0.5" color="0x0000FF"/>25. </esri:symbol>26. </esri:UniqueValueInfo>27. </esri:UniqueValueRenderer>28. </esri:renderer>29. </esri:GraphicsLayer>30. <esri:GraphicsLayer id="pointLayer"/>31. </esri:Map>

Page 23: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1. <esri:Geoprocessor id="gp" url="<GeoProcessesorURL>" showBusyCursor="true"/>2. <esri:Map id="map" openHandCursorVisible="false" mapClick="mapClickHandler(event)">3. <esri:extent>4. <esri:Extent xmin="-95.41" ymin="38.86" xmax="-95.1" ymax="39.06">5. <esri:SpatialReference wkid="4326"/>6. </esri:Extent>7. </esri:extent>8. <esri:ArcGISTiledMapServiceLayer url="<MapServiceURL>"/>9. <esri:GraphicsLayer id="polygonLayer" graphicProvider="{gp.executeFirstFeatureSet.features}">10. <esri:renderer>11. <esri:UniqueValueRenderer attribute="ToBreak">12. <esri:UniqueValueInfo value="1">13. <esri:symbol>14. <esri:SimpleFillSymbol alpha="0.5" color="0xFF0000"/>15. </esri:symbol>16. </esri:UniqueValueInfo>17. <esri:UniqueValueInfo value="2">18. <esri:symbol>19. <esri:SimpleFillSymbol alpha="0.5" color="0x00FF00"/>20. </esri:symbol>21. </esri:UniqueValueInfo>22. <esri:UniqueValueInfo value="3">23. <esri:symbol>24. <esri:SimpleFillSymbol alpha="0.5" color="0x0000FF"/>25. </esri:symbol>26. </esri:UniqueValueInfo>27. </esri:UniqueValueRenderer>28. </esri:renderer>29. </esri:GraphicsLayer>30. <esri:GraphicsLayer id="pointLayer"/>31. </esri:Map>

Page 24: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1. <esri:Geoprocessor id="gp" url="<GeoProcessesorURL>" showBusyCursor="true"/>2. <esri:Map id="map" openHandCursorVisible="false" mapClick="mapClickHandler(event)">3. <esri:extent>4. <esri:Extent xmin="-95.41" ymin="38.86" xmax="-95.1" ymax="39.06">5. <esri:SpatialReference wkid="4326"/>6. </esri:Extent>7. </esri:extent>8. <esri:ArcGISTiledMapServiceLayer url="<MapServiceURL>"/>9. <esri:GraphicsLayer id="polygonLayer" graphicProvider="{gp.executeFirstFeatureSet.features}">10. <esri:renderer>11. <esri:UniqueValueRenderer attribute="ToBreak">12. <esri:UniqueValueInfo value="1">13. <esri:symbol>14. <esri:SimpleFillSymbol alpha="0.5" color="0xFF0000"/>15. </esri:symbol>16. </esri:UniqueValueInfo>17. <esri:UniqueValueInfo value="2">18. <esri:symbol>19. <esri:SimpleFillSymbol alpha="0.5" color="0x00FF00"/>20. </esri:symbol>21. </esri:UniqueValueInfo>22. <esri:UniqueValueInfo value="3">23. <esri:symbol>24. <esri:SimpleFillSymbol alpha="0.5" color="0x0000FF"/>25. </esri:symbol>26. </esri:UniqueValueInfo>27. </esri:UniqueValueRenderer>28. </esri:renderer>29. </esri:GraphicsLayer>30. <esri:GraphicsLayer id="pointLayer"/>31. </esri:Map>

Page 25: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<mx:Script>2. <![CDATA[3. import com.esri.ags.tasks.FeatureSet;4. import com.esri.ags.Graphic;5. import com.esri.ags.events.MapMouseEvent;

7. private function mapClickHandler(event:MapMouseEvent):void8. {9. const graphic:Graphic = new Graphic(event.mapPoint);10. pointLayer.clear();11. pointLayer.add(graphic);12. const featureSet:FeatureSet = new FeatureSet([graphic]);13. gp.execute({"Input_Location": featureSet, "Drive_Times": "1 2 3"});14. }15. ]]>16.</mx:Script>

Page 26: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<mx:Script>2. <![CDATA[3. import com.esri.ags.tasks.FeatureSet;4. import com.esri.ags.Graphic;5. import com.esri.ags.events.MapMouseEvent;

7. private function mapClickHandler(event:MapMouseEvent):void8. {9. const graphic:Graphic = new Graphic(event.mapPoint);10. pointLayer.clear();11. pointLayer.add(graphic);12. const featureSet:FeatureSet = new FeatureSet([graphic]);13. gp.execute({"Input_Location": featureSet, "Drive_Times": "1 2 3"});14. }15. ]]>16.</mx:Script>

Page 27: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

DemoSample 1-2DriveTimes

Page 28: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Many Children Layers

Page 29: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Many Graphic Layers

Page 30: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

GraphicLayer

Page 31: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

GraphicLayer

• graphicProvider

• ArrayCollection

• renderer

• graphic with no symbol

Page 32: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic

Page 33: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic

• UIComponent

• Flex life cycle management

• geometry

• symbol

• attributes

Page 34: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic/Geometry

Page 35: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic/Geometry

• Geometry - base class

• MapPoint

• Polyline

• Polygon

Page 36: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Polyline/Polygon

Page 37: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Polyline/Polygon

• Multi Part Geometry

• Islands of Hawaii

Page 38: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic/Symbol

Page 39: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic/Symbol

• Symbol - base class

• Draws geometry of Graphic

• Uses Flash Drawing API

Page 40: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic/Attributes

Page 41: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Graphic/Attributes

• Any Object !

• Attach any dynamic property to Graphic

Page 42: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Geometry/Symbol

Page 43: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Geometry/Symbol

• [Bindable] Properties

• Dispatch CHANGE event

Page 44: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

DemoSample 3-7

Page 45: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

LCDS

Page 46: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

LCDS

• Remote Objects

• Messaging

• Data Services

Page 47: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Feature

Page 48: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Feature

• Serializable server side object

• Properties

• featureID:int;

• geometry:IGeometry;

• attributes:ASObject;

Page 49: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

public class Feature implements Serializable{ private int m_featureId; private IGeometry m_geometry; private ASObject m_attributes;

public Feature() { }

public int getFeatureId() { return m_featureId; }

public void setFeatureId(final int featureId) { m_featureId = featureId; }

...

Page 50: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

public class MapPoint implements IGeometry{ private double m_x; private double m_y; private SpatialReference m_spatialReference;

public MapPoint(){ }

public MapPoint(final double x, final double y){ m_x = x; m_y = y; }

public double getX(){ return m_x; }

public void setX(final double x){ m_x = x; }

...

Page 51: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

DS Assembler

• fill

• createItem

• getItem

• updateItem

• deleteItem

Page 52: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private int m_featureId = 1;private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17);

public Collection fill(final List fillParameters){ return m_map.values();}

public Object getItem(final Map map){ return m_map.get(map.get("featureId"));}

public void createItem(final Object newVersion){ final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature);}

public void updateItem(final Object newVersion, final Object prevVersion, final List changes){ final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature);}

public void deleteItem(final Object prevVersion){ final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId());}

Page 53: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private int m_featureId = 1;private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17);

public Collection fill(final List fillParameters){ return m_map.values();}

public Object getItem(final Map map){ return m_map.get(map.get("featureId"));}

public void createItem(final Object newVersion){ final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature);}

public void updateItem(final Object newVersion, final Object prevVersion, final List changes){ final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature);}

public void deleteItem(final Object prevVersion){ final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId());}

Page 54: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private int m_featureId = 1;private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17);

public Collection fill(final List fillParameters){ return m_map.values();}

public Object getItem(final Map map){ return m_map.get(map.get("featureId"));}

public void createItem(final Object newVersion){ final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature);}

public void updateItem(final Object newVersion, final Object prevVersion, final List changes){ final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature);}

public void deleteItem(final Object prevVersion){ final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId());}

Page 55: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private int m_featureId = 1;private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17);

public Collection fill(final List fillParameters){ return m_map.values();}

public Object getItem(final Map map){ return m_map.get(map.get("featureId"));}

public void createItem(final Object newVersion){ final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature);}

public void updateItem(final Object newVersion, final Object prevVersion, final List changes){ final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature);}

public void deleteItem(final Object prevVersion){ final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId());}

Page 56: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private int m_featureId = 1;private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17);

public Collection fill(final List fillParameters){ return m_map.values();}

public Object getItem(final Map map){ return m_map.get(map.get("featureId"));}

public void createItem(final Object newVersion){ final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature);}

public void updateItem(final Object newVersion, final Object prevVersion, final List changes){ final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature);}

public void deleteItem(final Object prevVersion){ final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId());}

Page 57: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private int m_featureId = 1;private Map<Integer, Feature> m_map = new ConcurrentHashMap<Integer, Feature>(17);

public Collection fill(final List fillParameters){ return m_map.values();}

public Object getItem(final Map map){ return m_map.get(map.get("featureId"));}

public void createItem(final Object newVersion){ final Feature Feature = (Feature) newVersion; Feature.setFeatureId(m_featureId++); m_map.put(Feature.getFeatureId(), Feature);}

public void updateItem(final Object newVersion, final Object prevVersion, final List changes){ final Feature Feature = (Feature) newVersion; m_map.put(Feature.getFeatureId(), Feature);}

public void deleteItem(final Object prevVersion){ final Feature Feature = (Feature) prevVersion; m_map.remove(Feature.getFeatureId());}

Page 58: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

data-management-config.xml

Page 59: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

data-management-config.xml<destination id="feature"> <properties> <factory>spring</factory> <source>featureAssembler</source> <scope>application</scope> <use-transactions>false</use-transactions> <metadata> <identity property="featureId"/> </metadata> <network> <paging enabled="false" pageSize="10"/> </network> </properties></destination>

Page 60: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Back To The Client :-)

Page 61: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

package com.esri.cats{ import com.esri.ags.SpatialReference; import com.esri.ags.geometry.MapPoint; import flash.net.registerClassAlias; import mx.core.IMXMLObject;

public class ClassAliasRegistry implements IMXMLObject { public function initialized(document:Object, id:String):void { registerClassAlias("com.esri.cats.MapPoint", MapPoint); registerClassAlias("com.esri.cats.SpatialReference", SpatialReference); } }}

Page 62: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

package com.esri.cats{ import com.esri.ags.SpatialReference; import com.esri.ags.geometry.MapPoint; import flash.net.registerClassAlias; import mx.core.IMXMLObject;

public class ClassAliasRegistry implements IMXMLObject { public function initialized(document:Object, id:String):void { registerClassAlias("com.esri.cats.MapPoint", MapPoint); registerClassAlias("com.esri.cats.SpatialReference", SpatialReference); } }}

Page 63: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.package com.esri.cats2.{3. import com.esri.ags.geometry.Geometry;

5. [Managed]6. [RemoteClass(alias="com.esri.cats.Feature")]7. public class Feature8. {9. public var featureId:int;10. public var geometry:Geometry;11. public var attributes:Object;12. 13. public function Feature()14. {15. }16. 17. } 18.}

Page 64: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.package com.esri.cats2.{3. import com.esri.ags.geometry.Geometry;

5. [Managed]6. [RemoteClass(alias="com.esri.cats.Feature")]7. public class Feature8. {9. public var featureId:int;10. public var geometry:Geometry;11. public var attributes:Object;12. 13. public function Feature()14. {15. }16. 17. } 18.}

Page 65: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<cats:ClassAliasRegistry/>2.<mx:ArrayCollection id="features"3. collectionChange="collectionChangeHandler(event)"/>4.<mx:DataService id="ds" destination="feature"/>5.<esri:Map id="map" load="ds.fill(features)">6. <esri:GraphicsLayer id="graphicsLayer"/>7. <esri:GraphicsLayer id="pointLayer">8. <esri:symbol>9. <esri:SimpleMarkerSymbol color="0xFFFF00"/>10. </esri:symbol>11. </esri:GraphicsLayer>12.</esri:Map>

Page 66: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<cats:ClassAliasRegistry/>2.<mx:ArrayCollection id="features"3. collectionChange="collectionChangeHandler(event)"/>4.<mx:DataService id="ds" destination="feature"/>5.<esri:Map id="map" load="ds.fill(features)">6. <esri:GraphicsLayer id="graphicsLayer"/>7. <esri:GraphicsLayer id="pointLayer">8. <esri:symbol>9. <esri:SimpleMarkerSymbol color="0xFFFF00"/>10. </esri:symbol>11. </esri:GraphicsLayer>12.</esri:Map>

Page 67: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<cats:ClassAliasRegistry/>2.<mx:ArrayCollection id="features"3. collectionChange="collectionChangeHandler(event)"/>4.<mx:DataService id="ds" destination="feature"/>5.<esri:Map id="map" load="ds.fill(features)">6. <esri:GraphicsLayer id="graphicsLayer"/>7. <esri:GraphicsLayer id="pointLayer">8. <esri:symbol>9. <esri:SimpleMarkerSymbol color="0xFFFF00"/>10. </esri:symbol>11. </esri:GraphicsLayer>12.</esri:Map>

Page 68: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<cats:ClassAliasRegistry/>2.<mx:ArrayCollection id="features"3. collectionChange="collectionChangeHandler(event)"/>4.<mx:DataService id="ds" destination="feature"/>5.<esri:Map id="map" load="ds.fill(features)">6. <esri:GraphicsLayer id="graphicsLayer"/>7. <esri:GraphicsLayer id="pointLayer">8. <esri:symbol>9. <esri:SimpleMarkerSymbol color="0xFFFF00"/>10. </esri:symbol>11. </esri:GraphicsLayer>12.</esri:Map>

Page 69: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<cats:ClassAliasRegistry/>2.<mx:ArrayCollection id="features"3. collectionChange="collectionChangeHandler(event)"/>4.<mx:DataService id="ds" destination="feature"/>5.<esri:Map id="map" load="ds.fill(features)">6. <esri:GraphicsLayer id="graphicsLayer"/>7. <esri:GraphicsLayer id="pointLayer">8. <esri:symbol>9. <esri:SimpleMarkerSymbol color="0xFFFF00"/>10. </esri:symbol>11. </esri:GraphicsLayer>12.</esri:Map>

Page 70: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private function collectionChangeHandler(event:CollectionEvent):void{ switch (event.kind) { case CollectionEventKind.RESET: doReset(event); break; case CollectionEventKind.UPDATE: doUpdate(event); break; }}

Page 71: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private function doReset(event:CollectionEvent):void{ graphicsLayer.clear(); m_graphicsDict = new Dictionary(); for each (var feature:Feature in features) { var graphic:Graphic = new Graphic(feature.geometry, null, feature); graphic.buttonMode = true; graphic.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); graphic.toolTip = String(feature.attributes.coords).replace(" ", "\n"); graphicsLayer.add(graphic); m_graphicsDict[feature.featureId] = graphic; }}

Page 72: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private function doReset(event:CollectionEvent):void{ graphicsLayer.clear(); m_graphicsDict = new Dictionary(); for each (var feature:Feature in features) { var graphic:Graphic = new Graphic(feature.geometry, null, feature); graphic.buttonMode = true; graphic.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); graphic.toolTip = String(feature.attributes.coords).replace(" ", "\n"); graphicsLayer.add(graphic); m_graphicsDict[feature.featureId] = graphic; }}

Page 73: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private function doReset(event:CollectionEvent):void{ graphicsLayer.clear(); m_graphicsDict = new Dictionary(); for each (var feature:Feature in features) { var graphic:Graphic = new Graphic(feature.geometry, null, feature); graphic.buttonMode = true; graphic.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); graphic.toolTip = String(feature.attributes.coords).replace(" ", "\n"); graphicsLayer.add(graphic); m_graphicsDict[feature.featureId] = graphic; }}

Page 74: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private function doUpdate(event:CollectionEvent):void{ for each (var propertyChangeEvent:PropertyChangeEvent in event.items) { var feature:Feature = propertyChangeEvent.target as Feature; if (propertyChangeEvent.property === "geometry") { var graphic:Graphic = m_graphicsDict[feature.featureId]; if (graphic) { graphic.geometry = feature.geometry; } } }}

Page 75: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private function doUpdate(event:CollectionEvent):void{ for each (var propertyChangeEvent:PropertyChangeEvent in event.items) { var feature:Feature = propertyChangeEvent.target as Feature; if (propertyChangeEvent.property === "geometry") { var graphic:Graphic = m_graphicsDict[feature.featureId]; if (graphic) { graphic.geometry = feature.geometry; } } }}

Page 76: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

private function doUpdate(event:CollectionEvent):void{ for each (var propertyChangeEvent:PropertyChangeEvent in event.items) { var feature:Feature = propertyChangeEvent.target as Feature; if (propertyChangeEvent.property === "geometry") { var graphic:Graphic = m_graphicsDict[feature.featureId]; if (graphic) { graphic.geometry = feature.geometry; } } }}

Page 77: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.private function mouseDownHandler(event:MouseEvent):void2.{3. const graphic:Graphic = event.target as Graphic;4. if (graphic)5. {6. m_feature = graphic.attributes as Feature;7. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY);8. pointLayer.add(m_graphic);9. map.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);10. map.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);11. }12.}

14.private function mouseMoveHandler(event:MouseEvent):void15.{16. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY);17. event.updateAfterEvent();18.}

20.private function mouseUpHandler(event:MouseEvent):void21.{22. m_feature.geometry = m_graphic.geometry; // ALL DS FM is Here :-)23. m_feature = null;24. pointLayer.clear();25. map.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);26. map.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);27.}

Page 78: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.private function mouseDownHandler(event:MouseEvent):void2.{3. const graphic:Graphic = event.target as Graphic;4. if (graphic)5. {6. m_feature = graphic.attributes as Feature;7. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY);8. pointLayer.add(m_graphic);9. map.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);10. map.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);11. }12.}

14.private function mouseMoveHandler(event:MouseEvent):void15.{16. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY);17. event.updateAfterEvent();18.}

20.private function mouseUpHandler(event:MouseEvent):void21.{22. m_feature.geometry = m_graphic.geometry; // ALL DS FM is Here :-)23. m_feature = null;24. pointLayer.clear();25. map.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);26. map.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);27.}

Page 79: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.private function mouseDownHandler(event:MouseEvent):void2.{3. const graphic:Graphic = event.target as Graphic;4. if (graphic)5. {6. m_feature = graphic.attributes as Feature;7. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY);8. pointLayer.add(m_graphic);9. map.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);10. map.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);11. }12.}

14.private function mouseMoveHandler(event:MouseEvent):void15.{16. m_graphic.geometry = map.toMapFromStage(event.stageX, event.stageY);17. event.updateAfterEvent();18.}

20.private function mouseUpHandler(event:MouseEvent):void21.{22. m_feature.geometry = m_graphic.geometry; // ALL DS FM is Here :-)23. m_feature = null;24. pointLayer.clear();25. map.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);26. map.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);27.}

Page 80: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Demo CATS

Page 81: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

“Lots” Features

Page 82: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 83: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Spatial Index

Page 84: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Spatial Index

• RTree

• QuadTree

• Grid / Trellis

• Simple

• Efficient (points)

• Good enough !

Page 85: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 86: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

0,0

width,height

Page 87: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

0,0

width,height

Xmin,Ymin

Xmax,Ymax

Page 88: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

0,0

width,height

Xmin,Ymin

Xmax,Ymax

Page 89: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

0,0

width,height

Xmin,Ymin

Xmax,Ymax

Page 90: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

0 1 2 3

0

1

2

3

Cx

Cy

Page 91: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

0 1 2 3

0

1

2

3

(0,0)

(1,3)

(3,2)

(3,2)

Cx

Cy

Page 92: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Cx & Cy > 0 int

Page 93: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Cx & Cy < 216

Page 94: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Dict[(cx<<16)|cy]

Page 95: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Cluster : Geometry

Page 96: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Cluster : Geometry

• Original X

• Original Y

• Cluster X

• Cluster Y

• count

Page 97: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ClusterSymbol : Symbol

Page 98: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ClusterSymbol : Symbol

• Draws a Cluster geometry instance

• Flash drawing API

• beginFill - based on cluster count

• drawRoundedRect - based on Cx,Cy

Page 99: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

DemoDrawSymbol Code

Page 100: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 101: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Adaptive Clustering

Page 102: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Adaptive Clustering

• JIT

• “Smart” algorithm - all client side.

• React to map extent change

Page 103: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 104: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map points

Page 105: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster set

Page 106: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo

Page 107: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters

Page 108: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters for each cluster Ci

Page 109: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters for each cluster Ci

find adjacent clusters Cj

Page 110: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters for each cluster Ci

find adjacent clusters Cj

if Cj is close enough to Ci

Page 111: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters for each cluster Ci

find adjacent clusters Cj

if Cj is close enough to Ci

assign Cj map points to Ci

Page 112: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters for each cluster Ci

find adjacent clusters Cj

if Cj is close enough to Ci

assign Cj map points to Ci

remove Cj from cluster set

Page 113: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters for each cluster Ci

find adjacent clusters Cj

if Cj is close enough to Ci

assign Cj map points to Ci

remove Cj from cluster set adjust Ci location

Page 114: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Given set of map pointsAssign map point to cluster setdo spatial index clusters for each cluster Ci

find adjacent clusters Cj

if Cj is close enough to Ci

assign Cj map points to Ci

remove Cj from cluster set adjust Ci locationrepeat while overlapping clusters exist

Page 115: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Adjusting Ci location

Page 116: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Adjusting Ci location

Ci

Wi

Page 117: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Adjusting Ci location

Ci

Wi

Cj

Wj

Page 118: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Adjusting Ci location

Ci

Wi

Cj

Wj

Page 119: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Adjusting Ci location

Wi+Wj

Ci=(Ci Wi+CjWj)/WiWj

Page 120: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

DemoClusterApp

Page 121: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 122: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

HeatMaps are Bitmaps !

Page 123: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<?xml version="1.0" encoding="utf-8"?>2.<view:PrepApplication3. xmlns:mx="http://www.adobe.com/2006/mxml"4. xmlns:esri="http://www.esri.com/2008/ags"5. xmlns:controller="com.esri.controller.*"6. xmlns:view="com.esri.view.*"7. layout="vertical"8. paddingLeft="0"9. paddingRight="0"10. paddingTop="0"11. paddingBottom="0"12. >13. <controller:LoadCommand/>14. <view:PrepSlider/>15. <view:PrepMap>16. <view:extent>17. <esri:Extent xmin="-143.141073" ymin="14.930875" xmax="-48.0570833" ymax="57.649769"/>18. </view:extent>19. <esri:ArcGISTiledMapServiceLayer20. url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>21. <view:PrepLayer/> 22. </view:PrepMap>23.</view:PrepApplication>

Page 124: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.<?xml version="1.0" encoding="utf-8"?>2.<view:PrepApplication3. xmlns:mx="http://www.adobe.com/2006/mxml"4. xmlns:esri="http://www.esri.com/2008/ags"5. xmlns:controller="com.esri.controller.*"6. xmlns:view="com.esri.view.*"7. layout="vertical"8. paddingLeft="0"9. paddingRight="0"10. paddingTop="0"11. paddingBottom="0"12. >13. <controller:LoadCommand/>14. <view:PrepSlider/>15. <view:PrepMap>16. <view:extent>17. <esri:Extent xmin="-143.141073" ymin="14.930875" xmax="-48.0570833" ymax="57.649769"/>18. </view:extent>19. <esri:ArcGISTiledMapServiceLayer20. url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer"/>21. <view:PrepLayer/> 22. </view:PrepMap>23.</view:PrepApplication>

Page 125: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

PrepLayer : Layer

Page 126: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

PrepLayer : Layer

• Subclass Layer

• Override updateLayer

• Invoked by updateDisplayList

• create bitmap - lock/unlock

• bitmap.fillRect each heat map point

• graphic.bitmapFill / drawRect

Page 127: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

PrepLayer

Page 128: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

PrepLayer

• Kept data in 2 arrays

• x = []

• y = []

• Easy to AMF

• toScreenX/Y built-in functions

Page 129: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

DemoPrecipitationApp

Page 130: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!
Page 131: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Street Tracing

Page 132: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Street Tracing

• A*

• Create nodes and edges

• Define barriers

• Reverse geocoding

• Custom layer - faster rendering

Page 133: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

A* / Path Finding

Page 134: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Streets

Page 135: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Streets

Page 136: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

“Street” Graph

Page 137: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

“Street” Graph

• Intersection - nodes

• Street Segment - edge

• Travel distance or time - cost

Page 138: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Nodes/Edges/Barriers

Page 139: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Nodes/Edges/Barriers

A

B

C

D

E

Page 140: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Nodes/Edges/Barriers

A

B

C

D

E

Page 141: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Nodes/Edges/Barriers

A

B

C

D

E

Page 142: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Street Info

Main St

Page 143: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Street Info

Main St

100

200

Page 144: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Street Info

Main St

100101

200199

Page 145: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ReverseGeocoding

Page 146: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ReverseGeocoding

Main StLeft 100-200Right 101-199

Page 147: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ReverseGeocoding

t

Main StLeft 100-200Right 101-199

Page 148: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ReverseGeocoding

t

Main StLeft 100-200Right 101-199

Page 149: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ReverseGeocoding

dt

Main StLeft 100-200Right 101-199

Page 150: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

ReverseGeocoding

dt

Main StLeft 100-200Right 101-199

153 Main St

Page 151: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

Page 152: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

A

B

C

Page 153: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

A

B

C

P

Page 154: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

A

B

C

Pr

r=AC AB•

∣AB∣2

Page 155: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

A

B

C

Pr

r=AC AB•

∣AB∣2

r≺0 beyond A ↤

Page 156: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

A

B

C

Pr

r=AC AB•

∣AB∣2

r≺0 beyond A ↤r≻0 beyond B ↦

Page 157: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

Ax Bx Cx

Ay By Cy

12

A=

A

B

C

Pr

r=AC AB•

∣AB∣2

r≺0 beyond A ↤r≻0 beyond B ↦

Page 158: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

Ax Bx Cx

Ay By Cy

12

A=

A

B

C

height

Pr

r=AC AB•

∣AB∣2

r≺0 beyond A ↤r≻0 beyond B ↦

Page 159: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

Ax Bx Cx

Ay By Cy

12

A=

A

B

C

base

height

Pr

r=AC AB•

∣AB∣2

r≺0 beyond A ↤r≻0 beyond B ↦

Page 160: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

A=base×height

2

Ax Bx Cx

Ay By Cy

12

A=

A

B

C

base

height

Pr

r=AC AB•

∣AB∣2

r≺0 beyond A ↤r≻0 beyond B ↦

Page 161: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

Distance Calculations

A=base×height

2

Ax Bx Cx

Ay By Cy

12

A=

A

B

C

base

height

Pr

r=AC AB•

∣AB∣2

r≺0 beyond A ↤r≻0 beyond B ↦

AP=rAB

Page 162: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.override protected function updateLayer():void{2. const model:Model = Model.instance;3. graphics.clear();4. graphics.lineStyle(1, 0);5. model.streetGrid.search(map.extent, streetHandler);6.}

8.private function streetHandler(street:Street, data:Object = null):void{9. for each(var path:Array in street.shpPolyline.paths){10. var index:int = 0;11. var lastX:Number = toScreenX(path[index++]);12. var lastY:Number = toScreenY(path[index++]);13. graphics.moveTo(lastX, lastY);14. while(index < path.length){15. var currX:Number = toScreenX(path[index++]);16. var currY:Number = toScreenY(path[index++]);17. if( currX !== lastX || currY !== lastY){18. graphics.lineTo(currX, currY);19. lastX = currX;20. lastY = currY; 21. }22. }23. }24.}

Page 163: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.override protected function updateLayer():void{2. const model:Model = Model.instance;3. graphics.clear();4. graphics.lineStyle(1, 0);5. model.streetGrid.search(map.extent, streetHandler);6.}

8.private function streetHandler(street:Street, data:Object = null):void{9. for each(var path:Array in street.shpPolyline.paths){10. var index:int = 0;11. var lastX:Number = toScreenX(path[index++]);12. var lastY:Number = toScreenY(path[index++]);13. graphics.moveTo(lastX, lastY);14. while(index < path.length){15. var currX:Number = toScreenX(path[index++]);16. var currY:Number = toScreenY(path[index++]);17. if( currX !== lastX || currY !== lastY){18. graphics.lineTo(currX, currY);19. lastX = currX;20. lastY = currY; 21. }22. }23. }24.}

Page 164: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.override protected function updateLayer():void{2. const model:Model = Model.instance;3. graphics.clear();4. graphics.lineStyle(1, 0);5. model.streetGrid.search(map.extent, streetHandler);6.}

8.private function streetHandler(street:Street, data:Object = null):void{9. for each(var path:Array in street.shpPolyline.paths){10. var index:int = 0;11. var lastX:Number = toScreenX(path[index++]);12. var lastY:Number = toScreenY(path[index++]);13. graphics.moveTo(lastX, lastY);14. while(index < path.length){15. var currX:Number = toScreenX(path[index++]);16. var currY:Number = toScreenY(path[index++]);17. if( currX !== lastX || currY !== lastY){18. graphics.lineTo(currX, currY);19. lastX = currX;20. lastY = currY; 21. }22. }23. }24.}

Page 165: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.override protected function updateLayer():void{2. const model:Model = Model.instance;3. graphics.clear();4. graphics.lineStyle(1, 0);5. model.streetGrid.search(map.extent, streetHandler);6.}

8.private function streetHandler(street:Street, data:Object = null):void{9. for each(var path:Array in street.shpPolyline.paths){10. var index:int = 0;11. var lastX:Number = toScreenX(path[index++]);12. var lastY:Number = toScreenY(path[index++]);13. graphics.moveTo(lastX, lastY);14. while(index < path.length){15. var currX:Number = toScreenX(path[index++]);16. var currY:Number = toScreenY(path[index++]);17. if( currX !== lastX || currY !== lastY){18. graphics.lineTo(currX, currY);19. lastX = currX;20. lastY = currY; 21. }22. }23. }24.}

Page 166: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.override protected function updateLayer():void{2. const model:Model = Model.instance;3. graphics.clear();4. graphics.lineStyle(1, 0);5. model.streetGrid.search(map.extent, streetHandler);6.}

8.private function streetHandler(street:Street, data:Object = null):void{9. for each(var path:Array in street.shpPolyline.paths){10. var index:int = 0;11. var lastX:Number = toScreenX(path[index++]);12. var lastY:Number = toScreenY(path[index++]);13. graphics.moveTo(lastX, lastY);14. while(index < path.length){15. var currX:Number = toScreenX(path[index++]);16. var currY:Number = toScreenY(path[index++]);17. if( currX !== lastX || currY !== lastY){18. graphics.lineTo(currX, currY);19. lastX = currX;20. lastY = currY; 21. }22. }23. }24.}

Page 167: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

1.override protected function updateLayer():void{2. const model:Model = Model.instance;3. graphics.clear();4. graphics.lineStyle(1, 0);5. model.streetGrid.search(map.extent, streetHandler);6.}

8.private function streetHandler(street:Street, data:Object = null):void{9. for each(var path:Array in street.shpPolyline.paths){10. var index:int = 0;11. var lastX:Number = toScreenX(path[index++]);12. var lastY:Number = toScreenY(path[index++]);13. graphics.moveTo(lastX, lastY);14. while(index < path.length){15. var currX:Number = toScreenX(path[index++]);16. var currY:Number = toScreenY(path[index++]);17. if( currX !== lastX || currY !== lastY){18. graphics.lineTo(currX, currY);19. lastX = currX;20. lastY = currY; 21. }22. }23. }24.}

Page 168: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

DemoStreetTrace

Page 169: Mansour Raad & Anthony Jayaprakash - Yet Another Mapping Framework, NOT!

When Will I Use This ?