Problem with adding a polygon

Hi,

I recently ran into a huge problem regarding the maps component. I need to draw a cities boundary as polygon but when I tried to copy and paste the geocode.json into Thunkable I realized that for whatever reason the text will just be cut off. I then tried to upload the .json file and access it in the blocks but that is not possible since entering = “city.json” just results in a text that says “city.json” and does not access the file…

Any solutions for this? Also I am wondering how I could tell if the user is within the polygon… I have not yet figured out a way but I couldn’t even try since I got stuck at importing the data already :confused:

Best, Chris

1 Like

Hello,

For experiments, I need json data. If you give me an example of such data or a way to get it, then I will look at the solution.

Alex

Here’s an example of what I am working with:

wien_geo.json.zip (22.1 KB)

Good

Check it

https://x.thunkable.com/projects/5defeb44901bbf03b5387d0a/project/properties/designer/

2 Likes

Thank you for this :slight_smile: what I don’t get is why this still works even tough when you compare the text block with the original it seems like it is cut off somewhere in between. The original ends with ]]]}]} while in the text block it ends with

So since your example is working I assume this is only a displaying bug?

Best, Chris

In fact, nothing is cut off. I work with tens of thousands of records without problems. Yes - displaing bug )))

Thanks for pointing that out. I hope Thunkable will fix the display problem with the text block but glad it still works anyways. Do you have an idea how I could get if the gps position is within a polygone?

also may I ask how you did the “set _list” without creating the variable first? When I try putting this blocks in my project I can only choose an existing variable…

cheers, Chris

  1. To determine that a point is inside the polygon, try to look at various algorithms. I did not work with this.

  2. To create a variable, I add a function block to the screen, add a parameter to it and then delete the function - the variable from the function parameter becomes available in the palette

and is there a benefit of doing so?

The benefits are enormous!

  1. The variable from the function parameter works a thousand times faster than any global variable
  2. The variable from the function parameter has a link mechanism when working with objects, which makes working with objects easier and does not need to be rewritten as in the case of global variables
  3. The variable from the function parameter can be made local
  4. The variable from the function parameter did not have such problems and bugs as global variables. You probably remember how, after the release of Live 120, users stopped working for this reason? I had no such problems, because I try not to use global blocks of variables.
1 Like