You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Deepak MS <me...@gmail.com> on 2016/01/13 07:06:10 UTC

[Flex] Map Component

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.

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Hmm this looks like a big in the mapping component, and probably not just
the AS3 version.   I think contacting the Modest Map folks might be the
best option.

Thanks,
Om
On Jan 19, 2016 10:38 PM, "Deepak MS" <me...@gmail.com> wrote:

> Nope. Zoom value is 4 and this is how it's shown on load(which is as
> intended):
> http://snag.gy/VzeMN.jpg
>
> But still those highlighted regions(Island towards left of Alaska) are
> drawn on right side(another instance) of the map.
>
> I thought extent would create the boundary that we would need. Shouldn't
> it?
>
> On Wed, Jan 20, 2016 at 11:40 AM, OmPrakash Muppirala <
> bigosmallm@gmail.com>
> wrote:
>
> > Does it have to be zoomed out so much?  If you zoom in a bit,  I think
> this
> > issue will get fixed.
> >
> > Thanks,
> > Om
> > On Jan 19, 2016 10:04 PM, "Deepak MS" <me...@gmail.com> wrote:
> >
> > > Is there any option to avoid multiple instances of the map? I did try
> > using
> > > extent
> > >
> > > var et:MapExtent = new MapExtent(90, -90, 180, -180);
> > >               //  myMap.map.setExtent(et);
> > >                 myMap.extent = et;
> > >
> > > But there is no change in the map.
> > >
> > > The problem is, for US map, some part gets drawn on one instance and
> rest
> > > of the part gets drawn on another instance of the map.
> > >
> > > Screen shot for reference. Here, 'B' needs to be in 'A's location.
> > > http://snag.gy/43s6a.jpg
> > >
> > >
> > >
> > > On Tue, Jan 19, 2016 at 10:24 PM, Deepak MS <me...@gmail.com>
> > > wrote:
> > >
> > > > Well, I tried earlier approach for 4 days, but it didn't quite work
> as
> > > > expected. Entire map needs to be rendered using svg alone or based on
> > > > long/lat points. Its difficult to merge lat/long based custom regions
> > > over
> > > > svg.
> > > >
> > > > But modestmap worked well. Thank you so much for sharing those links.
> > > > On 15 Jan 2016 1:31 am, "OmPrakash Muppirala" <bi...@gmail.com>
> > > > wrote:
> > > >
> > > >> Also, if you have not already seen it, ModestMaps has a pretty cool
> > AS3
> > > >> implementation.
> > > >>
> > > >> https://github.com/migurski/modestmaps-as3
> > > >>
> > > >> I have used it for desktop, web and iOS apps.  You can draw markers,
> > > >> polygons etc. just like you would on google maps.
> > > >>
> > > >> If you dont have a lot of success figuring out the earlier approach,
> > see
> > > >> if
> > > >> this works.
> > > >>
> > > >> There is a Flex wrapper for this as well:
> > > >> https://github.com/igorcosta/flex-maps
> > > >>
> > > >> Thanks,
> > > >> Om
> > > >>
> > > >> On Thu, Jan 14, 2016 at 11:55 AM, OmPrakash Muppirala <
> > > >> bigosmallm@gmail.com>
> > > >> wrote:
> > > >>
> > > >> > Cool.  I see the UK map rendering fine.
> > > >> >
> > > >> > The next step is to figure out why the co-ordinates are not
> > rendering.
> > > >> > The key is to get the correct projection.  I am pretty sure
> GeoJSON
> > > >> > co-ordinates are in Mercator projection.
> > > >> >
> > > >> > Here is a nice article that seems to be solving a similar problem.
> > > See
> > > >> if
> > > >> > this helps:
> > > >> > http://mikefowler.me/2014/06/10/drawing-geojson-in-a-canvas/
> > > >> >
> > > >> > Thanks,
> > > >> > Om
> > > >> >
> > > >> > On Wed, Jan 13, 2016 at 9:59 PM, Deepak MS <
> > megharajdeepak@gmail.com>
> > > >> > wrote:
> > > >> >
> > > >> >> Oh I really didn't knew that those values are swapped. Generally
> it
> > > >> would
> > > >> >> be lat\lng. Sorry for that. That was a sample data I got from the
> > > team
> > > >> and
> > > >> >> yes that is Oz data(NSW boundary).
> > > >> >>
> > > >> >> Anyway, to make it simple. I have created a project including the
> > > >> library:
> > > >> >>
> > > >>
> > >
> http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip
> > > >> >>
> > > >> >> It has data which is a rectangular region surrounding London.
> > > >> >>
> > > >> >> We can get lat\lng points of custom regions here(by drawing
> > > >> >> circles\rectangles\lines on the map):
> > > >> >> http://geojson.io/
> > > >> >>
> > > >> >> In attached code, UK map gets plotted, only thing now is to
> > > >> draw\highlight
> > > >> >> region on top of the map based on the lat\long data.
> > > >> >>
> > > >> >
> > > >> >
> > > >>
> > > >
> > >
> >
>

