Highlighted

Best way to reorganize coordinates....

New Here ,
Jul 10, 2017

Copy link to clipboard

Copied

Hello All......

I need to reorganize longitudes and latitudes......

Here is what I have right now:

-81.93,39.19;-81.77,39.34;-81.38,39.2;-81.65,38.99

What I need is the following:

39.19,-81.93;39.34,-81.77;39.2,-81.38;38.99,-81.65

I have tried a number of methods, but just can't get it right. Now I going crazy.....

The above is represented with the #polygons# variable.

Any input would be appreciated.

Thank you so much!!!!

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

<cfset newList = "">

<!--- Treat oldList as list having delimiter ; --->

<cfset oldList = "-81.93,39.19;-81.77,39.34;-81.38,39.2;-81.65,38.99">

<cfloop list="#oldList#" index="element" delimiters=";">

    <!--- Reverse the coordinates, treating each list element as list having delimiter , --->

    <cfset x = listGetAt(element,2)>

    <cfset y = listGetAt(element,1)>

    <!--- Create newList as list having delimiter ; --->

    <cfset newList = listAppend(newList, x & "," & y, ";")>

</cfloop>

<cfoutput>

    oldList: #oldList# <br>

    newList: #newList#

</cfoutput>

Views

842

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Best way to reorganize coordinates....

New Here ,
Jul 10, 2017

Copy link to clipboard

Copied

Hello All......

I need to reorganize longitudes and latitudes......

Here is what I have right now:

-81.93,39.19;-81.77,39.34;-81.38,39.2;-81.65,38.99

What I need is the following:

39.19,-81.93;39.34,-81.77;39.2,-81.38;38.99,-81.65

I have tried a number of methods, but just can't get it right. Now I going crazy.....

The above is represented with the #polygons# variable.

Any input would be appreciated.

Thank you so much!!!!

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

<cfset newList = "">

<!--- Treat oldList as list having delimiter ; --->

<cfset oldList = "-81.93,39.19;-81.77,39.34;-81.38,39.2;-81.65,38.99">

<cfloop list="#oldList#" index="element" delimiters=";">

    <!--- Reverse the coordinates, treating each list element as list having delimiter , --->

    <cfset x = listGetAt(element,2)>

    <cfset y = listGetAt(element,1)>

    <!--- Create newList as list having delimiter ; --->

    <cfset newList = listAppend(newList, x & "," & y, ";")>

</cfloop>

<cfoutput>

    oldList: #oldList# <br>

    newList: #newList#

</cfoutput>

Views

843

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 10, 2017 0
Advocate ,
Jul 11, 2017

Copy link to clipboard

Copied

What have you tried? Show us some code....

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 11, 2017 0
Adobe Community Professional ,
Jul 11, 2017

Copy link to clipboard

Copied

<cfset newList = "">

<!--- Treat oldList as list having delimiter ; --->

<cfset oldList = "-81.93,39.19;-81.77,39.34;-81.38,39.2;-81.65,38.99">

<cfloop list="#oldList#" index="element" delimiters=";">

    <!--- Reverse the coordinates, treating each list element as list having delimiter , --->

    <cfset x = listGetAt(element,2)>

    <cfset y = listGetAt(element,1)>

    <!--- Create newList as list having delimiter ; --->

    <cfset newList = listAppend(newList, x & "," & y, ";")>

</cfloop>

<cfoutput>

    oldList: #oldList# <br>

    newList: #newList#

</cfoutput>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 11, 2017 0
New Here ,
Jul 12, 2017

Copy link to clipboard

Copied

Thank you so much for your help!!!! I will try and implement.

Appreciate your feedback!!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 12, 2017 0
New Here ,
Jul 12, 2017

Copy link to clipboard

Copied

That worked perfectly!!!! Thank you again!!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 12, 2017 0
BKBK LATEST
Adobe Community Professional ,
Jul 12, 2017

Copy link to clipboard

Copied

I am glad to hear.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 12, 2017 0