Yes, it is lat and long. Out is the output point which should get updated
during the projection.

Thanks,
Om
On Jan 13, 2016 3:10 AM, "Deepak MS" <megharajdee...@gmail.com> wrote:

> Thanks Om.
>
> I tried that library with following code:
>             var mc:MercatorProjection = new MercatorProjection();
>             for(var i:int = 0; i < a.length; i++) // a here is array of
> arrays - [ [ 151.25, -33.74 ],[ 151.25, -33.74 ] ......]
>            {
>                 var ltlg:Array = a[i];
>                 var p:Point = mc.project(ltlg[0],ltlg[1], new Point());
>                 //p.x will always be same as lat value - 151.25 and p.y
> will always be NaN
>
>             }
>
> I looked at MercatorProjection.project() method:
> override public function project(lam:Number, phi:Number, out:Point):Point
>         {
>             if (spherical) {   //spherical = false
>                 out.x = scaleFactor * lam;  //scaleFactor  = 1
>                 out.y = scaleFactor * Math.log(Math.tan(MapMath.QUARTERPI +
> 0.5 * phi));
>             } else {
>                 out.x = scaleFactor * lam;
>                 out.y = -scaleFactor * Math.log(MapMath.tsfn(phi,
> Math.sin(phi), e));
>             }
>             return out;
>         }
>
> I'm not sure what Iam, phi and out parameters are. I assumed Iam is lat and
> phi would be lng. out is used to return the value. I don't know why is it
> an input parameter here as out itself is the return value.
>
> Am I passing lat, lng values correctly to project() ?
>
>
>
>
> On Wed, Jan 13, 2016 at 1:09 PM, OmPrakash Muppirala <bigosma...@gmail.com
> >
> wrote:
>
> > Moving thread to dev@.  Users@ in bcc in case someone else is interested
> > in
> > this.
> >
> > The d in the path node is a stringified set of points which are connected
> > by lines.  M is for moveTo, L is for lineTo and Z signifies closing the
> > path back to the first point.
> >
> > Each country (or region) has its own shape which is denoted by the d
> > string.  The series of path objects is sufficient to draw all the
> countries
> > using a stroke and a fill.
> >
> > Looking at your coordinates, it looks like a closed polygon.
> > You might want to try to use Mercator projection to project the lat long
> > coordinates to cartesian coordinates.
> > Here is a very straightforward implementation of this in AS3:
> > *
> >
> https://bitbucket.org/gka/as3-proj/src/ec91cdd098a15ab1e2cbf5bbd3a3221a36507685/net/vis4/map/proj/MercatorProjection.as?at=default&fileviewer=file-view-default
> > <
> >
> https://bitbucket.org/gka/as3-proj/src/ec91cdd098a15ab1e2cbf5bbd3a3221a36507685/net/vis4/map/proj/MercatorProjection.as?at=default&fileviewer=file-view-default
> > >*
> >
> > Basically for each lat/long co-ordinate in your 'coordinates' array, call
> > MercatorProjection.project(), which should give you a Point object.  Use
> > these series of Points to draw a shape, which represents your
> State/region.
> >
> > Do let me know if you need any further help
> >
> > Thanks,
> > Om
> > On Jan 12, 2016 10:06 PM, "Deepak MS" <megharajdee...@gmail.com> wrote:
> >
> > > Moving following conversation to this separate thread.
> > >
> > >
> > >
> >
> http://apache-flex-development.2333347.n4.nabble.com/FlexJS-US-States-Map-example-pure-AS3-td48006.html
> > >
> > > Hi Om,
> > > I had one question.
> > > I could see the following path in the worldmap.xml file:
> > > <path fill="#CEE3F5" stroke="#6E6E6E" stroke-width="0.4" id="UM"
> > >         d="M25.4,206.4 L25.4,206.4 L25.3,206.4 L25.4,206.4 Z">
> > >         <desc>
> > >             <name>United States Minor Outlying Islands</name>
> > >             <labelrank>5</labelrank>
> > >             <country-abbrev>U.S. MOI</country-abbrev>
> > >             <subregion>Seven seas (open ocean)</subregion>
> > >             <region-wb>East Asia &amp; Pacific</region-wb>
> > >             <iso-a3>UMI</iso-a3>
> > >             <iso-a2>UM</iso-a2>
> > >             <woe-id>28289407</woe-id>
> > >             <continent>North America</continent>
> > >             <hc-middle-x>0.57</hc-middle-x>
> > >             <hc-middle-y>0.58</hc-middle-y>
> > >             <hc-key>um</hc-key>
> > >             <hc-a2>UM</hc-a2>
> > >         </desc>
> > >     </path>
> > >
> > > What is the path data in there?
> > >
> > > I would be getting the boundary data in form of geojson which would
> have
> > > latitude\longitude points. Something like this:
> > >
> > > { "type": "Feature", "properties": { "BrickCode_": "21000", "State":
> > "NSW",
> > > "ML_Code": "ML108" }, "geometry": { "type": "Polygon", "coordinates": [
> > [ [
> > > 151.25715360000004, -33.743317043500042 ], [ 151.25985827199997,
> > > -33.743840223500001 ], [ 151.26121619200012, -33.74746011849993 ], [
> > > 151.269228, -33.74990100849999 ], [ 151.26887100800002,
> > -33.757243991500047
> > > ], [ 151.27524460799998, -33.756977721 ], [ 151.28052790400011,
> > > -33.75872719199981 ], [ 151.27875936, -33.768415808499981 ], [
> > > 151.27282256000012, -33.767621917999975 ], [ 151.27024985600008,
> > > -33.77462350199994 ], [ 151.27552054400007, -33.779516363499738 ], [
> > > 151.27530051200017, -33.781854430499834 ], [ 151.26530544000002,
> > > -33.780174667499921 ], [ 151.26095520000001, -33.777029796999898 ], [
> > > 151.259648416, -33.779054695999776 ], [ 151.25597475200004,
> > > -33.779087477999894 ], [ 151.25556144000006, -33.783829046499761 ], [
> > > 151.24337900800003, -33.781951999499825 ], [ 151.23829500800002,
> > > -33.778761008499828 ], [ 151.23245721600017, -33.762912705999895 ], [
> > > 151.23388588800003, -33.754605225500029 ], [ 151.24911699200015,
> > > -33.756704993999904 ], [ 151.24983971200004, -33.752049450499953 ], [
> > > 151.24830732800024, -33.751826433000019 ], [ 151.24833936000005,
> > > -33.748172997499921 ], [ 151.25159628799997, -33.74994213399998 ], [
> > > 151.25054374400008, -33.746457899499944 ], [ 151.25377328000013,
> > > -33.746925597999962 ], [ 151.25369952000005, -33.74283635799992 ], [
> > > 151.25715360000004, -33.743317043500042 ] ] ] } }
> > >
> > > I'm sure that we cannot use lat\lng points directly in path data. But I
> > > want to know based on what can we convert these data points to path
> data.
> > >
> >
>

Reply via email to