Re: [Flex] Map Component

Posted by Deepak MS <me...@gmail.com>.
Nope. Zoom value is 4 and this is how it's shown on load(which is as
intended):
http://snag.gy/VzeMN.jpg

But still those highlighted regions(Island towards left of Alaska) are
drawn on right side(another instance) of the map.

I thought extent would create the boundary that we would need. Shouldn't it?

On Wed, Jan 20, 2016 at 11:40 AM, OmPrakash Muppirala <bi...@gmail.com>
wrote:

> Does it have to be zoomed out so much?  If you zoom in a bit,  I think this
> issue will get fixed.
>
> Thanks,
> Om
> On Jan 19, 2016 10:04 PM, "Deepak MS" <me...@gmail.com> wrote:
>
> > Is there any option to avoid multiple instances of the map? I did try
> using
> > extent
> >
> > var et:MapExtent = new MapExtent(90, -90, 180, -180);
> >               //  myMap.map.setExtent(et);
> >                 myMap.extent = et;
> >
> > But there is no change in the map.
> >
> > The problem is, for US map, some part gets drawn on one instance and rest
> > of the part gets drawn on another instance of the map.
> >
> > Screen shot for reference. Here, 'B' needs to be in 'A's location.
> > http://snag.gy/43s6a.jpg
> >
> >
> >
> > On Tue, Jan 19, 2016 at 10:24 PM, Deepak MS <me...@gmail.com>
> > wrote:
> >
> > > Well, I tried earlier approach for 4 days, but it didn't quite work as
> > > expected. Entire map needs to be rendered using svg alone or based on
> > > long/lat points. Its difficult to merge lat/long based custom regions
> > over
> > > svg.
> > >
> > > But modestmap worked well. Thank you so much for sharing those links.
> > > On 15 Jan 2016 1:31 am, "OmPrakash Muppirala" <bi...@gmail.com>
> > > wrote:
> > >
> > >> Also, if you have not already seen it, ModestMaps has a pretty cool
> AS3
> > >> implementation.
> > >>
> > >> https://github.com/migurski/modestmaps-as3
> > >>
> > >> I have used it for desktop, web and iOS apps.  You can draw markers,
> > >> polygons etc. just like you would on google maps.
> > >>
> > >> If you dont have a lot of success figuring out the earlier approach,
> see
> > >> if
> > >> this works.
> > >>
> > >> There is a Flex wrapper for this as well:
> > >> https://github.com/igorcosta/flex-maps
> > >>
> > >> Thanks,
> > >> Om
> > >>
> > >> On Thu, Jan 14, 2016 at 11:55 AM, OmPrakash Muppirala <
> > >> bigosmallm@gmail.com>
> > >> wrote:
> > >>
> > >> > Cool.  I see the UK map rendering fine.
> > >> >
> > >> > The next step is to figure out why the co-ordinates are not
> rendering.
> > >> > The key is to get the correct projection.  I am pretty sure GeoJSON
> > >> > co-ordinates are in Mercator projection.
> > >> >
> > >> > Here is a nice article that seems to be solving a similar problem.
> > See
> > >> if
> > >> > this helps:
> > >> > http://mikefowler.me/2014/06/10/drawing-geojson-in-a-canvas/
> > >> >
> > >> > Thanks,
> > >> > Om
> > >> >
> > >> > On Wed, Jan 13, 2016 at 9:59 PM, Deepak MS <
> megharajdeepak@gmail.com>
> > >> > wrote:
> > >> >
> > >> >> Oh I really didn't knew that those values are swapped. Generally it
> > >> would
> > >> >> be lat\lng. Sorry for that. That was a sample data I got from the
> > team
> > >> and
> > >> >> yes that is Oz data(NSW boundary).
> > >> >>
> > >> >> Anyway, to make it simple. I have created a project including the
> > >> library:
> > >> >>
> > >>
> > http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip
> > >> >>
> > >> >> It has data which is a rectangular region surrounding London.
> > >> >>
> > >> >> We can get lat\lng points of custom regions here(by drawing
> > >> >> circles\rectangles\lines on the map):
> > >> >> http://geojson.io/
> > >> >>
> > >> >> In attached code, UK map gets plotted, only thing now is to
> > >> draw\highlight
> > >> >> region on top of the map based on the lat\long data.
> > >> >>
> > >> >
> > >> >
> > >>
> > >
> >
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Does it have to be zoomed out so much?  If you zoom in a bit,  I think this
issue will get fixed.

