Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
flpfontes
Contributor
Contributor

round multiple numbers into a string

I have the string below that I use as geometry on a map.

'[[[-49.257637576428515,-21.153872296953146],[-49.257573880688824,-21.15382934149812],[-49.257458748716047,-21.153740688099635],[-49.257388990039836,-21.15369336801955],[-49.257278032748502,-21.153574646281864],[-49.257160315316412,-21.153445817170923],[-49.25711514464686,-21.153387279143519],[-49.257062381349165,-21.153259119944327],[-49.256944453796763,-21.153082969745487],[-49.256904808490155,-21.153009433432462],[-49.256859814283089,-21.152935841103737],[-49.256803055692032,-21.152887937568245],[-49.256737227139261,-21.152766095506806],[-49.256655468411239,-21.152634052521432],[-49.256617409969067,-21.152555513213429],[-49.256569367745627,-21.152481173148278],[-49.256503867484774,-21.152396615510021],[-49.256468866804845,-21.152318107681896],[-49.256416138531193,-21.152252321725154],[-49.256317065016816,-21.152097874226101],[-49.256245006327354,-21.151986005479564],[-49.256188407319691,-21.151859239970658],[-49.256114727690374,-21.151755239733404],[-49.256055450425791,-21.151661426482594],[-49.255990865365575,-21.151563972657407],[-49.255940640654593,-21.151480289445317],[-49.255909847121508,-21.151434087611506],[-49.255819717863616,-21.151299089332426],[-49.255699575583073,-21.151116463755379],[-49.255589931719783,-21.150951152998299],[-49.255508887978984,-21.150823418136344],[-49.255456648668549,-21.150716054646146],[-49.255448914046326,-21.150658619357714],[-49.255449804231226,-21.150582631981905],[-49.255452794445901,-21.150523156653438],[-49.25550924994544,-21.150466383120285],[-49.255615929321323,-21.150428050237103],[-49.255763898744341,-21.150387993184612],[-49.255968500093488,-21.150341349779335],[-49.256117158211339,-21.150307751328111],[-49.256362334454209,-21.150255072842601],[-49.256573829918779,-21.150207065377643],[-49.256788464833413,-21.150151920984499],[-49.25700769341492,-21.150096106453802],[-49.257142604227347,-21.150061649204776],[-49.257173187219401,-21.150060529844158],[-49.257209665328354,-21.150078112210245],[-49.257269002472377,-21.15016690820919],[-49.257414472643212,-21.15040571573719],[-49.257518509383011,-21.150593192745216],[-49.257598596539431,-21.150737406399092],[-49.257700988454367,-21.150934904059898],[-49.257821670162713,-21.151136892099434],[-49.257972356800842,-21.151387224058162],[-49.258112513834718,-21.15162310770836],[-49.258170113640986,-21.151729809411417],[-49.258301948581789,-21.151958438266593],[-49.258318819830109,-21.152018835310109],[-49.258348641190636,-21.152082950599048],[-49.258370247912005,-21.152130490917898],[-49.258425051331429,-21.152214937792959],[-49.258455862586842,-21.152259705963857],[-49.258526537792484,-21.152359372241932],[-49.258680946265365,-21.152618345325489],[-49.258801437754201,-21.152836819438839],[-49.258832410766615,-21.152889594615047],[-49.258891776405093,-21.152986993775322],[-49.258967909536132,-21.153121009298339],[-49.25899595068752,-21.153173874412456],[-49.259043314652175,-21.153262785149316],[-49.259102022282079,-21.153361969502434],[-49.259128811742222,-21.153413028792428],[-49.259148652215572,-21.153459236646857],[-49.259152844278297,-21.153481983569105],[-49.259146218300671,-21.153504021243261],[-49.259124363762744,-21.153521122296205],[-49.259077778223208,-21.153529006957452],[-49.258905924365955,-21.153574438228308],[-49.258712963975121,-21.153627418142214],[-49.258544095876523,-21.153667979694074],[-49.258272764314562,-21.153734730696272],[-49.258027472706289,-21.153796730957435],[-49.257753840063359,-21.153864174577645],[-49.257682570227757,-21.153880647357422],[-49.257637576428515,-21.153872296953146]]]'


How to round the numbers in this string to 5 places?

 

I noticed that with smaller decimal places the map renders faster

Labels (1)
3 Replies
lironbaram
Partner - Master III
Partner - Master III

Hi, 
you can try to use this script function in the script 
georeducegeometry which simplifies the area 
have a look at the attached app
you'll see your original area and a simplified area

flpfontes
Contributor
Contributor
Author

@lironbaram  

On small tables the georeducegeometry function worked perfectly, but on large tables I'm getting the error

The memory limit for the request was reached
Out of object memory

marcus_sommer

I think a classical rounding on these multiple values within a string won't be possible else you will always need additionally measures to split the string and apply the transformation and and merging everything together again. IMO it's easier as it sounds. I think I would go with an approach like:

m: mapping load
subfield(purgechar(GEO_DATA, '[]'), ',') as Lookup,
round(subfield(purgechar(GEO_DATA, '[]'), ','), 0.0001) as Return
from Source;

Geo:
load *, mapsubstring('m', GEO_DATA) as GEO_DATA_New from Source;

- Marcus