Receive email notifications by changing your settings.
Click on your picture in the top right corner, go to Preferences and select your notification preferences.
Click on your picture in the top right corner, go to Preferences and select your notification preferences.
Thank you for contributing to our forum!
Please keep in mind:
1. To only comment on the topic where the discussion is about. Do you have a new question or topic? Please start a new discussion.
2. Be kind to other users!
Please keep in mind:
1. To only comment on the topic where the discussion is about. Do you have a new question or topic? Please start a new discussion.
2. Be kind to other users!
Url Rain Area
Hi,
I would like to make a rain area with the API, but can't find the correct URL. Could you please help?
Thank you!
Tagged:
Comments
Hi Ward,
Good question!
API calls like this are pretty advanced, so I will need to get back to you on this after checking first on my end.
Regards,
Vincent
Hi Ward,
We had a look at the API calls available to you and we suggest you try the following:
1. Add an area (https://engine.tygron.com/api/session/event/editorarea/add/?token= )
2. Set an attribute (RAIN_M) for that area (https://engine.tygron.com/api/session/event/editorarea/set_attribute/?token=)
3. Add an array of values for the attribute.
See also: https://support.tygron.com/wiki/Rain_m_(Water_Overlay)
Please let us know if this works for you.
Regards, Vincent
Hi Vincent,
Thank you, but not sure if this works for me. Let me give you a bit more context. I have satelite-data (converted to a geojson) with the rainareas. There is just one value for each area. So, I have the sum of the rainfall for a day as an atribute in my geojson. I'd like to use this data.
It is very similair to the pilot Rudolf made (5/6: Neerslag modelleren aan de hand van radar beelden., https://www.youtube.com/watch?v=78sooKxMw9I)
So I think I should create area files in Tygron by uploading my file.
(https://engine.tygron.com/api/session/event/editorarea/import/?token=)
However, I do need some help with the different required paramters.0 .
So I think I need help with #1 and #4.
I am familiar with the base64 encoding and my guess is that I have to use it for one of the parameters.
And let say, this is the correct way forward. I now have different areas with an attribute RAIN_M. But what is next....
I dont know and I can really use some help
Thank you, Ward
Hey Ward,
I see some similarity to an earlier question also touching upon the subject of uploading your own geodata file:
https://community.tygron.com/forum/discussion/comment/857#Comment_857
An important preface is that although the IMPORT event in the API can be used if you want, and is used by the geo import wizard in the Tygron Platform client, it doesn't do any file handling in-and-of itself. It is up to the client (be it the Tygron Platform client application, or your own script) to unpack the file's data to the required parameters, which are JSON-structured gemoetry collections, and lists of names, attributenames, and attribute values.
It is still highly recommended to split up the steps: create the desired areas, assign them their needed polygons, give them the names you want, and set the appropriate attributes.
If you really want to use the import function and do this all in one call, the parameters for IMPORT are structured as follows:
1: A geometry collection consisting of one or more multiploygons. Each multipolygon will become a single Area in Tygron. This collection is a list, so the geometries are in an order. Let's assume a list of 2, so that's a first geometry and a second geometry
2: A list of names. Each name in the list will be matched to each geometry in order of appearance. So for a list of "[A, B]", the first geometry will be named A, and the second geometry will be named B.
3: A list of attribute (names) to define for all areas. Let's say FOO, BAR, and BLUB.
4: A list of lists of attribute values for all areas and their attributes. This is structured as a single list of values, each index in the list matching a specific area and attribute. For example, when importing 2 geometries and 3 attributes, you could provide the following input: "[ 1.0,2.0,3.0, 4.0, 5.0,[6.0, 7.0] ]".
The result will be an area A with FOO=1, BAR=2, BLUB=3 as attributes, and an area B with FOO=4,BAR=5, and BLUB will be an array of values, specifically "6 7"
After importing the areas via whichever route you prefer, you will have the areas in your project. Next, just like in the first step of the water overlay's wizard, you still need to set something to let the water overlay use those rain areas. Specifically, set the following Attribute of the Overlay:
https://support.tygron.com/wiki/Limit_rain_(Water_Overlay)
Remember the rule of thumb that each action in the Client has effectively an 1-on-1 endpoint in the API, and this works the other way around as well. For any use-case, it may be valuable to configure the setup you want to calculate via the client first, so that you are familiar with the required actions or the end-state of the data as you wish to have it configured in your project. If you inspect any kind of data in the API, then change any setting in your project, you can re-inspect the same data in the API and see the change effected by the user interface. You then also have a better idea of what data manipulation you need to perform via the API. This should help greatly with finding whatever options or configurations you wish to use.
Hi hi,
I'm stuck. Somehow I can't add polygons to an area.
I am using just the URL's (for instance add polygon (https://engine.tygron.com/api/session/event/editorarea/add_polygons/?token=) and there I use the following input:
The result is OK (204).
I copied the coordinates of an existing area in my project.
I have the same result when I use the somewhat more complicated url Import Area (https://engine.tygron.com/api/session/event/editorarea/import/?token=)
Adding an attribute to the same area (in my case 591) does work.
I tried both scripting it (Python) as well as just filling in the parameters on the url.
Hi Ward,
We will have a look at your case and get back to you.
Regards, Vincent
Hi @Ward van Laatum ,
What you see is that the imported data with CRS in 3857 is not properly converted to the local coordinates in the Tygron Geodesign Platform. When you use the editor, the conversion takes place in the background. When scripting and using the API, the conversion needs to be done before the import. You can do so by reading the CRS envelope and the local envelope. Then you can map the real world coordinates to the local coordinate system in your script.
Endpoint for extent in 3857 Pseudo-Mercator: https://engine.tygron.com/api/session/location/?f=JSON&token=
Map size endpoint for extent local coordinates: https://engine.tygron.com/api/session/items/settings/MAP_SIZE_M/?f=JSON&token=
Steps:
Note: In the Tygron Platform LOCAL coordinates start at 0-0 in the top left corner of the map, NOT in the bottom left corner!
Please let us know if this will work for you.
Regards, Vincent
Hi Vincent,
The numbers that give the map size are two numbers (https://engine.tygron.com/api/session/items/settings/MAP_SIZE_M/?f=JSON&token=). The first one is the with of the map, the second one the length of the map.
The LOCAL coordinate of the top left corner is 0,0. And therefore the map size gives in fact the coordinates of the bottom right corner (negative width, negative length of the map). Did I understand that correct?
Hi @Ward van Laatum ,
The LOCAL coordinates are positive values. For example, a 500m x500m area has at the right bottom the LOCAL coordinates X = 500 & Y = 500.
You have to take this in consideration when converting the extent to LOCAL.
Regards, Vincent
You can provide an input CRS when executing the event by adding a parameter to the query, for example adding &CRS=28992 to the url loads the polygons in the Amersfoort CRS. Note: by default 3857 is used.
For some specific events like add_polygons (but not e.g. import) this did not work due to a bug in the array handling. Today this bug has been resolved on both LTS and Preview servers (LTS release: 2021.10.8). We have also added some additional feedback on the currently selected CRS in the event example/explanation page in the API.