Thanks,
Om
On Jan 19, 2016 10:04 PM, "Deepak MS" <me...@gmail.com> wrote:

> Is there any option to avoid multiple instances of the map? I did try using
> extent
>
> var et:MapExtent = new MapExtent(90, -90, 180, -180);
>               //  myMap.map.setExtent(et);
>                 myMap.extent = et;
>
> But there is no change in the map.
>
> The problem is, for US map, some part gets drawn on one instance and rest
> of the part gets drawn on another instance of the map.
>
> Screen shot for reference. Here, 'B' needs to be in 'A's location.
> http://snag.gy/43s6a.jpg
>
>
>
> On Tue, Jan 19, 2016 at 10:24 PM, Deepak MS <me...@gmail.com>
> wrote:
>
> > Well, I tried earlier approach for 4 days, but it didn't quite work as
> > expected. Entire map needs to be rendered using svg alone or based on
> > long/lat points. Its difficult to merge lat/long based custom regions
> over
> > svg.
> >
> > But modestmap worked well. Thank you so much for sharing those links.
> > On 15 Jan 2016 1:31 am, "OmPrakash Muppirala" <bi...@gmail.com>
> > wrote:
> >
> >> Also, if you have not already seen it, ModestMaps has a pretty cool AS3
> >> implementation.
> >>
> >> https://github.com/migurski/modestmaps-as3
> >>
> >> I have used it for desktop, web and iOS apps.  You can draw markers,
> >> polygons etc. just like you would on google maps.
> >>
> >> If you dont have a lot of success figuring out the earlier approach, see
> >> if
> >> this works.
> >>
> >> There is a Flex wrapper for this as well:
> >> https://github.com/igorcosta/flex-maps
> >>
> >> Thanks,
> >> Om
> >>
> >> On Thu, Jan 14, 2016 at 11:55 AM, OmPrakash Muppirala <
> >> bigosmallm@gmail.com>
> >> wrote:
> >>
> >> > Cool.  I see the UK map rendering fine.
> >> >
> >> > The next step is to figure out why the co-ordinates are not rendering.
> >> > The key is to get the correct projection.  I am pretty sure GeoJSON
> >> > co-ordinates are in Mercator projection.
> >> >
> >> > Here is a nice article that seems to be solving a similar problem.
> See
> >> if
> >> > this helps:
> >> > http://mikefowler.me/2014/06/10/drawing-geojson-in-a-canvas/
> >> >
> >> > Thanks,
> >> > Om
> >> >
> >> > On Wed, Jan 13, 2016 at 9:59 PM, Deepak MS <me...@gmail.com>
> >> > wrote:
> >> >
> >> >> Oh I really didn't knew that those values are swapped. Generally it
> >> would
> >> >> be lat\lng. Sorry for that. That was a sample data I got from the
> team
> >> and
> >> >> yes that is Oz data(NSW boundary).
> >> >>
> >> >> Anyway, to make it simple. I have created a project including the
> >> library:
> >> >>
> >>
> http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip
> >> >>
> >> >> It has data which is a rectangular region surrounding London.
> >> >>
> >> >> We can get lat\lng points of custom regions here(by drawing
> >> >> circles\rectangles\lines on the map):
> >> >> http://geojson.io/
> >> >>
> >> >> In attached code, UK map gets plotted, only thing now is to
> >> draw\highlight
> >> >> region on top of the map based on the lat\long data.
> >> >>
> >> >
> >> >
> >>
> >
>

Re: [Flex] Map Component

Posted by Deepak MS <me...@gmail.com>.
Is there any option to avoid multiple instances of the map? I did try using
extent

var et:MapExtent = new MapExtent(90, -90, 180, -180);
              //  myMap.map.setExtent(et);
                myMap.extent = et;

But there is no change in the map.

The problem is, for US map, some part gets drawn on one instance and rest
of the part gets drawn on another instance of the map.

Screen shot for reference. Here, 'B' needs to be in 'A's location.
http://snag.gy/43s6a.jpg



On Tue, Jan 19, 2016 at 10:24 PM, Deepak MS <me...@gmail.com>
wrote:

> Well, I tried earlier approach for 4 days, but it didn't quite work as
> expected. Entire map needs to be rendered using svg alone or based on
> long/lat points. Its difficult to merge lat/long based custom regions over
> svg.
>
> But modestmap worked well. Thank you so much for sharing those links.
> On 15 Jan 2016 1:31 am, "OmPrakash Muppirala" <bi...@gmail.com>
> wrote:
>
>> Also, if you have not already seen it, ModestMaps has a pretty cool AS3
>> implementation.
>>
>> https://github.com/migurski/modestmaps-as3
>>
>> I have used it for desktop, web and iOS apps.  You can draw markers,
>> polygons etc. just like you would on google maps.
>>
>> If you dont have a lot of success figuring out the earlier approach, see
>> if
>> this works.
>>
>> There is a Flex wrapper for this as well:
>> https://github.com/igorcosta/flex-maps
>>
>> Thanks,
>> Om
>>
>> On Thu, Jan 14, 2016 at 11:55 AM, OmPrakash Muppirala <
>> bigosmallm@gmail.com>
>> wrote:
>>
>> > Cool.  I see the UK map rendering fine.
>> >
>> > The next step is to figure out why the co-ordinates are not rendering.
>> > The key is to get the correct projection.  I am pretty sure GeoJSON
>> > co-ordinates are in Mercator projection.
>> >
>> > Here is a nice article that seems to be solving a similar problem.  See
>> if
>> > this helps:
>> > http://mikefowler.me/2014/06/10/drawing-geojson-in-a-canvas/
>> >
>> > Thanks,
>> > Om
>> >
>> > On Wed, Jan 13, 2016 at 9:59 PM, Deepak MS <me...@gmail.com>
>> > wrote:
>> >
>> >> Oh I really didn't knew that those values are swapped. Generally it
>> would
>> >> be lat\lng. Sorry for that. That was a sample data I got from the team
>> and
>> >> yes that is Oz data(NSW boundary).
>> >>
>> >> Anyway, to make it simple. I have created a project including the
>> library:
>> >>
>> http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip
>> >>
>> >> It has data which is a rectangular region surrounding London.
>> >>
>> >> We can get lat\lng points of custom regions here(by drawing
>> >> circles\rectangles\lines on the map):
>> >> http://geojson.io/
>> >>
>> >> In attached code, UK map gets plotted, only thing now is to
>> draw\highlight
>> >> region on top of the map based on the lat\long data.
>> >>
>> >
>> >
>>
>

Re: [Flex] Map Component

Posted by Deepak MS <me...@gmail.com>.
Well, I tried earlier approach for 4 days, but it didn't quite work as
expected. Entire map needs to be rendered using svg alone or based on
long/lat points. Its difficult to merge lat/long based custom regions over
svg.

But modestmap worked well. Thank you so much for sharing those links.
On 15 Jan 2016 1:31 am, "OmPrakash Muppirala" <bi...@gmail.com> wrote:

> Also, if you have not already seen it, ModestMaps has a pretty cool AS3
> implementation.
>
> https://github.com/migurski/modestmaps-as3
>
> I have used it for desktop, web and iOS apps.  You can draw markers,
> polygons etc. just like you would on google maps.
>
> If you dont have a lot of success figuring out the earlier approach, see if
> this works.
>
> There is a Flex wrapper for this as well:
> https://github.com/igorcosta/flex-maps
>
> Thanks,
> Om
>
> On Thu, Jan 14, 2016 at 11:55 AM, OmPrakash Muppirala <
> bigosmallm@gmail.com>
> wrote:
>
> > Cool.  I see the UK map rendering fine.
> >
> > The next step is to figure out why the co-ordinates are not rendering.
> > The key is to get the correct projection.  I am pretty sure GeoJSON
> > co-ordinates are in Mercator projection.
> >
> > Here is a nice article that seems to be solving a similar problem.  See
> if
> > this helps:
> > http://mikefowler.me/2014/06/10/drawing-geojson-in-a-canvas/
> >
> > Thanks,
> > Om
> >
> > On Wed, Jan 13, 2016 at 9:59 PM, Deepak MS <me...@gmail.com>
> > wrote:
> >
> >> Oh I really didn't knew that those values are swapped. Generally it
> would
> >> be lat\lng. Sorry for that. That was a sample data I got from the team
> and
> >> yes that is Oz data(NSW boundary).
> >>
> >> Anyway, to make it simple. I have created a project including the
> library:
> >>
> http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip
> >>
> >> It has data which is a rectangular region surrounding London.
> >>
> >> We can get lat\lng points of custom regions here(by drawing
> >> circles\rectangles\lines on the map):
> >> http://geojson.io/
> >>
> >> In attached code, UK map gets plotted, only thing now is to
> draw\highlight
> >> region on top of the map based on the lat\long data.
> >>
> >
> >
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Also, if you have not already seen it, ModestMaps has a pretty cool AS3
implementation.

https://github.com/migurski/modestmaps-as3

I have used it for desktop, web and iOS apps.  You can draw markers,
polygons etc. just like you would on google maps.

If you dont have a lot of success figuring out the earlier approach, see if
this works.

There is a Flex wrapper for this as well:
https://github.com/igorcosta/flex-maps

Thanks,
Om

On Thu, Jan 14, 2016 at 11:55 AM, OmPrakash Muppirala <bi...@gmail.com>
wrote:

> Cool.  I see the UK map rendering fine.
>
> The next step is to figure out why the co-ordinates are not rendering.
> The key is to get the correct projection.  I am pretty sure GeoJSON
> co-ordinates are in Mercator projection.
>
> Here is a nice article that seems to be solving a similar problem.  See if
> this helps:
> http://mikefowler.me/2014/06/10/drawing-geojson-in-a-canvas/
>
> Thanks,
> Om
>
> On Wed, Jan 13, 2016 at 9:59 PM, Deepak MS <me...@gmail.com>
> wrote:
>
>> Oh I really didn't knew that those values are swapped. Generally it would
>> be lat\lng. Sorry for that. That was a sample data I got from the team and
>> yes that is Oz data(NSW boundary).
>>
>> Anyway, to make it simple. I have created a project including the library:
>> http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip
>>
>> It has data which is a rectangular region surrounding London.
>>
>> We can get lat\lng points of custom regions here(by drawing
>> circles\rectangles\lines on the map):
>> http://geojson.io/
>>
>> In attached code, UK map gets plotted, only thing now is to draw\highlight
>> region on top of the map based on the lat\long data.
>>
>
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Cool.  I see the UK map rendering fine.

The next step is to figure out why the co-ordinates are not rendering.  The
key is to get the correct projection.  I am pretty sure GeoJSON
co-ordinates are in Mercator projection.

Here is a nice article that seems to be solving a similar problem.  See if
this helps:
http://mikefowler.me/2014/06/10/drawing-geojson-in-a-canvas/

Thanks,
Om

On Wed, Jan 13, 2016 at 9:59 PM, Deepak MS <me...@gmail.com> wrote:

> Oh I really didn't knew that those values are swapped. Generally it would
> be lat\lng. Sorry for that. That was a sample data I got from the team and
> yes that is Oz data(NSW boundary).
>
> Anyway, to make it simple. I have created a project including the library:
> http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip
>
> It has data which is a rectangular region surrounding London.
>
> We can get lat\lng points of custom regions here(by drawing
> circles\rectangles\lines on the map):
> http://geojson.io/
>
> In attached code, UK map gets plotted, only thing now is to draw\highlight
> region on top of the map based on the lat\long data.
>

Re: [Flex] Map Component

Posted by Deepak MS <me...@gmail.com>.
Oh I really didn't knew that those values are swapped. Generally it would
be lat\lng. Sorry for that. That was a sample data I got from the team and
yes that is Oz data(NSW boundary).

Anyway, to make it simple. I have created a project including the library:
http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip

It has data which is a rectangular region surrounding London.

We can get lat\lng points of custom regions here(by drawing
circles\rectangles\lines on the map):
http://geojson.io/

In attached code, UK map gets plotted, only thing now is to draw\highlight
region on top of the map based on the lat\long data.

Re: [Flex] Map Component

Posted by megharajdeepak <me...@gmail.com>.
StaticMap.zip
<http://apache-flex-users.2333346.n4.nabble.com/file/n11744/StaticMap.zip>  



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-Map-Component-tp11739p11744.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [Flex] Map Component

Posted by Paul Hastings <pa...@gmail.com>.
Latitude range is +/-90°. Might be the coords are swapped longitude,
latitude. If so, puts that object somewhere in oz not UK.

Were these coords the result of projecting? Bad imput params?

PS: in the openscales project there's a port of proj4 to AS that works a
treat.

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Wed, Jan 13, 2016 at 2:02 PM, OmPrakash Muppirala <bi...@gmail.com>
wrote:

> I took the coordinates from your earlier code and tried it out:
>
> override protected function createMap():void
> {
> var mc:MercatorProjection  = new MercatorProjection();
> mc.initialize();
> var a:Array =  [
> [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 ]]
> this.graphics.clear();
> this.graphics.lineStyle(2,0xFF0000);
> this.graphics.beginFill(0x999999);
> for(var i:int = 0; i < a.length-1; i++)
> {
> var ltlg:Array = a[i];
> var p:Point = new Point();
> p = mc.project(ltlg[0],ltlg[1], p);
> this.graphics.lineTo(p.x,p.y);
> }
> this.graphics.endFill();
> }
>
> The resultant shape looks pretty much like a straight line, though.
>
> Are you sure 151.25715360000004, -33.743317043500042 is actually a valid
> lat/long co-ordinate?  I am not able to plot it on google maps.
>
>
Duh, it is long/lat and not lat/long.  So yes, the co-ordinates are valid
and can be seen on Google Maps.
I will continue to experiment with this when I get some time.

Thanks,
Om


> Thanks,
> Om
>
>
> On Wed, Jan 13, 2016 at 1:31 PM, OmPrakash Muppirala <bigosmallm@gmail.com
> > wrote:
>
>> Give me the list of lat/long co-ordinates and the end result shape they
>> should look like.  I will try out a few things and see we can make this
>> work.
>>
>> Thanks,
>> Om
>>
>> On Wed, Jan 13, 2016 at 7:36 AM, OmPrakash Muppirala <
>> bigosmallm@gmail.com> wrote:
>>
>>>
>>> On Jan 13, 2016 4:36 AM, "Deepak MS" <me...@gmail.com> wrote:
>>> >
>>> > Ok. But it isn't converting lat\long values to expected path data
>>> > coordinates I believe.
>>>
>>> What's happening?  Can you post the relevant code and output?
>>>
>>> Thanks,
>>> Om
>>>
>>> >
>>> > On Wed, Jan 13, 2016 at 5:37 PM, OmPrakash Muppirala <
>>> bigosmallm@gmail.com>
>>> > wrote:
>>> >
>>> > > 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" <me...@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 <
>>> > > bigosmallm@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" <me...@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.
>>> > > > > >
>>> > > > >
>>> > > >
>>> > >
>>>
>>
>>
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
I took the coordinates from your earlier code and tried it out:

override protected function createMap():void
{
var mc:MercatorProjection  = new MercatorProjection();
mc.initialize();
var a:Array =  [
[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 ]]
this.graphics.clear();
this.graphics.lineStyle(2,0xFF0000);
this.graphics.beginFill(0x999999);
for(var i:int = 0; i < a.length-1; i++)
{
var ltlg:Array = a[i];
var p:Point = new Point();
p = mc.project(ltlg[0],ltlg[1], p);
this.graphics.lineTo(p.x,p.y);
}
this.graphics.endFill();
}

The resultant shape looks pretty much like a straight line, though.

Are you sure 151.25715360000004, -33.743317043500042 is actually a valid
lat/long co-ordinate?  I am not able to plot it on google maps.

Thanks,
Om


On Wed, Jan 13, 2016 at 1:31 PM, OmPrakash Muppirala <bi...@gmail.com>
wrote:

> Give me the list of lat/long co-ordinates and the end result shape they
> should look like.  I will try out a few things and see we can make this
> work.
>
> Thanks,
> Om
>
> On Wed, Jan 13, 2016 at 7:36 AM, OmPrakash Muppirala <bigosmallm@gmail.com
> > wrote:
>
>>
>> On Jan 13, 2016 4:36 AM, "Deepak MS" <me...@gmail.com> wrote:
>> >
>> > Ok. But it isn't converting lat\long values to expected path data
>> > coordinates I believe.
>>
>> What's happening?  Can you post the relevant code and output?
>>
>> Thanks,
>> Om
>>
>> >
>> > On Wed, Jan 13, 2016 at 5:37 PM, OmPrakash Muppirala <
>> bigosmallm@gmail.com>
>> > wrote:
>> >
>> > > 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" <me...@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 <
>> > > bigosmallm@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" <me...@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.
>> > > > > >
>> > > > >
>> > > >
>> > >
>>
>
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
Give me the list of lat/long co-ordinates and the end result shape they
should look like.  I will try out a few things and see we can make this
work.

Thanks,
Om

On Wed, Jan 13, 2016 at 7:36 AM, OmPrakash Muppirala <bi...@gmail.com>
wrote:

>
> On Jan 13, 2016 4:36 AM, "Deepak MS" <me...@gmail.com> wrote:
> >
> > Ok. But it isn't converting lat\long values to expected path data
> > coordinates I believe.
>
> What's happening?  Can you post the relevant code and output?
>
> Thanks,
> Om
>
> >
> > On Wed, Jan 13, 2016 at 5:37 PM, OmPrakash Muppirala <
> bigosmallm@gmail.com>
> > wrote:
> >
> > > 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" <me...@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 <
> > > bigosmallm@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" <me...@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.
> > > > > >
> > > > >
> > > >
> > >
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
On Jan 13, 2016 4:36 AM, "Deepak MS" <me...@gmail.com> wrote:
>
> Ok. But it isn't converting lat\long values to expected path data
> coordinates I believe.

What's happening?  Can you post the relevant code and output?

Thanks,
Om

>
> On Wed, Jan 13, 2016 at 5:37 PM, OmPrakash Muppirala <bigosmallm@gmail.com
>
> wrote:
>
> > 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" <me...@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 <
> > bigosmallm@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" <me...@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.
> > > > >
> > > >
> > >
> >

Re: [Flex] Map Component

Posted by Deepak MS <me...@gmail.com>.
Ok. But it isn't converting lat\long values to expected path data
coordinates I believe.

On Wed, Jan 13, 2016 at 5:37 PM, OmPrakash Muppirala <bi...@gmail.com>
wrote:

> 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" <me...@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 <
> bigosmallm@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" <me...@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.
> > > >
> > >
> >
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
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" <me...@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 <bigosmallm@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" <me...@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.
> > >
> >
>

Re: [Flex] Map Component

Posted by Deepak MS <me...@gmail.com>.
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 <bi...@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" <me...@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.
> >
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
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" <me...@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.
>

Re: [Flex] Map Component

Posted by OmPrakash Muppirala <bi...@gmail.com>.
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" <me...@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.
>